[PHP] speeding up PHP

2004-02-10 Thread merlin
Hi there,

I do have a performance question regarding php processing. There are 
some sites on the net like google, heise and others which are incredible 
fast in response time. Of course companies like google are running 
totally other systems, but there are smaller sites and companies doing 
almost the same verry fast page delivery.

Now I am wondering how this is possible on a LAMP application. My site 
is not slow, but also not fast. I was reading about php accellerator. 
Can anybody recommend this tool, is it complicated to install and 
configure? Are there any speed gains and are ther tools to messure the 
page delivery times?

Thank you for any information on that.

regards,

merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mnoGoSearch on Windows?

2004-02-10 Thread David Robley
In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
says...
 According to the PHP manual, the mnoGoSearch extension is not available 
 on the Windows platform.  I had considered installing mnoGoSearch on our 
 Windows box running PHP (even though I will have to pay for the Windows 
 version of mnoGoSearch).  However, now that I've seen this in the 
 manual, I want to know what my other search engine options may be (for 
 preferably free, open-source software).
 
 The search engine must index the site like a regular spider, and it 
 should include have the ability to include PDF docs, Word docs, etc. and 
 be configurable enough to exclude certain folders, etc.  I would also 
 like the ability to access the engine through PHP, if possible.
 
 Any suggestions or favorites out there?  I would prefer not to write one 
 on my own.
 
 Thanks.
 -Ben
 
You will probably find something here that meets your needs:

http://www.searchtools.com/tools/tools-win.html

or try http://www.google.com/search?q=windows+search+engine

Cheers
-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: speeding up PHP

2004-02-10 Thread Manuel Lemos
Hello,

On 02/09/2004 11:36 PM, Merlin wrote:
I do have a performance question regarding php processing. There are 
some sites on the net like google, heise and others which are incredible 
fast in response time. Of course companies like google are running 
totally other systems, but there are smaller sites and companies doing 
almost the same verry fast page delivery.

Now I am wondering how this is possible on a LAMP application. My site 
is not slow, but also not fast. I was reading about php accellerator. 
Can anybody recommend this tool, is it complicated to install and 
configure? Are there any speed gains and are ther tools to messure the 
page delivery times?
Most details about Google and other sites speed do not have much to do 
the actual code that generates the pages. For instance, they use 
distributed data centers and DNS around the world to make the servers 
that you actually access be closer to you and start serving pages sooner.

They also use compressed pages to reduce the actual size of the 
information that is transferred. You can use compression of pages in PHP 
too, but in my experience it is much simpler to use a module of your Web 
server that does that job transparently, like for instance mod_gzip for 
Apache.

Search engines also do not use SQL databases. Usually they just lookup 
static indexes to speedup lookup.

Sites like Google also avoid using many images. Images can make a site 
look nicer but they are often irrelevant and retard the site loading.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] SESSION VARIABLES

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 02:45, Ronald Ramos wrote:
 $_SESSION['username'];
 $_SESSION['password'];

Close, try this instead:
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;

 I edited page3.php but it still shows me nothing.

It looks great, now you just need to clear up your use of the $_SESSION
variable in page2.php.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: speeding up PHP

2004-02-10 Thread Galen
Yes, compression is key. Faster servers with HUGE internet connections 
serving COMPRESSED content make sites feel snappy. Look under 
microtime() in the php manual for an example that will benchmark how 
much time your page actually takes to produce... you'll probably find 
it incredibly small... like 0.02 seconds or something if it's a decent 
shared host like mine. The rest is compression (reduces data transfer), 
page complexity (simpler HTML shows up faster, fewer images make the 
page load faster), and internet latency/bandwidth (fast, fat pipes are 
way better than a site hosted off DSL - latency in packet delievery 
alone could cost 1/2 second in some situations).

So before you look into PHP accelerators, benchmark your code. It's not 
likely your PHP, it's more likely your too complex HTML and/or no 
compression and/or a slow (either bandwidth or latency) internet 
connection.

Even 1/4 second script parsing feels peppy with a big, low-latency 
pipe, simple HTML formatting, and on-the-fly compression. Just look at 
Google.

-Galen

On Feb 10, 2004, at 5:46 AM, Manuel Lemos wrote:

Hello,

On 02/09/2004 11:36 PM, Merlin wrote:
I do have a performance question regarding php processing. There are 
some sites on the net like google, heise and others which are 
incredible fast in response time. Of course companies like google are 
running totally other systems, but there are smaller sites and 
companies doing almost the same verry fast page delivery.
Now I am wondering how this is possible on a LAMP application. My 
site is not slow, but also not fast. I was reading about php 
accellerator. Can anybody recommend this tool, is it complicated to 
install and configure? Are there any speed gains and are ther tools 
to messure the page delivery times?
Most details about Google and other sites speed do not have much to do 
the actual code that generates the pages. For instance, they use 
distributed data centers and DNS around the world to make the servers 
that you actually access be closer to you and start serving pages 
sooner.

They also use compressed pages to reduce the actual size of the 
information that is transferred. You can use compression of pages in 
PHP too, but in my experience it is much simpler to use a module of 
your Web server that does that job transparently, like for instance 
mod_gzip for Apache.

Search engines also do not use SQL databases. Usually they just lookup 
static indexes to speedup lookup.

Sites like Google also avoid using many images. Images can make a site 
look nicer but they are often irrelevant and retard the site loading.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] SESSION VARIABLES

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 03:13, Ronald Ramos wrote:
 It Worked. Thanks Man!
 So I can use this to any other page?

Awesome!  You have access to the $_SESSION variables on any php page on
the same server.  Just make sure you call session_start() before you
access the $_SESSION array.

 Let's say I have two users, first one logged in, using ronald as
 username, while user ronald is still logged-in
 User nhadie also logged-in from somewhere, will the value of $username
 of user ronald be changed to nhadie?

No, with sessions there will essentially be multiple values for the
variables, one for each session.  When a user requests a page their
session id will be used to set the correct values in the $_SESSION
array.  For example, when ronald loads the page $_SESSION['username']
will be ronald.  When nhadie loads the page the $_SESSION['username']
variable will be nahdie.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] reading remote page content

2004-02-10 Thread Hamid Hossain
I wants to read some pages throug http call. Then, I am going to parse the 
returned string and do some process.

For example: I want to get the latest news from CNN.com daily. So, I want to 
call http://www.cnn.com and retrieve CNN's homepage content in a variable as 
a string. After that, I will apply some RegExp to extract what I want.

Regards,
Hamid Hossain
---
Check Amazon.com Latest PHP books:
http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20path=tg/browse/-/295223
Start Accepting CreditCard at your site in minutes:
http://www.2checkout.com/cgi-bin/aff.2c?affid=106720
Download Alexa Tool Bar to stop Pop-ups for FREE:
http://download.alexa.com/?amzn_id=zawraqclassif-20
Download Ready-Made Templates for your site:
http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] mysql functions

2004-02-10 Thread Angelo Zanetti
I have a query which returns only 1 row, which of the following would be the
best to get the value from the resultset:

mysql_result()
mysql_fetch_field()
mysql_fetch_row()

the resultset only returns 1 column, so basically its only 1 field i get
from the resultset.

thanx in advance.
angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mysql functions

2004-02-10 Thread Hamid Hossain
Use mysql_result and u can use mysql_fetch_object, mysql_fetch_array also.

The following example will show u how to do it with mysql_result which will 
retrive one row only.

From PHP Manual:
?php
   $link = mysql_connect(localhost, mysql_user, mysql_password)
   or die(Could not connect:  . mysql_error());
   $result = mysql_query(SELECT name FROM work.employee)
   or die(Could not query: . mysql_error());
   echo mysql_result($result,0); // outputs first employee's name

   mysql_close($link);
?
Regards,
Hamid Hossain
---
Check Amazon.com Latest PHP books:
http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20path=tg/browse/-/295223
Start Accepting CreditCard at your site in minutes:
http://www.2checkout.com/cgi-bin/aff.2c?affid=106720
Download Alexa Tool Bar to stop Pop-ups for FREE:
http://download.alexa.com/?amzn_id=zawraqclassif-20
Download Ready-Made Templates for your site:
http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad
Original Message Follows
From: Angelo Zanetti [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Subject: [PHP] mysql functions
Date: Tue, 10 Feb 2004 11:44:47 +0200
I have a query which returns only 1 row, which of the following would be the
best to get the value from the resultset:
mysql_result()
mysql_fetch_field()
mysql_fetch_row()
the resultset only returns 1 column, so basically its only 1 field i get
from the resultset.
thanx in advance.
angelo

Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mysql functions

2004-02-10 Thread Eric Bolikowski
Would advise mysql_fetch_row()

Angelo Zanetti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a query which returns only 1 row, which of the following would be
the
 best to get the value from the resultset:

 mysql_result()
 mysql_fetch_field()
 mysql_fetch_row()

 the resultset only returns 1 column, so basically its only 1 field i get
 from the resultset.

 thanx in advance.
 angelo

 
 Disclaimer
 This e-mail transmission contains confidential information,
 which is the property of the sender.
 The information in this e-mail or attachments thereto is
 intended for the attention and use only of the addressee.
 Should you have received this e-mail in error, please delete
 and destroy it and any attachments thereto immediately.
 Under no circumstances will the Cape Technikon or the sender
 of this e-mail be liable to any party for any direct, indirect,
 special or other consequential damages for any use of this e-mail.
 For the detailed e-mail disclaimer please refer to
 http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Zero Sized Reply

2004-02-10 Thread Eric Bolikowski
Some source code would help

Deependra B. Tandukar [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Dear all,

 The script was working perfectly, but all of the sudden since last week
 stopped working, gives Zero Sized Reply. The site is
 http://coremag.net/corex/feedback/feedback.htm

 Can anybody tell me what is the problem. Below is the page I get when
 submit the form:

 ERROR
 The requested URL could not be retrieved

 While trying to retrieve the URL:
 http://coremag.net/corex/feedback/feedback.php

 The following error was encountered:
 Zero Sized Reply

 Squid did not receive any data for this request.

 Your cache administrator is webmaster.

 Generated Tue, 10 Feb 2004 06:05:32 GMT by cache3.mos.com.np
 (squid/2.5.STABLE3)

 Regards,
 DT

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Poor error handling in Postgres API?

2004-02-10 Thread Geoff Caplan
Hi folks,

Using the Postgres extension for the first time, and am somewhat taken
aback by the approach to error handling.

First: error numbers

With the MySQL api, you can get an error number. With the Postgres
extension, it seems you can only get a message string. So to test for
a particular error, you have to run a regex and hope the developers
don't change the error message. Is this the situation, or am I missing
something?

Second: pg_result_error( $result_resource )

The manual recommends this over pg_last_error( ) but I'm baffled by
how to use it. pg_query() returns FALSE on failure, not a result
resource. So when there's an error there is no resource for
pg_result_error( ) to use. What's going on here??

Finally: system error handling

On failure, pg_query() throws a PHP SYSTEM_WARNING. This seems odd:
why should PHP react to something happening internally inside
Postgres? The MySQL extension behaves as you would expect, and throws
no PHP error at all. On most systems, ours included, this is going to
screw up the error handling. So you have to wrap every Postgres query
with:

$level = error_reporting( 0 ); // Errors off
pg_query( ... ) ;
error_reporting( $level ); // Back to default errors

Not a major issue for us as we have an abstraction api and only have
to do this in one place, but still an unnecessary resource hit. There
doesn't seem to be a configuration option to change this odd
behaviour. Again, is this really the situation or am I missing
something?

-- 

Geoff Caplan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Linked Table Structure

2004-02-10 Thread Eric Bolikowski
Sajid [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 HI,

 I have a problem.

 I dont know how to create tables for this in PHPMYADMIN, the situation is
 like this:

 I have to display lot of items on the screen.

 There are three Datagrids on the screen (I am using Flash for this so if i
 get the database structure right, i will be able to take care of the rest
of
 the scripting to returning data from database.).

 Lets say the three DataGrids are called:

 DG1, DG2 and DG3

 DG1 displays the list of CONTINENTS like (Norht America, Asia, South
 America, Australia etc.)

 If you click any region in DG1, DG2 gets populated with list of countries
 (like USA, Canada, Mexico... etc.)

 At the same time, when i have clicked a CONTINENT in DG1, an image of the
 CONTINENT is displayed on the screen.

 Now, If i click on any Country in DG2, DG3 is getting populated with a ist
 of Clubs (like Club1, Club2, Club3 etc.)

 At the same time, An image of the country and a description of the country
 are displayed on the screen.

 again, if i click on any CLUB, it displays a Image, description and URL of
 the CLUB.

 I dont know what the DATABASE STRUCTURE shold look like for this. I know
 there has to be some kind of LINKING between the tables but i dont know
 HOW. :(

 I have been trying few things but without any success :(

 ---
 The DG1 field will be:
 Continent_Name | Continent_Image | Continent_Text

 The DG2 fields will be:
 Country_Name | Country_Image | Country_Text

 The DG3 fields will be:
 Club_Name | Club_Image | Club_Text | Club_Url
 ---

 Can anyone show me the Sql for such a table structure?

Hi Sajid

It seems like the Country in some manner has to be a undercategory for the
continent, and the club a undercategory for the Country.

A way you could do this, is to set up the tables like this:

DG1:
Continent_Id | Continent_Name | Continent_Image | Continent_Text

DG2: Country_Id | Continent_Id | Country_Name | Country_Image | Country_Text

DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url

The id fields should be datatype INT, name and Url something like
varchar(100), the text tinytext, and the images BLOB.

What you could do is when the user first comes you run this query: SELECT
Continent_Id, Continent_Name FROM DG1. If you want to grab the text too you
could just add Continent_Text in the query. To get the image, I would
recommend some kind of file that gets the Content_Id and, gets the image,
and prints it out.
Now, when you display all of your continents(up to you), you should make
them a link to the same file, but now giving a Continent_Id to the the file.
Now, let's simulate someone clicked Europa, and that has a Continent_Id of
4.
Then we go to the following file: foo.php?op=continentid=4.

Here we can run this query: SELECT Continent_Name, Country_Id, Country_Name
FROM DG2 WHERE Continent_Id = {$_GET['id']}.
What we simply get here, is all the countries that are in the continent
Europa, with the id 4 in DG1.

Now we get the list, and you display that too.
What you can do now, is too display links to the next step: showing the
clubs.

Let's say we want to take a look at France, and that country has 9 as a
Country_Id.
Now let's say we're at the following file: foo.php?op=clubsid=9

Now we can run the following query: SELECT Club_Id, Club_Name, Club_Url
FROM DG3 WHERE Country_Id = {$_GET['id']}.
Here we get all the clubs in France.

I hope this was something helpful.
Would be glad too demonstrate how to get the Country name and the Continent
name while showing the club, but i think you're albe to sort this out now!

Eric



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: reading remote page content

2004-02-10 Thread Eric Bolikowski
Hamid Hossain [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I wants to read some pages throug http call. Then, I am going to parse the
 returned string and do some process.

 For example: I want to get the latest news from CNN.com daily. So, I want
to
 call http://www.cnn.com and retrieve CNN's homepage content in a variable
as
 a string. After that, I will apply some RegExp to extract what I want.


 Regards,
 Hamid Hossain

 ---
 Check Amazon.com Latest PHP books:

http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20path=tg/browse/-/295223

 Start Accepting CreditCard at your site in minutes:
 http://www.2checkout.com/cgi-bin/aff.2c?affid=106720

 Download Alexa Tool Bar to stop Pop-ups for FREE:
 http://download.alexa.com/?amzn_id=zawraqclassif-20

 Download Ready-Made Templates for your site:
 http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad



?php

$fp = fopen('http://www.cnn.com/', 'r');
while($cnn .= fread($fp, 100));
fclose($fp);

print $cnn;

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHPINIDir in Apache 1.x, extension/zend_extension in php_admin_value

2004-02-10 Thread David Garamond
1. Why does the Apache 1.x SAPI doesn't provide the PHPINIDir directive? 
Is it due to some kind of limitation in Apache 1.x?

2. Can we load extension with php_admin_value, e.g.:

 php_admin_value extension /usr/lib/php4/imap.so
 php_admin_value zend_extension /usr/lib/php4/php_accelerator_1.3.3r2.so
I can't seem to do this. I want to setup several different Apache 
running on a different port and different Unix user. Each mod_php4 in 
this Apache is differently tuned. What's the best way to do this (I 
don't want to have to configure + build mod_php4 for each of these 
Apache instances, just so that I can specify php.ini path for each; 
that's silly).

--
dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] unset Fuction

2004-02-10 Thread JohnT
Hello,

mind explain a little bit further cause i'm confused and not sure if the
fuction really work or something

On 1st example using unset() in a function
///   CODE   /
function foo() {
static $a;
$a++;
echo $aBR;
 unset($a);
}

foo();
foo();
foo();
///

***  RESULT 
1
2
3


On 2nd example removing unset() in a function, result is same as with
unset() on it.  Should it be all 1's at this time?
///   CODE   /
function foo() {
static $a;
$a++;
echo $aBR;
}

foo();
foo();
foo();
///

***  RESULT 
1
2
3



Is it the code, function, or my php setup..any idea ???

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] adduser.exe

2004-02-10 Thread Christian Jancso
Hi there,

I have to write a PHP code for adding users to an email server.
For this I use an application called adduser.exe from Ipswitch IMail
Server 8.04.
Can anyone tell me how I can use this file with a PHP code?

Please note that the PHP runs on a different machine than the email
software.
So the function exec and shell_exec won't work. I have to execute the
file on the
mail server not on the web server.

I tried it like this:

html
form action=http:\\server-url\cgi-bin\adduser.exe method=post
input type=text  name=firstname/input
input.
/form
/html

Should this work? If yes, how can I post the values to adduser.exe file?
Are there other/better solutions?

TIA
Christian

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHPINIDir in Apache 1.x, extension/zend_extension in php_admin_value

2004-02-10 Thread David Garamond
David Garamond wrote:
1. Why does the Apache 1.x SAPI doesn't provide the PHPINIDir directive? 
Is it due to some kind of limitation in Apache 1.x?

2. Can we load extension with php_admin_value, e.g.:

 php_admin_value extension /usr/lib/php4/imap.so
 php_admin_value zend_extension /usr/lib/php4/php_accelerator_1.3.3r2.so
I can't seem to do this. I want to setup several different Apache 
running on a different port and different Unix user. Each mod_php4 in 
this Apache is differently tuned. What's the best way to do this (I 
don't want to have to configure + build mod_php4 for each of these 
Apache instances, just so that I can specify php.ini path for each; 
that's silly).
I've found a solution to my problem, using PHPRC environment variable.

--
dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: unset Fuction

2004-02-10 Thread Paul Furman
Johnt wrote:
function foo() {
static $a;
$a++;
echo $aBR;
 unset($a);
}
foo();
foo();
foo();
///
***  RESULT 
1
2
3

Should it be all 1's at this time?
Is it the code, function, or my php setup..any idea ???


I thought the purpose of unset was to remove positions inside arrays. 
Not sure if it was intended for simple variables. I've used it for 
checking isset like this:

unset ($_POST[...
isset ($_POST[...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] unset Fuction

2004-02-10 Thread Oschlies Dirk (Praktikant FV/SLH)
Hello John,

 From: JohnT [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 10, 2004 4:54 AM
 
 Hello,
 
 mind explain a little bit further cause i'm confused and not 
 sure if the
 fuction really work or something
 
 [some Code]

As far as I know (or understand), unset() will only destroy the reference to a 
variable.

That's why you get sometimes a bit confusing results when unset variables insinde 
functions, because they are often just a reference or even a copy of another variable.
(for example using global $a; is equal to $a = $GLOBALS['a'])

See:
  Chapter References Explained
   - Unsetting References
  and Function Reference of unset()
of the php Manual.

Now I guess that a static variable is only available via reference in a function call.
Otherwise it would be unseted if the function call is finished, what's not the use of 
a static var.

How to fix this problem:
The purpose of your code was to reset the value of the static variable.
So just do this reseting by assigning the value you wanted, e.g.

///   CODE   /
function foo() {
static $a;
$a++;
echo $aBR;
$a = 0;
}

foo();
foo();
foo();
///

Now it outputs:
1
1
1



Regards,
Dirk Oschlies

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: speeding up PHP

2004-02-10 Thread Paul Furman
When I started looking into this I was told ASP was slow at processing 
very large databases (and I think also large numbers of users) but I 
don't think this becomes a problem unless the site is extremely large or 
gets an awful lot of traffic.

Merlin wrote:

Hi there,

I do have a performance question regarding php processing. There are 
some sites on the net like google, heise and others which are incredible 
fast in response time. Of course companies like google are running 
totally other systems, but there are smaller sites and companies doing 
almost the same verry fast page delivery.

Now I am wondering how this is possible on a LAMP application. My site 
is not slow, but also not fast. I was reading about php accellerator. 
Can anybody recommend this tool, is it complicated to install and 
configure? Are there any speed gains and are ther tools to messure the 
page delivery times?

Thank you for any information on that.

regards,

merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: file downloads using header problem

2004-02-10 Thread memoimyself
Hello Joshua,

On 9 Feb 2004 at 15:45, Joshua Minnie wrote:

 Does anybody have any idea to allow for multiple downloads while another
 one was going on.  Maybe some additional headers?  I have tried adding
 headers before and after where I open the file for HTTP/1.1 200 OK and the
 corresponding headers.  I have also tried using a simple meta refresh, but
 that doesn't work because it won't refresh until the page is entirely
 loaded.
 
 I am at a loss, I can't seem to find answer when I google it either. 
 Maybe I'm just missing something.  I don't know.

The same script can only send headers to the browser once each time it's loaded. In 
other words, after a script has been parsed and the page has been loaded, it cannot 
send more headers to the browser unless you reload it. Since in your case the same 
script (i.e. same page) does everything, it can only handle one download at a time; 
that's basically what I think you're missing.

A simple solution is to have each download link call a *separate* script (i.e. another 
page) whose sole purpose is to take care of generating the download, i.e. sending the 
headers and the file to the user's browser. Think about how ZDNet or Tucows, for 
example, work: first you choose the file you want to download from a menu (the main 
download page, which doesn't actually generate the downloads), and then when you 
click on the download link you're taken to a new page (the one that actually takes 
care 
of the download) that tells you to wait a few seconds until the download starts.

If you're concerned about security (i.e. unauthorized users downloading files by 
accessing the actual download script directly without going through the page where 
they see the file list etc.), you can use some kind of random authorization code that 
is 
sent by the main download script via a GET string to the actual download page. That 
way, if the right authorization code is not received by the script on the page that 
generates the headers and sends the file to the browser, the download will fail. (Note 
that I suggested a GET string because you cannot normally start sessions before 
sending headers to the browser, as session_start() will itself send headers. But you 
can 
always play with output buffering if you like.)

Hope this helps,

Erik

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] adduser.exe

2004-02-10 Thread Raditha Dissanayake
hi,
This is something very dangerous. And you can't just post to an exe file 
just like that.
Your best bet would be to map the network drive  and invoke it from 
there. However this might cause other complications with mising dls etc.

Since this is a commercial product oyu might want to ask the company 
that sells it for their help as well.

all the best

Christian Jancso wrote:

Hi there,

I have to write a PHP code for adding users to an email server.
For this I use an application called adduser.exe from Ipswitch IMail
Server 8.04.
Can anyone tell me how I can use this file with a PHP code?
Please note that the PHP runs on a different machine than the email
software.
So the function exec and shell_exec won't work. I have to execute the
file on the
mail server not on the web server.
I tried it like this:

html
form action=http:\\server-url\cgi-bin\adduser.exe method=post
input type=text  name=firstname/input
input.
/form
/html
Should this work? If yes, how can I post the values to adduser.exe file?
Are there other/better solutions?
TIA
Christian
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql functions

2004-02-10 Thread John W. Holmes
From: Angelo Zanetti [EMAIL PROTECTED]

 I have a query which returns only 1 row, which of the following would be
the
 best to get the value from the resultset:

 mysql_result()
 mysql_fetch_field()
 mysql_fetch_row()

 the resultset only returns 1 column, so basically its only 1 field i get
 from the resultset.

mysql_result($result,0)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] adduser.exe

2004-02-10 Thread Stuart
Christian Jancso wrote:
I have to write a PHP code for adding users to an email server.
For this I use an application called adduser.exe from Ipswitch IMail
Server 8.04.
Can anyone tell me how I can use this file with a PHP code?
You can't simply post to adduser.exe - it's not a CGI application. What 
you'll need to do is wrap the exe in a CGI script (in perl, php, 
whatever). I had to do this with a much older version of IMail a while 
ago and it worked fine once I had it working.

--
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] counting downloaded files

2004-02-10 Thread Adriaan Nel
Hi,

I am using the following piece of code, to download files, but the files are
allways corrupt...what am I doing wrong?


if ($submit) {
 $full_filename = $_POST[full_filename];
 $filename = $_POST[filename];
 $dir = $_POST['dir'];
 $size = $_POST[size];
 $id = $_POST[id];

 if((file_exists($full_filename))  (substr(decoct(fileperms($dir)),-1) =
4)) {
  header(Content-type: . application/exe);
  header(Content-Disposition:  . attachment . ;
filename=\.$filename).\;
  header(Content-Length: .$size);
  $fp = readfile($full_filename, r);
  mysql_query (INSERT INTO files_downloaded
VALUES('$id','$ip',NOW()),$db_connection) or die (mysql_error());
  return $fp;
 }
}


I need to use some kind of form element to initiate the download, as I need
to keep track of the number of downloads...

Thanks for you help in advance
Adriaan Nel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] writing a manual

2004-02-10 Thread David T-G
Tim --

...and then Tim Thorburn said...
% 
% Hi,

Hiya!


% 
% Sorry for the slightly off-topic post, but I've just had a client ask me to 
% create a manual for the site management tool I wrote for them last 

Interesting...  You mean the tool isn't self-documenting? ;-)


% fall.  Since I've never had to do one before I'm a bit lost on what would 
% be a reasonable amount to charge and whether or not I should put any 

Technical writers charge plenty of money, too, so don't feel that this
work shouldn't cost much.  If I were you I'd set an hourly rate, perhaps
the same as your usual programming rate, and then spend an hour or two
sketching out an outline and perhaps an introduction.  This will give you
a better idea of how long it will take to do the whole thing and also
give the client something to see when he sees your quote (or estimate).


% restrictions on how many copies they receive or if I'm ok with them 
% photocopying and handing them out all over the organization.

Personally I wouldn't worry about this.  Deliver it in soft copy anyway
and then let them print as many copies as they like.  You're already
making money from the app (right? :-)

Once you get the hang of it, you may even integrate documentation into
your coding process (and, therefore, the price) so that a basic manual is
done when the code is and then you need only charge for fleshing it out.


% 
...
% PHP/MySQL stuff, though last time I tried to put a manual together it 
% quickly got to be over 40 pages and that client decided they didn't want it 
% in the end.

This is another reason you want to charge for your initial development
and show them where you're going.  There's no need to spend hours and
hours on the project only to not get paid for any of it.


% 
% Thanks
% -Tim


HTH  HAND  please let us know what you find and how you go

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Re: Linked Table Structure

2004-02-10 Thread Sajid
Hi,
Thanks for your help.
But what i feel is that this is a more tedious process to achieve what i
want to.
What will happen in this is that i have to enter proper Continent ID and
Country ID in both Country and Club tables respectively.
For that i have to go and check that these ID's are in the other tables.

I was looking for something to do with Linked Tables.
Can anyone show me an example of how this can be done using Linked Tables?

Thanks
sajid

Eric Bolikowski [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Sajid [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  HI,
 
  I have a problem.
 
  I dont know how to create tables for this in PHPMYADMIN, the situation
is
  like this:
 
  I have to display lot of items on the screen.
 
  There are three Datagrids on the screen (I am using Flash for this so if
i
  get the database structure right, i will be able to take care of the
rest
 of
  the scripting to returning data from database.).
 
  Lets say the three DataGrids are called:
 
  DG1, DG2 and DG3
 
  DG1 displays the list of CONTINENTS like (Norht America, Asia, South
  America, Australia etc.)
 
  If you click any region in DG1, DG2 gets populated with list of
countries
  (like USA, Canada, Mexico... etc.)
 
  At the same time, when i have clicked a CONTINENT in DG1, an image of
the
  CONTINENT is displayed on the screen.
 
  Now, If i click on any Country in DG2, DG3 is getting populated with a
ist
  of Clubs (like Club1, Club2, Club3 etc.)
 
  At the same time, An image of the country and a description of the
country
  are displayed on the screen.
 
  again, if i click on any CLUB, it displays a Image, description and URL
of
  the CLUB.
 
  I dont know what the DATABASE STRUCTURE shold look like for this. I know
  there has to be some kind of LINKING between the tables but i dont know
  HOW. :(
 
  I have been trying few things but without any success :(
 
  ---
  The DG1 field will be:
  Continent_Name | Continent_Image | Continent_Text
 
  The DG2 fields will be:
  Country_Name | Country_Image | Country_Text
 
  The DG3 fields will be:
  Club_Name | Club_Image | Club_Text | Club_Url
  ---
 
  Can anyone show me the Sql for such a table structure?

 Hi Sajid

 It seems like the Country in some manner has to be a undercategory for the
 continent, and the club a undercategory for the Country.

 A way you could do this, is to set up the tables like this:

 DG1:
 Continent_Id | Continent_Name | Continent_Image | Continent_Text

 DG2: Country_Id | Continent_Id | Country_Name | Country_Image |
Country_Text

 DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url

 The id fields should be datatype INT, name and Url something like
 varchar(100), the text tinytext, and the images BLOB.

 What you could do is when the user first comes you run this query: SELECT
 Continent_Id, Continent_Name FROM DG1. If you want to grab the text too
you
 could just add Continent_Text in the query. To get the image, I would
 recommend some kind of file that gets the Content_Id and, gets the image,
 and prints it out.
 Now, when you display all of your continents(up to you), you should make
 them a link to the same file, but now giving a Continent_Id to the the
file.
 Now, let's simulate someone clicked Europa, and that has a Continent_Id of
 4.
 Then we go to the following file: foo.php?op=continentid=4.

 Here we can run this query: SELECT Continent_Name, Country_Id,
Country_Name
 FROM DG2 WHERE Continent_Id = {$_GET['id']}.
 What we simply get here, is all the countries that are in the continent
 Europa, with the id 4 in DG1.

 Now we get the list, and you display that too.
 What you can do now, is too display links to the next step: showing the
 clubs.

 Let's say we want to take a look at France, and that country has 9 as a
 Country_Id.
 Now let's say we're at the following file: foo.php?op=clubsid=9

 Now we can run the following query: SELECT Club_Id, Club_Name, Club_Url
 FROM DG3 WHERE Country_Id = {$_GET['id']}.
 Here we get all the clubs in France.

 I hope this was something helpful.
 Would be glad too demonstrate how to get the Country name and the
Continent
 name while showing the club, but i think you're albe to sort this out now!

 Eric



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] adduser.exe

2004-02-10 Thread Christian Jancso
ok do you have an example how this should work?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] CURL and Cookies

2004-02-10 Thread jon roig
What about taking advantage of curl's built in cookie functions?

In particular, you should look at doing this with a two step process
utilizing the CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE functions. First,
log in... Then grab the article itself, once the session has begun.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,http://www.yoursite.com;); // set url to
post to 
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_REFERER, http://www.wsj.com;); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable 
curl_setopt($ch, CURLOPT_TIMEOUT, 50); // times out after 4s 
curl_setopt($ch, CURLOPT_COOKIEJAR, my_cookies.txt);  //initiates
cookie file
curl_setopt($ch, CURLOPT_COOKIEFILE, my_cookies.txt);  // Uses
previous session cookies
curl_setopt($ch,  CURLOPT_VERBOSE, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, mozilla/5.0 (x11; u; linux i686;
en-us; rv:1.5a) gecko/20030728 mozilla firebird/0.6.1);

-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557

-Original Message-
From: Richard Miller [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 09, 2004 6:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] CURL and Cookies


I would appreciate any help you can give me about a problem I am having 
with PHP's CURL functions.

I want to use CURL to download news from Wall Street Journal Online.   
When you visit the WSJ home page, you're forwarded to an authentication 
page to enter your name and password, and then forwarded back to the 
home page.  I want my CURL command to send the authentication cookie so 
when it's forwarded to the authentication page it forwards right back 
to the home page without having to enter the name and password.

I can get the following CURL command to run fine at the command prompt, 
but not in PHP:

THIS WORKS
curl --cookie WSJIE_LOGIN=blahblahblah -L -O 
http://online.wsj.com/home/us;

THIS DOESN'T WORK
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://online.wsj.com/home/us;);
curl_setopt($ch, CURLOPT_COOKIE, WSJIE_LOGIN=blahblahblah);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);



I used a packet sniffer to see how this works.  When I request the home 
page (above) and send the WSJIE_LOGIN cookie, the home page redirects 
to the authentication page.  The authentication page uses the 
WSJIE_LOGIN cookie to generate more cookies.  Then these 5-6 cookies 
are sent back to the home page and give the user access to the content. 
  The WSJIE_LOGIN cookie is my own personal authentication cookie; the 
other cookies change from time to time.  But I noticed that the PHP 
CURL isn't perpetuating these other cookies when it forwards back to 
the home page, like the command-line CURL does.  Here are blocks from 
the package capture:

CLI CURL
...
192.168.001.100.63745-206.157.193.068.00080: GET /home/us
HTTP/1.1
User-Agent: curl/7.10.2 (powerpc-apple-darwin7.0) libcurl/7.10.2

OpenSSL/0.9.7b zlib/1.1.4
Cookie: WSJIE_LOGIN=abc
Host: online.wsj.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Cookie: fastlogin=xyz; wsjproducts=xyz; user_type=xyz; 
REMOTE_USER=xyz; UBID=xyz
...

PHP CURL
...
192.168.001.100.63750-206.157.193.068.00080: GET /home/us
HTTP/1.1
Cookie: WSJIE_LOGIN=abc
Host: online.wsj.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
...

PHP's curl doesn't forward the cookies that it is given at the previous 
page, so, of course, I don't get my content.  Any ideas why?

Richard Miller

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] parse error, unexpected $

2004-02-10 Thread Bruno Mattarollo
Hello,

I am having a strange problem with PHP and I can't really find a proper 
answer, maybe someone have seen this before and can give me a hint.

I have a series of files (originally developed by another colleague) 
installed on a server with PHP 4.2.2 and I get this error:

Parse error: parse error, unexpected $ in 
/var/www/html/donation/installations/gpi/form.inc on line 528

Line 528 is actually the last line on that file, it's an empty line. 
Tried removing, adding spaces, and the number of lines change, always 
pointing to the last line. Checking online, I get similar comments from 
people when braces are unbalanced, i.e. a while loop that doesn't 
have a closing }. I have checked this file with Zend Studio for 
correctness and there is no problem, checked every block, all closed. 
Checked all the included files as well ...

The strange thing as well is that this runs on my laptop, running PHP 
4.3.4 and doesn't return any errors. Has anyone seen this? Where can I 
find the differences in syntax between these two PHP versions, maybe 
that's the cause...? I also looked at the possibility that it's the 
short_open_tag in the configuration file but it seems like the option 
is properly set in the httpd.conf file on pluto.greenpeace.com ... I am 
a bit lost now, any suggestions?

/B

--
Bruno Mattarollo [EMAIL PROTECTED]
Head of IT - Greenpeace International
[ http://www.greenpeace.org/ ]


PGP.sig
Description: This is a digitally signed message part


Re: [PHP] parse error, unexpected $

2004-02-10 Thread Raditha Dissanayake
Hi Bruno,

The line number is misleading the error is generally above the line 
that's reffered to. try commenting out sections of the code. If you have 
an IDE it will be able to point out the error. If you don't have an IDE 
some text editor that is capable of syntax highlighting will also help.

Bruno Mattarollo wrote:

Hello,

I am having a strange problem with PHP and I can't really find a 
proper answer, maybe someone have seen this before and can give me a 
hint.

I have a series of files (originally developed by another colleague) 
installed on a server with PHP 4.2.2 and I get this error:

Parse error: parse error, unexpected $ in 
/var/www/html/donation/installations/gpi/form.inc on line 528

Line 528 is actually the last line on that file, it's an empty line. 
Tried removing, adding spaces, and the number of lines change, always 
pointing
/B



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] counting downloaded files

2004-02-10 Thread Marek Kilimajer
Adriaan Nel wrote:

Hi,

I am using the following piece of code, to download files, but the files are
allways corrupt...what am I doing wrong?
if ($submit) {
 $full_filename = $_POST[full_filename];
 $filename = $_POST[filename];
 $dir = $_POST['dir'];
 $size = $_POST[size];
 $id = $_POST[id];
 if((file_exists($full_filename))  (substr(decoct(fileperms($dir)),-1) =
4)) {
  header(Content-type: . application/exe);
  header(Content-Disposition:  . attachment . ;
filename=\.$filename).\;
  header(Content-Length: .$size);
  $fp = readfile($full_filename, r);
  mysql_query (INSERT INTO files_downloaded
VALUES('$id','$ip',NOW()),$db_connection) or die (mysql_error());
  return $fp;
 }
}
You might have a php warning in the downloaded file, it will be either 
at the beginning or at the end, just open a text editor and view it.

Also you don't check $full_filename, users can submit enything, e.g. 
/etc/shadow or includes/config.php, and the script sends it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] adduser.exe

2004-02-10 Thread Stuart
Christian Jancso wrote:
ok do you have an example how this should work?
No I don't - it was a while ago, but it's quite simple. You just need to 
write a CGI script (you could use PHP if it's installed on the IMail 
server) to shell out to the adduser utility passing parameters made up 
from the query string. I would be very surprised if there weren't 
examples of doing this with IMail's adduser on the net somewhere. Google 
is your friend.

--
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] adduser.exe

2004-02-10 Thread Christian Jancso
ok tx for your help I will try this :-)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] counting downloaded files

2004-02-10 Thread Adriaan Nel
The variables I submit, are retrieved from a database...so users can't enter
anything,

I do have a warning inserted at the beginning of the file, how do I remove
this warning?


Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Adriaan Nel wrote:

  Hi,
 
  I am using the following piece of code, to download files, but the files
are
  allways corrupt...what am I doing wrong?
 
 
  if ($submit) {
   $full_filename = $_POST[full_filename];
   $filename = $_POST[filename];
   $dir = $_POST['dir'];
   $size = $_POST[size];
   $id = $_POST[id];
 
   if((file_exists($full_filename))  (substr(decoct(fileperms($dir)),-1)
=
  4)) {
header(Content-type: . application/exe);
header(Content-Disposition:  . attachment . ;
  filename=\.$filename).\;
header(Content-Length: .$size);
$fp = readfile($full_filename, r);
mysql_query (INSERT INTO files_downloaded
  VALUES('$id','$ip',NOW()),$db_connection) or die (mysql_error());
return $fp;
   }
  }
 

 You might have a php warning in the downloaded file, it will be either
 at the beginning or at the end, just open a text editor and view it.

 Also you don't check $full_filename, users can submit enything, e.g.
 /etc/shadow or includes/config.php, and the script sends it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using exceptions to write more perfect software ...

2004-02-10 Thread Markus Fischer
Hello Adam,

Adam Bregenzer wrote:
On Mon, 2004-02-09 at 15:58, Markus Fischer wrote:

But doing this now for every internal function call I don't want to
 lead my program into an unwanted state isn't very appealing.
snip

Ultimately I decided to wrap my necessary function calls in error
checking wherever they are in my files. This gives me more
granularity in the application of the error at the cost of some code
bloat. It's not an optimal solution but I have found I use little
functions calls in the first place that would generate an exception
in return.
	Isn't this the same thing I started doing anyway? I however didn't 
integrated those functions in my application directly but put them in a 
file of its own so I can (hopefully ;) reuse them.

Also, I have started using code generation for handling the data
side.
	This sounds very interesting. Can you elaborate how and what you 
actually did for generating the code (what was your input and how did 
you transform it)?

Ultimately I think it would be nice to have an object hierarchy of
the function calls in php. However I don't see php supporting it
natively and PEAR is still trying to sort itself out. Being a 'third
party' project it is too much for one person but would be quite
useful. Maybe when php5 becomes more popular we can all band together
and standardize this.
	I think such a real hierarchy of classes will never exist. That's too 
much for PHP; none of the developers want to break BC and also follow 
the KISS credo (which is good, imho).

	But it sounds interesting in re-creating the globbered global function 
table of PHP in a well thought class framework and make it 
exception-proof. But that would be a step back either if this wrapping 
would only occur in PHP side - for every PHP function there would need 
to be called a userland PHP code before. I even don't want to think 
about the performance implications. But well, since this is effectively 
what I started with with my System class, there my be needs where this 
trade off is accecptable (compensating longer execution time with caches 
and more hardware power/ram/whatever).

	I think for the current issue I will just continue recreating the PHP 
functions inside an exception-proof class if I don't find a better way. 
Only creating them on-demand isn't a real problem (at the moment).

- Markus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] XML and Excel

2004-02-10 Thread Phillip Jackson
Please post your solution to the group for reference.

~phillip

Jake McHenry [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 - Original Message - 
 From: Marek Kilimajer [EMAIL PROTECTED]
 To: Jake McHenry [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Monday, February 09, 2004 12:42 PM
 Subject: Re: [PHP] XML and Excel


  Create native xls files, there are at least two classes that can help
  you, here is one:
  http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
 
  Jake McHenry wrote:
   Hi everyone. Since my last post of outputing to excel, I have
converted
 my output to XML, quite happy with myself. It looks perfect. Perfect on my
 set that is. I have win xp with office xp. Excel with office xp recognizes
 XML. Office 2000, which the rest of my company is using, doesn't. Does
 anyone know of a way I can take the XML I have now and have office 2000
 recognize it? I feel kinda stupid... lol  Sent out an email to my
accounting
 department saying it was ready for them and all they get is garbage on
their
 screen.
  
   Anyone know of anything I can do?
  
   Thanks,
   Jake
 

 sweet.. thanks a lot.. took me about 3 hours, but I got it all converted.
 works great!

 Thanks again,
 Jake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Linked Table Structure

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 09:49, Sajid wrote:
  A way you could do this, is to set up the tables like this:
 
  DG1:
  Continent_Id | Continent_Name | Continent_Image | Continent_Text
 
  DG2: Country_Id | Continent_Id | Country_Name | Country_Image |
 Country_Text
 
  DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url
 
 Thanks for your help.
 But what i feel is that this is a more tedious process to achieve what i
 want to.
 What will happen in this is that i have to enter proper Continent ID and
 Country ID in both Country and Club tables respectively.
 For that i have to go and check that these ID's are in the other tables.
 
 I was looking for something to do with Linked Tables.
 Can anyone show me an example of how this can be done using Linked Tables?

You can write an admin interface to manage adding the rows to your
tables if you don't want to do it manually.  This seems like as close to
a linked list as you are going to get: each item in the child table has
a link (id column) to it's parent.  You reference that to find
children/parents.  This is generally the way relational databases are
structured.  Maybe if you expand on what you mean by a linked list we
can provide a different answer.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: excel output question

2004-02-10 Thread Phillip Jackson
table border=1


Jake McHenry [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 - Original Message - 
 From: Phillip Jackson [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, February 07, 2004 4:37 AM
 Subject: Re: [PHP] Re: excel output question


  I would do it like this:
 
  $build =  '%s','%s','%s','%s'\n;
  $build = sprintf($build,$field1,$field2,$field3,$fieldN);
 
  you could also try escaping the comma. if this doesn't work you can
always
  just dump to html tables and save the file as *.xls (excel spreadsheet);
  excel understands html tables and simple markup as spreadsheet data.
 
  ie:
 
  html
  table
  tr
  tdfield1/tdtdfield2/tdtdfield3/tdtdfield4/td
  /tr
  tr
  tdvalue1/tdtdvalue2/tdtdvalue3/tdtdvalue4/td
  /tr
  /table
  /html
 
 
  ~phillip
  Jake McHenry [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   - Original Message - 
   From: Paul Furman [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Saturday, February 07, 2004 1:56 AM
   Subject: [PHP] Re: excel output question
  
  
Single quote everything should work.
   
Jake McHenry wrote:
   
 Hi everyone. I'm outputing payroll information to an excel csv
file,
  and
   when anyone get's paid over 1k, the amount is split into two fields
  because
   of the comma in the amount. Is there anyway I can tell excel that this
   particular comma is not a deliminator?

 Thanks,
 Jake
   
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
   like this?
  
   output =
  
 

'$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho
  
 

urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',,
   ,,,'$sub401k
   ','$payrate','$gross5'\n;
  
   That just filled my spreadshit with quotes around everything... still
 the
   amounts larger than 1k are in 2 columns..
  
   did I do something wrong?
  
   Thanks,
   Jake
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 This is in a simple while loop, data is coming from a mysql database.
 Creating a seperate function would too time consuming changing all of the
 existing code for what this page is doing. It orignally was in html form
in
 an xls file, but when the file was opened, there were no cell borders
 anymore. If anyone can tell me how to turn on the cell boarders in an xls
 html outputted file, that would also work. This is the only reason I went
 back to a csv file.

 Thanks,
 Jake

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Linked Table Structure

2004-02-10 Thread Sajid
I am not aware of linked tables too much, is this what is called linked
table?

Do i have to enter values on both tables to link them? Or can some columns
of one table be linked with columns of another table in some other way?

If no, then thanks for all who helped me :)

--sajid

Adam Bregenzer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Tue, 2004-02-10 at 09:49, Sajid wrote:
   A way you could do this, is to set up the tables like this:
  
   DG1:
   Continent_Id | Continent_Name | Continent_Image | Continent_Text
  
   DG2: Country_Id | Continent_Id | Country_Name | Country_Image |
  Country_Text
  
   DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text |
Club_Url
 
  Thanks for your help.
  But what i feel is that this is a more tedious process to achieve what i
  want to.
  What will happen in this is that i have to enter proper Continent ID and
  Country ID in both Country and Club tables respectively.
  For that i have to go and check that these ID's are in the other tables.
 
  I was looking for something to do with Linked Tables.
  Can anyone show me an example of how this can be done using Linked
Tables?

 You can write an admin interface to manage adding the rows to your
 tables if you don't want to do it manually.  This seems like as close to
 a linked list as you are going to get: each item in the child table has
 a link (id column) to it's parent.  You reference that to find
 children/parents.  This is generally the way relational databases are
 structured.  Maybe if you expand on what you mean by a linked list we
 can provide a different answer.

 --
 Adam Bregenzer
 [EMAIL PROTECTED]
 http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] counting downloaded files

2004-02-10 Thread Marek Kilimajer
Adriaan Nel wrote:

The variables I submit, are retrieved from a database...so users can't enter
anything,
What do you mean? Even if the variables are in a hidden input field, 
anyone can change them. For example one can save the page and change 
them in html source.

I do have a warning inserted at the beginning of the file, how do I remove
this warning?
I won't tell you unless you tell what warning it is. But I'm sure if you 
think about the warning a little you will figure it out.



Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Adriaan Nel wrote:


Hi,

I am using the following piece of code, to download files, but the files
are

allways corrupt...what am I doing wrong?

if ($submit) {
$full_filename = $_POST[full_filename];
$filename = $_POST[filename];
$dir = $_POST['dir'];
$size = $_POST[size];
$id = $_POST[id];
if((file_exists($full_filename))  (substr(decoct(fileperms($dir)),-1)
=

4)) {
 header(Content-type: . application/exe);
 header(Content-Disposition:  . attachment . ;
filename=\.$filename).\;
 header(Content-Length: .$size);
 $fp = readfile($full_filename, r);
 mysql_query (INSERT INTO files_downloaded
VALUES('$id','$ip',NOW()),$db_connection) or die (mysql_error());
 return $fp;
}
}
You might have a php warning in the downloaded file, it will be either
at the beginning or at the end, just open a text editor and view it.
Also you don't check $full_filename, users can submit enything, e.g.
/etc/shadow or includes/config.php, and the script sends it.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Working with a Front Page developer

2004-02-10 Thread Chris de Vidal
I've got a design developer who only knows Front Page.  Despite my general
hatred for Microsoft I can work around it :-)

She's installed a Front Page PHP plugin (I think it's called Rocket PHP). 
However, the plugin is buggy; it's got problems that would be best fixed
if I could completely separate code from design.  Separating code from
design is a snap when using HTML forms to call PHP programs (using FORM's
ACTION= attribute), but when the code MUST to be embedded in the HTML (as
I've had to do), it's tricky.

One thought: I could use templates.  She can design a normal HTML pages
with template entries like [email_address] and [database_records] and
such. Then I could use PHP to parse those templates and replace the
template entries with real data.

Can anyone recommend some template engines?  Or tips on using PHP to parse
an HTML doc, replacing it with real data?

Any other tips?  Books/websites on this subject?

Thanks in advance!
/dev/idal

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and binding to Port as a certain user

2004-02-10 Thread Dan Aloma
I'm trying to use PHP 4.3.4 with the -b switch, which should bind a port to 
be used for parsing php files. When I do that, I want it to run as a 
different user than the one feeding it the command (webserver). Is there any 
way to do that? Thanks so much for the help.

_
Create your own personal Web page with the info you use most, at My MSN. 
http://click.atdmt.com/AVE/go/onm00200364ave/direct/01/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ereg_replace

2004-02-10 Thread Nicole Lallande
Can anyone tell me why this does not work:

$str1=ereg_replace(index.php?src=,index/,$url);

is there another way to do this?

Thanks,

Nicole

--

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Linked Table Structure

2004-02-10 Thread Paul Furman
My background is only with MS Access where everything is drag  drop. In 
that case you can link fields and they will populate automatically. If 
you have Access, it might be an easier way to set up the database, enter 
the data and then export it to MySQL or whatever.

Sajid wrote:
I am not aware of linked tables too much, is this what is called linked
table?
Do i have to enter values on both tables to link them? Or can some columns
of one table be linked with columns of another table in some other way?
If no, then thanks for all who helped me :)

--sajid

Adam Bregenzer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

You can write an admin interface to manage adding the rows to your
tables if you don't want to do it manually.  This seems like as close to
a linked list as you are going to get: each item in the child table has
a link (id column) to it's parent.  You reference that to find
children/parents.  This is generally the way relational databases are
structured.  Maybe if you expand on what you mean by a linked list we
can provide a different answer.
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ereg_replace

2004-02-10 Thread Jason Wong
On Wednesday 11 February 2004 01:55, Nicole Lallande wrote:
 Can anyone tell me why this does not work:

 $str1=ereg_replace(index.php?src=,index/,$url);

Because '.' and '?' have special meanings in a regex.

 is there another way to do this?

If it's a plain simple string replace you want then use str_replace().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The Gordian Maxim:
If a string has one end, it has another.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ODBC connection..

2004-02-10 Thread Andrew Kwiczola
Heya, I was wondering if its possible to create a odbc connection with
php, using a User DSN.. (not a system DSN)? Everytime I try to connect
with this code..

 

 

$connect = odbc_connect(userdsnhere, user, password) or
die(odbc_errormsg());;

 

I get...

 

[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified

 

Like it doesn't exist.. Im trying to connect to a datasource that has
been setup over the network as a user dsn to retrieve data, anyone have
any ideas? I can retrieve the data via an excel odbc query, but this
doesn't seem to work as expected.. can anyone help?

 

 
Andy

 

 

 




Re: [PHP] Re: Linked Table Structure

2004-02-10 Thread David T-G
Sajid --

...and then Sajid said...
% 
% Hi,

Hi!


% Thanks for your help.
% But what i feel is that this is a more tedious process to achieve what i
% want to.

Sometimes database work is :-)


% What will happen in this is that i have to enter proper Continent ID and
% Country ID in both Country and Club tables respectively.

That's true.  If you want a club to be in a particular country then
you'll have to specify what country.  How else could you do it?


% For that i have to go and check that these ID's are in the other tables.

Ahhh...  Now you're talking about 'foreign keys' in your relational
database.  This ensures that, should you change the country ID in the
country table, all of the clubs for that country will be updated.

You'll still have to enter the country ID, though, whether manually,
through a pulldown, or by matching text.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Working with a Front Page developer

2004-02-10 Thread Richard Davey
Hello Chris,

Tuesday, February 10, 2004, 5:30:14 PM, you wrote:

CdV Can anyone recommend some template engines?  Or tips on using PHP to parse
CdV an HTML doc, replacing it with real data?

One of the most common (and well used) template engines is Smarty:
http://smarty.php.net/

It might be overkill for your needs though, writing a simple template
system is pretty easy. I would have thought that even FrontRage could
handle HTML with embedded code though - from the point of view that it
knows not to display/modify it in the visual layout side of things.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace

2004-02-10 Thread Richard Davey
Hello Nicole,

Tuesday, February 10, 2004, 5:55:01 PM, you wrote:

NL Can anyone tell me why this does not work:
NL $str1=ereg_replace(index.php?src=,index/,$url);

Because it's an invalid regular expression.

NL is there another way to do this?

Yes, str_replace() for something this simple:

$str1 = str_replace(index.php?src=, index/, $url);

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML and Excel

2004-02-10 Thread Jake McHenry
I implemented the classes found at the link he provided, followed the
directions in the readme and examples

do you want me to post the code as well?

thanks,
Jake


- Original Message - 
From: Phillip Jackson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 11:35 AM
Subject: Re: [PHP] XML and Excel


 Please post your solution to the group for reference.

 ~phillip

 Jake McHenry [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  - Original Message - 
  From: Marek Kilimajer [EMAIL PROTECTED]
  To: Jake McHenry [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Monday, February 09, 2004 12:42 PM
  Subject: Re: [PHP] XML and Excel
 
 
   Create native xls files, there are at least two classes that can help
   you, here is one:
   http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
  
   Jake McHenry wrote:
Hi everyone. Since my last post of outputing to excel, I have
 converted
  my output to XML, quite happy with myself. It looks perfect. Perfect on
my
  set that is. I have win xp with office xp. Excel with office xp
recognizes
  XML. Office 2000, which the rest of my company is using, doesn't. Does
  anyone know of a way I can take the XML I have now and have office 2000
  recognize it? I feel kinda stupid... lol  Sent out an email to my
 accounting
  department saying it was ready for them and all they get is garbage on
 their
  screen.
   
Anyone know of anything I can do?
   
Thanks,
Jake
  
 
  sweet.. thanks a lot.. took me about 3 hours, but I got it all
converted.
  works great!
 
  Thanks again,
  Jake

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Samuel Ventura
Hi there,

I have 3 files in nested subdirectories

(1) /test.php
(2) /subdir1/test.php
(3) /subdir1/subdir2/test.php


(1) contains
//
?php
print hello;
?

(2) and (3) contains
/
?php
include(../test.php);
?

if I call (3) it loops forever in (2) trying to
including itself.

I expected (2) correctly included (1) by taking the
relative path referenced to its current location not
the location of (3) which is including it.

If I rename (1) as test1.php, (2) as test2.php and (3)
as test3.php, then (2) fails to find and open (1).

Is this a bug or a feature?

I didnt find any reference to this in the online
documentation.
 








__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working with a Front Page developer

2004-02-10 Thread Chris de Vidal
Richard Davey said:
 One of the most common (and well used) template engines is Smarty:
 http://smarty.php.net/

 It might be overkill for your needs though, writing a simple template
 system is pretty easy.

Looks like it's overkill, but I'll look through it in case I could use it
on other projects.

Got any tips on writing a template system?  Anything I should be aware of,
other than copious use of preg_replace?  :-)

/dev/idal

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Richard Davey
Hello Samuel,

Tuesday, February 10, 2004, 6:55:24 PM, you wrote:

SV I have 3 files in nested subdirectories

[snip]

SV Is this a bug or a feature?

Neither, it's just logic really. The include() function sucks
in the file specified, dropping out to HTML mode to do so. The
included file inherits all of the properties of the one that included
it, such as current directory location, variable scope, etc.

The include function doesn't (and cannot) know you're including more
PHP code.

In short, never mess around with ../ in a directory of an include
file, that's pretty bad structure anyway IMHO.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Working with a Front Page developer

2004-02-10 Thread Richard Davey
Hello Chris,

Tuesday, February 10, 2004, 7:19:35 PM, you wrote:

CdV Got any tips on writing a template system?  Anything I should be aware of,
CdV other than copious use of preg_replace?  :-)

You don't have to use preg_replace, in its most simplest form the
following code will work just fine for a basic template system:

/*
  Creates 2 arrays - src and dst. Src is a list of the tags to
  search for in the HTML template and Dst is an array of the values to
  replace them with. The template is then loaded into a variable, a
  quick str_replace() function is performed and the output is
  displayed with a header/footer wrapped around it.
*/

$src = array(fontcolor, body, submit, error);
$dst = array(red, $body, Submit, $formerror);

$template = fileread(your_page.html);

$page = str_replace($src, $dst, $template);

include header.php;
echo $page;
include footer.php;

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread John W. Holmes
From: Samuel Ventura [EMAIL PROTECTED]

 I have 3 files in nested subdirectories

 (1) /test.php
 (2) /subdir1/test.php
 (3) /subdir1/subdir2/test.php

 if I call (3) it loops forever in (2) trying to
 including itself.

 Is this a bug or a feature?

A feature?

You make a request for (3). The thing to remember/realize is that now all
require(), include(), etc. calls now happen relative to the path of (3). So,
when you include (2), which tries to include ../test.php, it is trying to
include itself again because the include() happens relative to the path of
(3).

include()'s are almost like a cut and paste. If you took the code from (2)
and pasted it into (3) in place of the include(), that's the end result.

This is why I do not use relative paths.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: ODBC connection..

2004-02-10 Thread Ben Ramsey
I don't know about a user DSN, but I do know it's possible to create 
an ODBC connection, using the ODBC functions.  Check out the manual:
http://us4.php.net/manual/en/ref.odbc.php



Andrew Kwiczola wrote:
Heya, I was wondering if its possible to create a odbc connection with
php, using a User DSN.. (not a system DSN)? Everytime I try to connect
with this code..
 

 

$connect = odbc_connect(userdsnhere, user, password) or
die(odbc_errormsg());;
 

I get...

 

[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
 

Like it doesn't exist.. Im trying to connect to a datasource that has
been setup over the network as a user dsn to retrieve data, anyone have
any ideas? I can retrieve the data via an excel odbc query, but this
doesn't seem to work as expected.. can anyone help?
 

 
Andy

 

 

 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] HELP: Nested include(...)'s take relative paths not int uitively

2004-02-10 Thread Alex Hogan
Are you saying that it's better not to use relative paths on include(...)'s,
require(...)'s and their (x)_once(...) cousins?

That seems awkward to me.

Why would I want to hard code a path, even if I was including additional
functionality from another file?



 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 10, 2004 1:50 PM
 To: Samuel Ventura; [EMAIL PROTECTED]
 Subject: Re: [PHP] HELP: Nested include(...)'s take relative paths not
 intuitively
 
 From: Samuel Ventura [EMAIL PROTECTED]
 
  I have 3 files in nested subdirectories
 
  (1) /test.php
  (2) /subdir1/test.php
  (3) /subdir1/subdir2/test.php
 
  if I call (3) it loops forever in (2) trying to
  including itself.
 
  Is this a bug or a feature?
 
 A feature?
 
 You make a request for (3). The thing to remember/realize is that now all
 require(), include(), etc. calls now happen relative to the path of (3).
 So,
 when you include (2), which tries to include ../test.php, it is trying to
 include itself again because the include() happens relative to the path of
 (3).
 
 include()'s are almost like a cut and paste. If you took the code from (2)
 and pasted it into (3) in place of the include(), that's the end result.
 
 This is why I do not use relative paths.
 
 ---John Holmes...
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




Re: Re[2]: [PHP] Working with a Front Page developer

2004-02-10 Thread Chris de Vidal
Richard Davey said:
 You don't have to use preg_replace, in its most simplest form the
 following code will work just fine for a basic template system:

snip

Blow me down, that's exactly what I need!  You just saved me hours of
research.  You rock!!

Thanks Rich!

/dev/idal

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread John W. Holmes
From: Alex Hogan [EMAIL PROTECTED]

 Are you saying that it's better not to use relative paths on
include(...)'s,
 require(...)'s and their (x)_once(...) cousins?

 That seems awkward to me.

 Why would I want to hard code a path, even if I was including additional
 functionality from another file?

Use whatever you're comfortable with because they both work. I'm just saying
that I stay away from relative includes, myself.

It's easy to just create a variable (or extract the data from $_SERVER) to
find out the absolute path and just use that as a variable. Then you can do
this:

include($_CONF['path'] . '/test.php');

for example. I make similar $_CONF variables for the html root of the site

$_CONF['html'] = 'http://www.bigredspark.com';

so that even the links in my html are full URLs instead of relative links.

To each his own.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHp Books

2004-02-10 Thread Rajani Anand Iyer
Hi All,
 
Can someone recommend some good books on PHP Advanced topics. 
 
Regards
Rai


-
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

[PHP] Simple PHP Encoder

2004-02-10 Thread Don Myers
Howdy, I am looking for a simple way to encode my PHP files from snooping
eyes. Not a MD5 Encryption or anything but a simple base64 or something. I
want to scare off the casual server snooper that know very little about PHP
but has access to the web directory for other reasons.

D Myers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace -- Thanks!

2004-02-10 Thread Nicole Lallande
Many thanks!!

Richard Davey wrote:

Hello Nicole,

Tuesday, February 10, 2004, 5:55:01 PM, you wrote:

NL Can anyone tell me why this does not work:
NL $str1=ereg_replace(index.php?src=,index/,$url);
Because it's an invalid regular expression.

NL is there another way to do this?

Yes, str_replace() for something this simple:

$str1 = str_replace(index.php?src=, index/, $url);

 

--

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Simple PHP Encoder

2004-02-10 Thread Ben Ramsey
There's the Zend Encoder, which is fairly expensive.  However, I suppose 
you could use the base64_encode function to do what you want: 
http://us2.php.net/manual/en/function.base64-encode.php.  My idea is 
that you could create a script that would read in your PHP scripts using 
the filesystem functions.  Then, it would encode the data it reads in 
and write it back to the PHP script.  The PHP script, however, wouldn't 
execute, but it would be protected from prying eyes.  Then, you would 
create a script that would read that file back in and decode it so you 
could work on it.  I guess this is what you want.

Don Myers wrote:
Howdy, I am looking for a simple way to encode my PHP files from snooping
eyes. Not a MD5 Encryption or anything but a simple base64 or something. I
want to scare off the casual server snooper that know very little about PHP
but has access to the web directory for other reasons.
D Myers
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Simple PHP Encoder

2004-02-10 Thread =d0Mi=

| From: Ben Ramsey [EMAIL PROTECTED]
|
| There's the Zend Encoder, which is fairly expensive.  However, I suppose 
| you could use the base64_encode function to do what you want: 
| http://us2.php.net/manual/en/function.base64-encode.php.  My idea is 
| that you could create a script that would read in your PHP scripts using 
| the filesystem functions.  Then, it would encode the data it reads in 
| and write it back to the PHP script.  The PHP script, however, wouldn't 
| execute, but it would be protected from prying eyes.  Then, you would 
| create a script that would read that file back in and decode it so you 
| could work on it.  I guess this is what you want.
| 
| 
| Don Myers wrote:
|  Howdy, I am looking for a simple way to encode my PHP files from snooping
|  eyes. Not a MD5 Encryption or anything but a simple base64 or something. I
|  want to scare off the casual server snooper that know very little about PHP
|  but has access to the web directory for other reasons.
|  
|  D Myers
| 
| -- 
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
| 

Waste of time

1) A person with access to Your webroot WITHOUT PHP skills ?
  - who could that person be, server administrator?
i hope he's pretty familiar with PHP, otherwise he would't
have access.
2) Anyway, if the person has actually knows very little about
   PHP, then your files looks very crypted for him already.
3) There is no simple solution... too much effort for so little.
   and besides, if The Person is root, he is most likely able to
   see your files anyway !!
4) If you think that the person could be someone else than root
   move your pages to another webspace provider

=d0Mi=

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Having trouble recompiling PHP

2004-02-10 Thread Matthew Rossiter
Hi there, I'm running RedHat 9.0 /Apache 2.0.48/openssl-0.9.7c/php-4.3.4

Every time I recompile PHP nothing seems to change according to phpinfo().
I'm trying to add SSL and FTP functionality.  The funny thing is, every time
it is recompiled the messages indicate the install worked properly.  What's
the best way to recompile php if I want to add functionality?

I did './configure --enable-ftp --with-openssl'


Matt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Having trouble recompiling PHP

2004-02-10 Thread John Nichel
Matthew Rossiter wrote:
Hi there, I'm running RedHat 9.0 /Apache 2.0.48/openssl-0.9.7c/php-4.3.4

Every time I recompile PHP nothing seems to change according to phpinfo().
I'm trying to add SSL and FTP functionality.  The funny thing is, every time
it is recompiled the messages indicate the install worked properly.  What's
the best way to recompile php if I want to add functionality?
I did './configure --enable-ftp --with-openssl'

Matt

First things first.  Did you restart apache?

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not int uitively

2004-02-10 Thread Richard Davey
Hello Alex,

Tuesday, February 10, 2004, 8:08:11 PM, you wrote:

AH Are you saying that it's better not to use relative paths on include(...)'s,
AH require(...)'s and their (x)_once(...) cousins?

Relative paths are fine, so long as you have strict control over what
is calling the script and from where. They're not particularly good
coding practise though given the way PHP works.

AH Why would I want to hard code a path, even if I was including additional
AH functionality from another file?

Because if you're including it all over the place from any number of
scripts in any number of locations - the relative directory is always
going to change.

Why not just set a $basedir value somewhere and always use that in an
include/require function: include $basedir/sub/whatever - then no
matter where it's called from it'll never be wrong.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[4]: [PHP] Working with a Front Page developer

2004-02-10 Thread Richard Davey
Hello Chris,

Tuesday, February 10, 2004, 8:09:36 PM, you wrote:

CdV Blow me down, that's exactly what I need!  You just saved me hours of
CdV research.  You rock!!

No worries, glad to help :)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Richard Davey
Hello John,

Tuesday, February 10, 2004, 8:20:50 PM, you wrote:

JWH include($_CONF['path'] . '/test.php');

This is slightly off-topic, but related to the include() function.
What is the given standard regarding when you should or shouldn't
use braces on a function.

For example:

include $dir/file.php

vs.

include($dir/file.php)

Both work just fine. The manual includes examples of both methods. So
which do most people consider the right way ?

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Re: Simple PHP Encoder

2004-02-10 Thread Richard Davey
Hello =d0Mi=,

Tuesday, February 10, 2004, 10:08:06 PM, you wrote:

d 4) If you think that the person could be someone else than root
dmove your pages to another webspace provider

I disagree; you'd be surprised just how many hosts configure public
level access to files inside of web directories on shared servers. I
would gauge there must be thousands and thousands of servers set up
like this.

Even well respected hosts like Pair Networks do this. There is a very
definite need for either script encoding or the education of everyone
to tighten up access to their files.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[4]: [PHP] Re: Simple PHP Encoder

2004-02-10 Thread Richard Davey
Hello Philip,

Wednesday, February 11, 2004, 12:19:07 AM, you wrote:

PJN I never saw any of the other messages, but why not just
PJN place an index file with nothing in it into
PJN the dir you don't want people to view.  Thats what i do. 
PJN (if i got the right end of the stick).

Wrong end of stick :)

The problem wasn't people viewing your PHP code via the web (which any
correctly configured web server should protect against) - it was
people on the same server as you (i.e. a shared server environment)
being able to telnet/ssh in and more (view) PHP files in your web
directory.

This is far more common than you'd think :)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Martin Towell
 Hello John,
 
 Tuesday, February 10, 2004, 8:20:50 PM, you wrote:
 
 JWH include($_CONF['path'] . '/test.php');
 
 This is slightly off-topic, but related to the include() function.
 What is the given standard regarding when you should or shouldn't
 use braces on a function.
 
 For example:
 
 include $dir/file.php
 
 vs.
 
 include($dir/file.php)
 
 Both work just fine. The manual includes examples of both methods. So
 which do most people consider the right way ?

This is one of those personal preference things. Pick which ever way you
like the best and stick with it.

Martin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 19:06, Richard Davey wrote:
 This is slightly off-topic, but related to the include() function.
 What is the given standard regarding when you should or shouldn't
 use braces on a function.

[snip]

 Both work just fine. The manual includes examples of both methods. So
 which do most people consider the right way ?

I always use parens on function calls, I think it is more readable. 
Also, some syntax highlighters look for it.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread John W. Holmes
Richard Davey wrote:
include $dir/file.php

vs.

include($dir/file.php)

Both work just fine. The manual includes examples of both methods. So
which do most people consider the right way ?
If you use echo, then you should use include().
If you use print, then you should use include  .
Unless you use echo(), then you should use include 
and if you use print  , then you should use include().
Unless you don't want to. :)
Like someone else said: Personal preference. There's no right or wrong.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HELP: Nested include(...)'s take relative paths

2004-02-10 Thread André Cerqueira
If it was a function, parenteses would be mandatory hehe
I prefer no parentheses on include/require/echo/print/..., cant justify 
it with arguments though, its just the style i chose...

What about:
 if (...) {
   ...
 }
and:
 if (...)
 {
   ...
 }
I prefer the second, but people find good reasons for each of them...



Adam Bregenzer wrote:

On Tue, 2004-02-10 at 19:06, Richard Davey wrote:

This is slightly off-topic, but related to the include() function.
What is the given standard regarding when you should or shouldn't
use braces on a function.


[snip]


Both work just fine. The manual includes examples of both methods. So
which do most people consider the right way ?


I always use parens on function calls, I think it is more readable. 
Also, some syntax highlighters look for it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HELP: Nested include(...)'s take relative paths

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 21:00, André Cerqueira wrote:
 If it was a function, parenteses would be mandatory hehe
 I prefer no parentheses on include/require/echo/print/..., cant justify 
 it with arguments though, its just the style i chose...
 
 What about:
   if (...) {
 ...
   }
 and:
   if (...)
   {
 ...
   }
 
 I prefer the second, but people find good reasons for each of them...

I'm anal about code formatting.  I always use parens with no space
before a function call, put a space before parens for builtin words (if,
while, etc), don't indent case phrases, move multiple arguments that go
over 80 characters to their own lines, and always use the former of the
above methods.  Of course, if I am modifying someone else's code I
*always* use the coding standards already in place.  The most important
thing is to be consistent.  Everybody has their own preference about how
using different coding styles increases or decreases readability, 
however I think what really improves readability is commenting, not
coding style.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Adam Bregenzer
On Wed, 2004-02-11 at 19:36, John W. Holmes wrote:
 If you use echo, then you should use include().
 If you use print, then you should use include  .
 Unless you use echo(), then you should use include 
 and if you use print  , then you should use include().
 Unless you don't want to. :)

Heh, what if I use print('')? :P

Actually, I use echo(''), even though using single quotes doesn't give
me better performance I like to separate my strings and variables.

I enjoy using echo, it's like a rebellion against printf.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [Q] Problems invoking a PHP script - Have no hair left to pull - Please help [:-)

2004-02-10 Thread Michael T. Peterson
I have a registration form which collects some data then, when the user
clicks the submit button sends the data to a second page (a PHP script).
The problem I'm having is getting my webserver (apache) to invoke the PHP
scrip to process the data. What's so baffling about this is that I've
already written another, similar facility ( a login form which sends user
supplied info to php script for authentication).  The login app works great.
The registration app doesn't even tho' the registration app is semantically
and syntactally identical to the login app.

I think what's happening is I'm missing something really simple.  Does
anyone have any suggestions as to what I need to be looking for?  I've been
at this for about 5 hours now and am going crazy looking at this [very
simple] code.

Finally, in my php.ini file display_errors is set to ON (But no errors are
displayed or written to error log).

Here's the form code fragment in the file member_registration_form.html:
...
form name=member_registration_form method=post
action=register_new_member.php
...

And here's the preamble and the PHP block in the file,
register_new_member.php:

html
head
titleNew member registration/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
hr
h1Registration Results/h1
hr

?php
print( Hello world.);//  This doesn't get
executed.
?
/body
/html

Again, no are any errors displayed or logged.  Any help would be greatly
appreciated.

Cheers,

Michael

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SQL help

2004-02-10 Thread Marc Greenstock
Hi all here's my problem,

I have two tables: 'user_data' and 'image_data'

obviously user_data has all the user information and image_data has all the
image information

in image_data are the fields: Image_ID int(11), User_ID int(11) and
Default_Img enum('Yes','No'). Users can have as many images as they like,
but it is optional.

I want to select from user_data and image_data and get the results based
upon the rest of the query. The problem is my sql is only pulling out the
users with images and ignoring the rest

my sql looks like this:

SELECT * FROM user_data, image_data
WHERE user_data.User_ID = image_data.User_ID
AND image_data.Default_Img = 'Yes'
GROUP BY user_data.User_ID

thanks for your help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] [Q] Problems invoking a PHP script - Have no hair left to pull - Please help [:-)

2004-02-10 Thread Larry Brown
is the html code you have listed below the file register_new_member.php?
Is it in the same directory as the previously successful script?

-Original Message-
From: news [mailto:[EMAIL PROTECTED] Behalf Of Michael T. Peterson
Sent: Tuesday, February 10, 2004 9:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] [Q] Problems invoking a PHP script - Have no hair left to
pull - Please help [:-)


I have a registration form which collects some data then, when the user
clicks the submit button sends the data to a second page (a PHP script).
The problem I'm having is getting my webserver (apache) to invoke the PHP
scrip to process the data. What's so baffling about this is that I've
already written another, similar facility ( a login form which sends user
supplied info to php script for authentication).  The login app works great.
The registration app doesn't even tho' the registration app is semantically
and syntactally identical to the login app.

I think what's happening is I'm missing something really simple.  Does
anyone have any suggestions as to what I need to be looking for?  I've been
at this for about 5 hours now and am going crazy looking at this [very
simple] code.

Finally, in my php.ini file display_errors is set to ON (But no errors are
displayed or written to error log).

Here's the form code fragment in the file member_registration_form.html:
...
form name=member_registration_form method=post
action=register_new_member.php
...

And here's the preamble and the PHP block in the file,
register_new_member.php:

html
head
titleNew member registration/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
hr
h1Registration Results/h1
hr

?php
print( Hello world.);//  This doesn't get
executed.
?
/body
/html

Again, no are any errors displayed or logged.  Any help would be greatly
appreciated.

Cheers,

Michael

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] SQL help

2004-02-10 Thread Martin Towell
You'll need to do a left/right outer join.

as you didn't say which database you're using, I'll give this back to you to
do some reading up on how to do it...

HTH
Martin


 -Original Message-
 From: Marc Greenstock [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 11 February 2004 1:53 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] SQL help
 
 
 Hi all here's my problem,
 
 I have two tables: 'user_data' and 'image_data'
 
 obviously user_data has all the user information and 
 image_data has all the
 image information
 
 in image_data are the fields: Image_ID int(11), User_ID int(11) and
 Default_Img enum('Yes','No'). Users can have as many images 
 as they like,
 but it is optional.
 
 I want to select from user_data and image_data and get the 
 results based
 upon the rest of the query. The problem is my sql is only 
 pulling out the
 users with images and ignoring the rest
 
 my sql looks like this:
 
 SELECT * FROM user_data, image_data
 WHERE user_data.User_ID = image_data.User_ID
 AND image_data.Default_Img = 'Yes'
 GROUP BY user_data.User_ID
 
 thanks for your help.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] SQL help

2004-02-10 Thread Vail, Warren
The problem is you are using a hard join which will only return rows where
there are matching entries in both tables.  What you probably want is called
a left join, however you have a further complication.

You have to have an image row to have a image_data.Default_Img = 'Yes'.  So
this query is really designed to only return users who have default images
established (other images don't count either).  

Haven't tested this, but it reflects my understanding of your expectation
(haven't double checked syntax either, but you can at
http://www.mysql.com/doc/en/index.html);

SELECT * FROM user_data
left join image_data
on user_data.User_ID = image_data.User_ID
where image_data.Default_Img in ('Yes', '')
GROUP BY user_data.User_ID

hope this works for you, good luck,

Warren Vail


-Original Message-
From: Marc Greenstock [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 6:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL help


Hi all here's my problem,

I have two tables: 'user_data' and 'image_data'

obviously user_data has all the user information and image_data has all the
image information

in image_data are the fields: Image_ID int(11), User_ID int(11) and
Default_Img enum('Yes','No'). Users can have as many images as they like,
but it is optional.

I want to select from user_data and image_data and get the results based
upon the rest of the query. The problem is my sql is only pulling out the
users with images and ignoring the rest

my sql looks like this:

SELECT * FROM user_data, image_data
WHERE user_data.User_ID = image_data.User_ID
AND image_data.Default_Img = 'Yes'
GROUP BY user_data.User_ID

thanks for your help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SQL help

2004-02-10 Thread Marc Greenstock
The DB is MySQL 4.0.16,

all tables are MyISAM


Martin Towell [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You'll need to do a left/right outer join.

 as you didn't say which database you're using, I'll give this back to you
to
 do some reading up on how to do it...

 HTH
 Martin


  -Original Message-
  From: Marc Greenstock [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, 11 February 2004 1:53 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] SQL help
 
 
  Hi all here's my problem,
 
  I have two tables: 'user_data' and 'image_data'
 
  obviously user_data has all the user information and
  image_data has all the
  image information
 
  in image_data are the fields: Image_ID int(11), User_ID int(11) and
  Default_Img enum('Yes','No'). Users can have as many images
  as they like,
  but it is optional.
 
  I want to select from user_data and image_data and get the
  results based
  upon the rest of the query. The problem is my sql is only
  pulling out the
  users with images and ignoring the rest
 
  my sql looks like this:
 
  SELECT * FROM user_data, image_data
  WHERE user_data.User_ID = image_data.User_ID
  AND image_data.Default_Img = 'Yes'
  GROUP BY user_data.User_ID
 
  thanks for your help.
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] SQL help

2004-02-10 Thread Larry Brown
Correct me if I'm wrong...PLEASE.. but, I believe you are looking for...

SELECT * FROM user_data left join image_data on
user_data.User_ID=image_data.User_ID where image_data.Default_Img = 'Yes'
GROUP BY user_data.User_ID

I haven't used enum('Yes','No') so I'm taking your word for the fact that
you are restricting your selection to values of 'Yes' works as anticipated.
As long as there is a one to one relationship on user id I believe the left
join works for this.

Larry

-Original Message-
From: Marc Greenstock [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 9:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL help


Hi all here's my problem,

I have two tables: 'user_data' and 'image_data'

obviously user_data has all the user information and image_data has all the
image information

in image_data are the fields: Image_ID int(11), User_ID int(11) and
Default_Img enum('Yes','No'). Users can have as many images as they like,
but it is optional.

I want to select from user_data and image_data and get the results based
upon the rest of the query. The problem is my sql is only pulling out the
users with images and ignoring the rest

my sql looks like this:

SELECT * FROM user_data, image_data
WHERE user_data.User_ID = image_data.User_ID
AND image_data.Default_Img = 'Yes'
GROUP BY user_data.User_ID

thanks for your help.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SQL help

2004-02-10 Thread Marc Greenstock
That works well,

Thanks all.


Warren Vail [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The problem is you are using a hard join which will only return rows where
 there are matching entries in both tables.  What you probably want is
called
 a left join, however you have a further complication.

 You have to have an image row to have a image_data.Default_Img = 'Yes'.
So
 this query is really designed to only return users who have default images
 established (other images don't count either).

 Haven't tested this, but it reflects my understanding of your expectation
 (haven't double checked syntax either, but you can at
 http://www.mysql.com/doc/en/index.html);

 SELECT * FROM user_data
 left join image_data
 on user_data.User_ID = image_data.User_ID
 where image_data.Default_Img in ('Yes', '')
 GROUP BY user_data.User_ID

 hope this works for you, good luck,

 Warren Vail


 -Original Message-
 From: Marc Greenstock [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 10, 2004 6:53 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] SQL help


 Hi all here's my problem,

 I have two tables: 'user_data' and 'image_data'

 obviously user_data has all the user information and image_data has all
the
 image information

 in image_data are the fields: Image_ID int(11), User_ID int(11) and
 Default_Img enum('Yes','No'). Users can have as many images as they like,
 but it is optional.

 I want to select from user_data and image_data and get the results based
 upon the rest of the query. The problem is my sql is only pulling out the
 users with images and ignoring the rest

 my sql looks like this:

 SELECT * FROM user_data, image_data
 WHERE user_data.User_ID = image_data.User_ID
 AND image_data.Default_Img = 'Yes'
 GROUP BY user_data.User_ID

 thanks for your help.

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] phpMyAdmin Problems

2004-02-10 Thread Freedomware
I've been using both phpMyAdmin and EMS MySQL Manager to work with MySQL 
tables and PHP. Things are generally going OK, but I'm still ironing out 
a few kinks. I suspect some of my problems might be related to an error 
message I get when I click on a Database in phpMyAdmin:

Error: The additional Features for working with linked Tables have been 
deactivated. To find out why click here.

When I click the link, I get a page that lists six different problems, 
each linked to a pretty complex solution in the phpMyAdmin Manual. Does 
anyone here know if there's an easier solution? Would fixing one or two 
key problems automatically fix the others? Can you download files that 
have already been fixed, add your username and password and paste them 
into the proper folders?

I put a couple screenshots that illustrate what I described online at
http://geowebworks.geobop.org/test/phpmyadmin/index.php
Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] phpMyAdmin Problems

2004-02-10 Thread Raditha Dissanayake
Hi,
perhaps this is best posted on the phpmyadmin list?
Freedomware wrote:

I've been using both phpMyAdmin and EMS MySQL Manager to work with 
MySQL tables and PHP. Things are generally going OK, but I'm still 
ironing out a few kinks. I suspect some of my problems might be 
related to an error message I get when I click on a Database in 
phpMyAdmin:

Error: The additional Features for working with linked Tables have 
been deactivated. To find out why click here.

When I click the link, I get a page that lists six different problems, 
each linked to a pretty complex solution in the phpMyAdmin Manual. 
Does anyone here know if there's an easier solution? Would fixing one 
or two key problems automatically fix the others? Can you download 
files that have already been fixed, add your username and password 
and paste them into the proper folders?

I put a couple screenshots that illustrate what I described online at
http://geowebworks.geobop.org/test/phpmyadmin/index.php
Thanks.



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] phpMyAdmin Problems

2004-02-10 Thread Jason Wong
On Wednesday 11 February 2004 12:47, Freedomware wrote:
 I've been using both phpMyAdmin and EMS MySQL Manager to work with MySQL
 tables and PHP. Things are generally going OK, but I'm still ironing out
 a few kinks. I suspect some of my problems might be related to an error
 message I get when I click on a Database in phpMyAdmin:

[snip]

This has nothing to do with PHP. Please ask on the relevant list/forum.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It's fabulous!  We haven't seen anything like it in the last half an hour!
-- Macy's
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML and Excel

2004-02-10 Thread Jake McHenry
- Original Message - 
From: Phillip Jackson [EMAIL PROTECTED]
To: Jake McHenry [EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 4:53 PM
Subject: Re: [PHP] XML and Excel


 sure; if it doesn't compromise security for you.


 ~Phillip


 - Original Message - 
 From: Jake McHenry [EMAIL PROTECTED]
 To: Phillip Jackson [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, February 10, 2004 1:45 PM
 Subject: Re: [PHP] XML and Excel


  I implemented the classes found at the link he provided, followed the
  directions in the readme and examples
 
  do you want me to post the code as well?
 
  thanks,
  Jake
 
 
  - Original Message - 
  From: Phillip Jackson [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, February 10, 2004 11:35 AM
  Subject: Re: [PHP] XML and Excel
 
 
   Please post your solution to the group for reference.
  
   ~phillip
  
   Jake McHenry [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
- Original Message - 
From: Marek Kilimajer [EMAIL PROTECTED]
To: Jake McHenry [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, February 09, 2004 12:42 PM
Subject: Re: [PHP] XML and Excel
   
   
 Create native xls files, there are at least two classes that can
 help
 you, here is one:

http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/

 Jake McHenry wrote:
  Hi everyone. Since my last post of outputing to excel, I have
   converted
my output to XML, quite happy with myself. It looks perfect. Perfect
 on
  my
set that is. I have win xp with office xp. Excel with office xp
  recognizes
XML. Office 2000, which the rest of my company is using, doesn't.
Does
anyone know of a way I can take the XML I have now and have office
 2000
recognize it? I feel kinda stupid... lol  Sent out an email to my
   accounting
department saying it was ready for them and all they get is garbage
on
   their
screen.
 
  Anyone know of anything I can do?
 
  Thanks,
  Jake

   
sweet.. thanks a lot.. took me about 3 hours, but I got it all
  converted.
works great!
   
Thanks again,
Jake
  
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 



Here's the basics... I have some while loops in there too.. where the index
variable is used.. but this is what was added for the excel output.

Jake






require_once /var/www/excel/class.writeexcel_workbook.inc.php;
require_once /var/www/excel/class.writeexcel_worksheet.inc.php;

$fname = tempnam(/tmp, timesheet.xls);
$workbook = new writeexcel_workbook($fname);
$worksheet = $workbook-addworksheet();

// header format
$header = $workbook-addformat();
$header-set_bold();
$header-set_underline();
$header-set_align('center');

// notes format
$notes = $workbook-addformat();
$notes-set_bold();

// dollar format
$dollar = $workbook-addformat();
$dollar-set_align('right');
$dollar-set_num_format('$ ###,##0.00');

// number format
$number = $workbook-addformat();
$number-set_align('left');
$number-set_num_format('###,##0.00');

$worksheet-set_column(0, 0, 20);
$worksheet-set_column(1, 1, 20);
$worksheet-set_column(2, 2, 8);
$worksheet-set_column(3, 3, 8);
$worksheet-set_column(4, 4, 8);
$worksheet-set_column(5, 5, 8);
$worksheet-set_column(6, 6, 8);
$worksheet-set_column(7, 7, 8);
$worksheet-set_column(8, 8, 8);
$worksheet-set_column(9, 9, 8);
$worksheet-set_column(10, 10, 5);
$worksheet-set_column(11, 11, 7);
$worksheet-set_column(12, 12, 7);
$worksheet-set_column(13, 13, 7);
$worksheet-set_column(14, 14, 7);
$worksheet-set_column(15, 15, 5);
$worksheet-set_column(16, 16, 8);
$worksheet-set_column(17, 17, 10);

$worksheet-write(0, 0,  NAME, $header);
$worksheet-write(0, 1,  LOCATION, $header);
$worksheet-write(0, 2,  REG, $header);
$worksheet-write(0, 3,  VAC, $header);
$worksheet-write(0, 4,  SICK, $header);
$worksheet-write(0, 5,  COMP, $header);
$worksheet-write(0, 6,  MISC, $header);
$worksheet-write(0, 7,  W/O PAY, $header);
$worksheet-write(0, 8,  SEM/FAM, $header);
$worksheet-write(0, 9,  TOTAL, $header);
$worksheet-write(0, 10, ADJ, $header);
$worksheet-write(0, 11, BONUS, $header);
$worksheet-write(0, 12, POST, $header);
$worksheet-write(0, 13, EMP. A/R, $header);
$worksheet-write(0, 14, PRE, $header);
$worksheet-write(0, 15, 401K, $header);
$worksheet-write(0, 16, RATE, $header);
$worksheet-write(0, 17, GROSS, $header);

  $worksheet-write($index, 0,  $fullname);
  $worksheet-write($index, 1,  $location);
  $worksheet-write($index, 2,  $regularhours);
  $worksheet-write($index, 3,  $vachours);
  $worksheet-write($index, 4,  $sickhours);
  $worksheet-write($index, 5,  $comphours);
  

[PHP] Re: Simple PHP Encoder

2004-02-10 Thread Nadim Attari
http://turck-mmcache.sourceforge.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] array data

2004-02-10 Thread Imran Asghar
Hi,
 
Is not working, is it correct way

File1.php
   ? $colors = array('red','blue','green','yellow'); ?
   form action=file2.php method=post
  input type=hidden type name=colors value=?=$colors?
  /fomr 

File2.php
 
? 
 echo $colors[0];
 echo $colors[1];
 echo $colors[2];
 echo $colors[4];
?



imee


RE: [PHP] Re: Simple PHP Encoder

2004-02-10 Thread Adrian Teasdale
There are various:

www.sourceguardian.com
www.zend.com
www.ioncube.com

The turck-mmcache one is good too and it also comes with (or the main
purpose is) an accelerator

Ade

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Missing mysql_real_escape_string() function in PHP 4.3.4

2004-02-10 Thread Radi Shourbaji
I'm trying to move a PHP application that was originally built on the
windows PHP implementation to a newly installed Fedora FC1 Linux system.
However the Fedora implementation of PHP 4.3.4 seems to be missing the
mysql_real_escape_string() function.  I suspect that there might be other
mysql functions missing as well - so I would appreciate your advice on how
to get this new system up to speed with all of the latest PHP 4.3.x
extensions. 

Thanks!

 
(this signature is in HTML format)
uuu
R a d iS h o u r b a j i 
Product Management w Project Management w Software Marketing

 http://www.radi-shourbaji.blogspot.com/ ResumeBlogT |
mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] | (408) 441-7234

 

 


RE: [PHP] Missing mysql_real_escape_string() function in PHP 4.3.4

2004-02-10 Thread Jay Blanchard
[snip]
I'm trying to move a PHP application that was originally built on the
windows PHP implementation to a newly installed Fedora FC1 Linux system.
However the Fedora implementation of PHP 4.3.4 seems to be missing the
mysql_real_escape_string() function.  I suspect that there might be
other
mysql functions missing as well - so I would appreciate your advice on
how
to get this new system up to speed with all of the latest PHP 4.3.x
extensions. 
[/snip]

Here are all of the available mysql functions, each has its version
listed on the appropropriate page.

http://us4.php.net/manual/en/ref.mysql.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php