Re: [PHP] Dettach problem

2006-06-14 Thread grape

Hello,

Jochem Maas skrev:


pure guess work coming up...

grape wrote:
 


Hi all,

I would like run a php-script via CLI which outputs some information to
stdout, and then go into background. I use code similar to this to fork
and to dettach the child I/O from the TTY (some error handling removed
to improve readability)

   



what happens if you move the fclose() statements after this
if() statement?
 


I get the same result.
In fact, I tried a *lot* of variations of this code without success.


is STDIN et al actually defined? they should be - but we all
theory and practice often live on different planets :-)
 


That is very true :-) Yup, the're "resource(1) of type (stream)" alright.


are you using the same sapi in both version (i.e. are you maybe using
CGI now iso CLI?)
 


I'm using CLI in both environments.

 


echo "This message should NOT go to stdout of parent process\n";
?>

It works fine using PHP version 5.0.4, but when using PHP version 5.1.2
the output of the child ("This message") goes to stdout of the
parent process. So if I do:

php test.php >output

Using PHP 5.1.2, the file contains:

---
Hello from parent
This message should NOT go to stdout of parent process
---

Can anybody explain this?
I run FreeBSD 6.0-RELEASE...

Regards,

Grape

   


/Grape

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



Re: [PHP] Dettach problem

2006-06-14 Thread Jochem Maas
grape wrote:
> Hello,
> 

...

>>  
>>
> I get the same result.
> In fact, I tried a *lot* of variations of this code without success.

good man, sorry to hear your not finding the problem - seems to look more
like a bug - maybe post some more detailed code? (or does the problem occur
with the actual code you sent previously?)

> 
>> is STDIN et al actually defined? they should be - but we all
>> theory and practice often live on different planets :-)
>>  
>>
> That is very true :-) Yup, the're "resource(1) of type (stream)" alright.
> 
>> are you using the same sapi in both version (i.e. are you maybe using
>> CGI now iso CLI?)
>>  
>>
> I'm using CLI in both environments.
> 

sorry I couldn't be of any help

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



Re: [PHP] Dettach problem

2006-06-14 Thread grape

Hello Richard,

Richard Lynch skrev:



This seems to me like a cogent bug report...
http://bugs.php.net/
 


Yup, I'll report it if we cannot find a explaination in a couple of days.


But what does the posix_setsid() bit do?  Seems like you could take
that out too, no?...  Or does that "promote" the process to "be" the
parent somehow?...  Thereby confusing "fork" into thinking that it's
not the child process in some twisted weird way?  I read the docs ;
But comprehension is not implied. :-)
 

The documentation on posix_setsid() is a bit sparse on php.net, but the 
manpage for setsid on my FreeBSD system gives:


DESCRIPTION
The setsid() system call creates a new session.  The calling process is
the session leader of the new session, is the process group leader of a
new process group and has no controlling terminal.  The calling process
is the only process in either the session or the process group.

I found a post on the net describing how to run a PHP-script as a 
daemon, and the author used posix_setsid() for it to work. Actually, the 
posix_setsid() isn't really required to disconnect the childs I/O using 
PHP 5.0.4, I can just do:




This is was I originally had in my code, but after moving to 5.1.2 I 
started to experiment... :-)


A while ago, I discovered that PHP 4.3.10-2 (cli) on a Debian Linux with 
2.4.27 kernel "misbehaves" as well, using posix_setsid() or not. I see 
the output of the last echo command on stdout of the parent process 
there also.


The plot thickens!

/Grape

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



Re: [PHP] php->html "rendering"

2006-06-14 Thread Jochem Maas
Richard Lynch wrote:
> On Mon, June 12, 2006 4:49 pm, Jochem Maas wrote:
>> Ryan A wrote:
>>> Thanks for the suggestion, I am not too familier with
>>> wget but (correct me if i am wrong) wont wget just get
>>> the output from the pages ignoreing the links?
>> that's the default behaviour - but wget has about a zillion
>> parameters for controlling its behaviour, it's quite easy to scrap
>> a complete site in one call and change the file extension of
>> all files as you go (including the relevant links in the files
>> that are downloaded).
>>
>> that said it could take a week to figure out all the
>> parameters. ;-)
> 
> True -- even more than a week, for some of us. :-)

well I guessed a week - I never actually got past day three ;-)

> 
> However I'm pretty sure ONE of the examples right in the man page for
> wget covers exactly what he wants. :-)

ditto.

> 

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



[PHP] Problem with the passthru function

2006-06-14 Thread Venkatesh Babu
Hello All,

I have a small php file (test.php) whose code is shown
below:



This test.php works fine when I execute from command
prompt as "php test.php", but when I access it through
web browser, it seems not to be working fine, I get an
exit status of 127 (which means command not found). I
checked for permissions of ls, gave full path, but
still it is failing.

Can anybody help me in indentifying what is the
potential problem?

Thank you,
Venkatesh

ps: Sorry if this is the wrong mailing list. I have
subscribed to this list, so posting here.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] PHP6 build help

2006-06-14 Thread Rabin Vincent

On 6/14/06, Rory Browne <[EMAIL PROTECTED]> wrote:

Only if (s)he''s on a debian based linux distro.

I see from his configure output, that he's on Linux, but what makes you
think he's on  Debian ( or on a system with apt-rpm ) ?


The first line of Ligaya's email said: "Ubuntu Breezy Badger,
AMD 64". That's a Debian-based distro.

Rabin

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



Re: [PHP] Dettach problem

2006-06-14 Thread Jochem Maas
grape wrote:
> Hello Richard,
> 
> Richard Lynch skrev:
> 
>>
>> This seems to me like a cogent bug report...
>> http://bugs.php.net/
>>  
>>
> Yup, I'll report it if we cannot find a explaination in a couple of days.

as a last resort you might as on internals@lists.php.net as to whether
anyone there considers this a possible bug.

> 
>> But what does the posix_setsid() bit do?  Seems like you could take
>> that out too, no?...  Or does that "promote" the process to "be" the
>> parent somehow?...  Thereby confusing "fork" into thinking that it's
>> not the child process in some twisted weird way?  I read the docs ;
>> But comprehension is not implied. :-)
>>  
>>
> The documentation on posix_setsid() is a bit sparse on php.net, but the
> manpage for setsid on my FreeBSD system gives:
> 
> DESCRIPTION
> The setsid() system call creates a new session.  The calling process is
> the session leader of the new session, is the process group leader of a
> new process group and has no controlling terminal.  The calling process
> is the only process in either the session or the process group.
> 
> I found a post on the net describing how to run a PHP-script as a
> daemon, and the author used posix_setsid() for it to work. Actually, the
> posix_setsid() isn't really required to disconnect the childs I/O using
> PHP 5.0.4, I can just do:
> 
>  echo "Hello from parent\n";
> 
> if(pcntl_fork()) {
>   exit;
> }
> 
> fclose( STDIN );
> fclose( STDOUT );
> fclose( STDERR );
> 
> echo "This message should not go to stdout\n";
> ?>
> 
> This is was I originally had in my code, but after moving to 5.1.2 I
> started to experiment... :-)
> 
> A while ago, I discovered that PHP 4.3.10-2 (cli) on a Debian Linux with
> 2.4.27 kernel "misbehaves" as well, using posix_setsid() or not. I see
> the output of the last echo command on stdout of the parent process
> there also.
> 
> The plot thickens!
> 
> /Grape
> 

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



Re: [PHP] Problem with the passthru function

2006-06-14 Thread Rabin Vincent

On 6/14/06, Venkatesh Babu <[EMAIL PROTECTED]> wrote:

I have a small php file (test.php) whose code is shown
below:



This test.php works fine when I execute from command
prompt as "php test.php", but when I access it through
web browser, it seems not to be working fine, I get an
exit status of 127 (which means command not found). I
checked for permissions of ls, gave full path, but
still it is failing.

Can anybody help me in indentifying what is the
potential problem?


Check if safe_mode is on in your php.ini. Turn it off
if it is enabled.

Rabin

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



Re: [PHP] Problem with the passthru function

2006-06-14 Thread Venkatesh Babu
Hi,

Thanks for your response 

safe_mode is Off but still I'm getting this problem.

Thank you,
Venkatesh

--- Rabin Vincent <[EMAIL PROTECTED]> wrote:

> On 6/14/06, Venkatesh Babu <[EMAIL PROTECTED]>
> wrote:
> > I have a small php file (test.php) whose code is
> shown
> > below:
> >
> >  > $retval=1;
> > $command='/bin/ls';
> > passthru($command, $retval);
> > print("Exit status: " . $retval);
> > ?>
> >
> > This test.php works fine when I execute from
> command
> > prompt as "php test.php", but when I access it
> through
> > web browser, it seems not to be working fine, I
> get an
> > exit status of 127 (which means command not
> found). I
> > checked for permissions of ls, gave full path, but
> > still it is failing.
> >
> > Can anybody help me in indentifying what is the
> > potential problem?
> 
> Check if safe_mode is on in your php.ini. Turn it
> off
> if it is enabled.
> 
> Rabin
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] preg_replace \\1 yIKES!

2006-06-14 Thread sam


On Jun 13, 2006, at 1:58 PM, tedd wrote:


At 11:33 AM -0700 6/13/06, sam wrote:

Wow this is hard I can't wait till I get the hang of it.

Capitalize the first letter of a word.


Try:





This blows my mind. What should one think, "everything is an array"?  
Well, okay not every but everything that's in linear consecutive  
order; anything that can be indexed?


I was trying to make an array from $word but explode() doesn't take  
an empty delimiter so I gave up and went for the preg_replace.



And hey yo, Jochem,
I did RTFM, for hours, I always do before I post to the list. I just  
missed all the answers in the fine manual this time. Cut me some slack.


Where should I wire the Euros to?

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



Re: [PHP] preg_replace \\1 yIKES!

2006-06-14 Thread Jochem Maas
sam wrote:
> 
> On Jun 13, 2006, at 1:58 PM, tedd wrote:
> 
>> At 11:33 AM -0700 6/13/06, sam wrote:
>>> Wow this is hard I can't wait till I get the hang of it.
>>>
>>> Capitalize the first letter of a word.
>>
>> Try:
>>
>> > $word = "yikes";
>> $word[0]=strtoupper($word[0]);
>> echo($word);
>> ?>
> 
> 
> This blows my mind. What should one think, "everything is an array"?

an array is an array.
a string is a string.

characters in a string can be accessed using array-like notation using the
offset postion of the relevant char (elements are zero based)

> Well, okay not every but everything that's in linear consecutive order;
> anything that can be indexed?
> 
> I was trying to make an array from $word but explode() doesn't take an
> empty delimiter so I gave up and went for the preg_replace.
> 
> 
> And hey yo, Jochem,
> I did RTFM, for hours, I always do before I post to the list. I just

I'd tell you to RTFM (although I did tell you to read the manual regarding
the specifics of using preg_replace()'s 'e' modifier after showing you a
working example of how to use it, based on your original code snippet)

I did berate the fact that you waited no more than 7 minutes before
sending a 'help me' reminder regarding your original post.

> missed all the answers in the fine manual this time. Cut me some slack.

cut you slack? are you a graphic designer or something?

> 
> Where should I wire the Euros to?

my paypal account name is my email address :-)

> 
> --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] Dettach problem

2006-06-14 Thread grape

Hi,

Jochem Maas skrev:


as a last resort you might as on internals@lists.php.net as to whether
anyone there considers this a possible bug.

 


I'll do that.

Jochem, Richard - thank you for your input.

/Grape

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



Re: [PHP] preg_replace \\1 yIKES!

2006-06-14 Thread Stut

Jochem Maas wrote:

 I did berate the fact that you waited no more than 7 minutes before
 sending a 'help me' reminder regarding your original post.


While I agree with most of what you are saying, you may want to check 
that email again. Sams 'for Eyes burning...' email was in response to 
someone privately suggesing that he use ucfirst. It was *not* a 'help 
me' reminder, so drop that criticism please.


Aside from that, anyone who manages to miss ucfirst when R'ingTFM for 
this problem should RTFM some more.


-Stut

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



Re: [PHP] preg_replace \\1 yIKES!

2006-06-14 Thread sam




And hey yo, Jochem,
I did RTFM, for hours, I always do before I post to the list. I just


I'd tell you to RTFM (although I did tell you to read the manual  
regarding
the specifics of using preg_replace()'s 'e' modifier after showing  
you a

working example of how to use it, based on your original code snippet)


Yes, I'm using your example right now to help me learn this  
preg_replace beast.


The php.net page on preg_replace was just to overwhelming for the  
exhausted state of mind I was in.



I did berate the fact that you waited no more than 7 minutes before
sending a 'help me' reminder regarding your original post.


No, that was a misunderstanding, I was just saying thanks to the guy  
who said, "why not just use ulfirst()." (Which I also missed on the  
php.net page on strings.)




missed all the answers in the fine manual this time. Cut me some  
slack.


cut you slack? are you a graphic designer or something?


How did you know? I was 'in' graphics for 30 years before I threw my  
hands up at that lunatic world and decided to become a programmer.


I love the printing industry but ever since the Mac took over  
everybody went nuts. The printers are still mad, after 15 years, that  
the Mac took away their razor blades and rubylith.


Checks in the mail.

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



[PHP] references for beginner...

2006-06-14 Thread BBC

Hii all
I just joined this forum, I'm beginner of PHP programming.
I didn't understand almost all the syntax you're talking about (ups too 
honest, right?), so please...
Does anyone have a kinds of references like soft books or something, which 
talk about all the syntax, and what for are they (also how to use if 
necessary)

and where can I download it?
thank for all references
best regard
BBC

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



Re: [PHP] references for beginner...

2006-06-14 Thread nicolas figaro

BBC a écrit :

Hii all
I just joined this forum, I'm beginner of PHP programming.

welcome.
I didn't understand almost all the syntax you're talking about (ups 
too honest, right?), so please...
Does anyone have a kinds of references like soft books or something, 
which talk about all the syntax, and what for are they (also how to 
use if necessary)

and where can I download it?

http://www.php.net/manual/ could be a good starting point.
N F

thank for all references
best regard
BBC



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



Re: [PHP] preg_replace \\1 yIKES!

2006-06-14 Thread Jochem Maas
Stut wrote:
> Jochem Maas wrote:
>>  I did berate the fact that you waited no more than 7 minutes before
>>  sending a 'help me' reminder regarding your original post.
> 
> While I agree with most of what you are saying, you may want to check
> that email again. Sams 'for Eyes burning...' email was in response to
> someone privately suggesing that he use ucfirst. It was *not* a 'help
> me' reminder, so drop that criticism please.

consider it dropped - I didn't catch that it was a reply to an offlist post.

> 
> Aside from that, anyone who manages to miss ucfirst when R'ingTFM for
> this problem should RTFM some more.
> 
> -Stut
> 

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



RE: [PHP] Re: Setting headers for file download

2006-06-14 Thread Peter Lauri
I got it working on one server, but not the real server. I just took your
code and voila it was working (with some modifications).

It works on:
Localhost Windows
Plesk Server running Plesk 7.5

Not working on:
Plesk Server running Plesk 7.0

Then the questions is: Where should I start to search in WHY the server is
not sending the correct headers? This is becoming more and more irritating
:)

Best regards,
Peter Lauri



-Original Message-
From: Rafael [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 14, 2006 6:28 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Setting headers for file download

I use something like this...
   $file_len = filesize($file_name);
   $file_ts  = filemtime($file_name);
   header('Content-Type: application/x-octet-stream'); // none known
   header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
   header('Last-Modified: '. gmdate('D, d M Y H:i:s', $file_ts) .' GMT');
   header('Content-Disposition: attachment; filename="'. 
basename($file_name) .'"');
   header("Content-Length: $file_len");
   readfile($file_name);


Peter Lauri wrote:
> Best group member,
> 
> This is how I try to push files to download using headers:
> 
> header("Content-type: $file_type");
> header("Content-Disposition: attachment; filename=$filename"); 
> print $file;
> 
> It works fine in FireFox, but not that good in IE. I have been googled to
> find the fix for IE, but I can not find it. Anyone with experience of
this?
> 
> Best regards,
> Peter Lauri

-- 
Atentamente / Sincerely,
J. Rafael Salazar Magaña

-- 
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] Re: Setting headers for file download

2006-06-14 Thread Barry

Peter Lauri schrieb:

Best group member,

This is how I try to push files to download using headers:

header("Content-type: $file_type");
header("Content-Disposition: attachment; filename=$filename"); 
print $file;


It works fine in FireFox, but not that good in IE. I have been googled to
find the fix for IE, but I can not find it. Anyone with experience of this?

Best regards,
Peter Lauri


There ya go:
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");

// browser must download file from server instead of cache

// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

// use the Content-Disposition header to supply a recommended 
filename and

// force the browser to display the save dialog.
header("Content-Disposition: attachment; filename=".$path.";");

header("Content-Transfer-Encoding: binary");

header("Content-Length: ".filesize($file));

readfile($file);

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] Re: Setting headers for file download

2006-06-14 Thread Peter Lauri
That did it, thanks...

Ok, my knowledge about HTTP is not the best. But how can you send three
different content-type headers? :)


-Original Message-
From: Barry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 14, 2006 8:36 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Setting headers for file download

Peter Lauri schrieb:
> Best group member,
> 
> This is how I try to push files to download using headers:
> 
> header("Content-type: $file_type");
> header("Content-Disposition: attachment; filename=$filename"); 
> print $file;
> 
> It works fine in FireFox, but not that good in IE. I have been googled to
> find the fix for IE, but I can not find it. Anyone with experience of
this?
> 
> Best regards,
> Peter Lauri

There ya go:
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
 header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");
 // browser must download file from server instead of cache

 // force download dialog
 header("Content-Type: application/force-download");
 header("Content-Type: application/octet-stream");
 header("Content-Type: application/download");

 // use the Content-Disposition header to supply a recommended 
filename and
 // force the browser to display the save dialog.
 header("Content-Disposition: attachment; filename=".$path.";");

 header("Content-Transfer-Encoding: binary");

 header("Content-Length: ".filesize($file));

 readfile($file);

-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 
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: Setting headers for file download

2006-06-14 Thread Barry

Peter Lauri schrieb:

That did it, thanks...

Ok, my knowledge about HTTP is not the best. But how can you send three
different content-type headers? :)



There are not so different at all.
Just giving the browser the job to download that thing.

Every browser likes to interpret every content-type like he wants to.
They ignore mostly every type they dislike.

That's the problem you encounter in using firefox/IE.

Greets
Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] preg_replace \\1 yIKES!

2006-06-14 Thread tedd
At 3:45 AM -0700 6/14/06, sam wrote:
>On Jun 13, 2006, at 1:58 PM, tedd wrote:
>
>>At 11:33 AM -0700 6/13/06, sam wrote:
>>>Wow this is hard I can't wait till I get the hang of it.
>>>
>>>Capitalize the first letter of a word.
>>
>>Try:
>>
>>>$word = "yikes";
>>$word[0]=strtoupper($word[0]);
>>echo($word);
>>?>
>
>
>This blows my mind. What should one think, "everything is an array"? Well, 
>okay not every but everything that's in linear consecutive order; anything 
>that can be indexed?
>
>I was trying to make an array from $word but explode() doesn't take an empty 
>delimiter so I gave up and went for the preg_replace.

Sorry, it was a throwback to my C days -- using ucfist() is better.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Setting headers for file download [medium]

2006-06-14 Thread Rafael

Barry wrote:

Peter Lauri schrieb:

Ok, my knowledge about HTTP is not the best. But how can you send three
different content-type headers? :)


There are not so different at all.
Just giving the browser the job to download that thing.

Every browser likes to interpret every content-type like he wants to.
They ignore mostly every type they dislike.


	According to the manual, header() will replace previous "similar 
headers" with the new one sent, which would be

  header("Content-Type: application/download");

"The optional replace parameter indicates whether the header should 
replace a previous similar header, or add a second header of the same 
type. By default it will replace, but if you pass in FALSE as the second 
argument you can force multiple headers of the same type"

[1]http://php.net/header

	As for the value of Content-Type it doesn't matter, you only have to 
specify an unknown (MIME) type so the browser won't know what to do with 
it, hence forcing to download the file.


	As minor notes (after reading a bit the RFC)... "Expires" is expected 
to be a date, not a number, and "Pragma" value conflicts with 
Cache-control, since...

   public
  Indicates that the response MAY be cached by any cache, even if it
  would normally be non-cacheable or cacheable only within a non-
  shared cache. (See also Authorization, section 14.8, for
  additional details.)

	Also, it seems we're given a wrong use for "must-revalidate" (me 
included), that or I misunderstood the RFC documentation --I didn't even 
found "pre-check" & "post-check".  Content-Disposition is not part of 
the HTTP standard and Content-Transfer-Encoding is ignored, since both 
seem to be for e-mail usage (LOL) --and it's possible values are 
"quoted-printable" o "base64"--.  Finally, "Content-Length" and 
"Content-Type" seem to apply only if "had the request been a GET".


	Interesting what you learn reading the RFCs, too bad they're too long 
and sometimes not that clear.

RFC: http://www.faqs.org/rfcs/rfc2616
--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

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



Re: [PHP] references for beginner...

2006-06-14 Thread tedd
At 5:16 AM -0700 6/14/06, BBC wrote:
>Hii all
>I just joined this forum, I'm beginner of PHP programming.
>I didn't understand almost all the syntax you're talking about (ups too 
>honest, right?), so please...
>Does anyone have a kinds of references like soft books or something, which 
>talk about all the syntax, and what for are they (also how to use if necessary)
>and where can I download it?
>thank for all references
>best regard
>BBC
>

BBC:

Welcome.

Lot's of good stuff on the net. Do a cursory review of the following and start 
where you like.

http://www.w3schools.com/php/default.asp
http://www.weberdev.com/ViewArticle/433
http://www.weberdev.com/Manuals/
http://www.unf.edu/~rita0001/eresources/php_tutorials/index.htm
http://www.phpit.net/article/back-to-basics-arrays/

And, of course don't forget mysql

http://www.brainbell.com/tutors/php/php_mysql/index.html
http://www.php-mysql-tutorial.com/index.php

And, ton's of books.



Some, very good and very cheap. I just wish I could remember all I've read. :-)

hth's

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PHP6 build help

2006-06-14 Thread Rory Browne

/me goes and bangs head against wall.

On 6/14/06, Rabin Vincent <[EMAIL PROTECTED]> wrote:


On 6/14/06, Rory Browne <[EMAIL PROTECTED]> wrote:
> Only if (s)he''s on a debian based linux distro.
>
> I see from his configure output, that he's on Linux, but what makes you
> think he's on  Debian ( or on a system with apt-rpm ) ?

The first line of Ligaya's email said: "Ubuntu Breezy Badger,
AMD 64". That's a Debian-based distro.

Rabin



Re: [PHP] Seeking recommendations for use of include()

2006-06-14 Thread Dave M G

Larry,

Thank you for responding.


$untrusted_var = '../../../../../../../etc/passwd';
include($untrusted_var);

Or in later versions of PHP, I *think* the following may even work:

$untrusted_var = 'http://evilsite.com/pub/evil.php';
include($untrusted_var);


I'm still not sure I see the danger. By which I'm not saying that I deny 
there is danger, just that I don't see this.


In both cases cited above, the malicious user has to write the code into 
my script that says to include($untrusted_var). And, again, it seems to 
me that if the malicious user has made it far enough to gain enough 
access to be able to do that, the damage is already done. They already 
have full access and full write capability, and could do any number of 
crazy things.


I understand that I am being warned of a potential security risk, and I 
hope to come to understand it. But can someone show me more explicitly 
how someone could exploit a dynamic include() function with simple 
access through forms? And, can that access be exploited even when fairly 
common restrictions on form data is implemented (such as no tags and such)?


--
Dave M G

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



[PHP] Simple class declaration returns error

2006-06-14 Thread Dave M G

PHP List,

I am in the preliminary stages of designing my first object oriented PHP 
based web site.


I've created file called "article.class" and included it in my index.php 
file. I put in a very simple echo statement, just as a place marker 
before I put in the real code, and just to make sure that the index.php 
file is successfully including the class.


So far, it just looks like this (including line numbers):

4. class article{
5. public function edit(){
6. echo "test";
7. }
8. }

However, when I view my index.php, it says:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION 
or T_FUNCTION or T_VAR or '}' in /web/article.class on line 5


Of course I consulted the PHP manual to make sure that I had the class 
syntax correct, and it seems that I've followed the basic structure as 
described there.


Where have I gone wrong?

Thank you for any advice.

--
Dave M G

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



Re: [PHP] Simple class declaration returns error

2006-06-14 Thread Brad Bonkoski

What version of PHP are you using?
I suspect something less then 5.0 which means the public/private 
declarations are not supported...

(So remove 'public' and see if it works)
-Brad

Dave M G wrote:


PHP List,

I am in the preliminary stages of designing my first object oriented 
PHP based web site.


I've created file called "article.class" and included it in my 
index.php file. I put in a very simple echo statement, just as a place 
marker before I put in the real code, and just to make sure that the 
index.php file is successfully including the class.


So far, it just looks like this (including line numbers):

4. class article{
5. public function edit(){
6. echo "test";
7. }
8. }

However, when I view my index.php, it says:

Parse error: syntax error, unexpected T_STRING, expecting 
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /web/article.class on 
line 5


Of course I consulted the PHP manual to make sure that I had the class 
syntax correct, and it seems that I've followed the basic structure as 
described there.


Where have I gone wrong?

Thank you for any advice.

--

Dave M G



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



[PHP] Calculating difference between two days

2006-06-14 Thread afan
Hi,
I need to calculate no. of days between two dates, actually between date
stored in DB and today's date.

Does anybody has an example I can use?

I found an example on
http://www.developertutorials.com/tutorials/php/calculating-difference-between-dates-php-051018/page1.html

but function gregoriantojd() doesn't work for me
Fatal error: Call to undefined function: gregoriantojd()

Found this:
Please read the manual:
  http://www.php.net/manual/en/ref.calendar.php
You need to either compile the extension in or load it.
Since you provided no details about your situation at all,
I cannot help you further.
on
http://bugs.php.net/bug.php?id=10151&edit=1


Thanks on any help.

-afan

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



Re: [PHP] Calculating difference between two days

2006-06-14 Thread Brad Bonkoski
You could just parse the dates out and feed them to mktime(), subtract 
the difference between the two (in seconds) and use that to determin the 
number of days...


Something like:



[EMAIL PROTECTED] wrote:


Hi,
I need to calculate no. of days between two dates, actually between date
stored in DB and today's date.

Does anybody has an example I can use?

I found an example on
http://www.developertutorials.com/tutorials/php/calculating-difference-between-dates-php-051018/page1.html

but function gregoriantojd() doesn't work for me
Fatal error: Call to undefined function: gregoriantojd()

Found this:
Please read the manual:
 http://www.php.net/manual/en/ref.calendar.php
You need to either compile the extension in or load it.
Since you provided no details about your situation at all,
I cannot help you further.
on
http://bugs.php.net/bug.php?id=10151&edit=1


Thanks on any help.

-afan

 



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



Re: [PHP] Calculating difference between two days

2006-06-14 Thread D. Dante Lorenso

[EMAIL PROTECTED] wrote:

I need to calculate no. of days between two dates, actually between date
stored in DB and today's date.
Does anybody has an example I can use?
  


Your database will have this function.  In PostgreSQL:

   SELECT data_column - NOW() AS date_diff;

There are similar functions for MySQL.  Otherwise, consider
converting your dates to unix time and subtracting the two
numbers to find the date difference in seconds.  These maay also be
your friends:

   http://us3.php.net/manual/en/ref.datetime.php
   http://us3.php.net/manual/en/function.mktime.php
   http://us3.php.net/manual/en/function.date.php

Dante

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



Re: [PHP] Simple class declaration returns error

2006-06-14 Thread Dave M G

Brad,

What version of PHP are you using?
I suspect something less then 5.0 which means the public/private 
declarations are not supported...

(So remove 'public' and see if it works)


Yes, it turns out that I am using PHP 4, and I thought I was using 5. 
Thank you for pointing it out.


Now I have to consider whether or not to make my code PHP 4 compatible, 
or upgrade to version 5.


--
Dave M G

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



Re: [PHP] references for beginner...

2006-06-14 Thread BBC

Thank Mr.Figaro.

- Original Message - 
From: "nicolas figaro" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, June 14, 2006 5:21 AM
Subject: Re: [PHP] references for beginner...



BBC a écrit :

Hii all
I just joined this forum, I'm beginner of PHP programming.

welcome.
I didn't understand almost all the syntax you're talking about (ups too 
honest, right?), so please...
Does anyone have a kinds of references like soft books or something, 
which talk about all the syntax, and what for are they (also how to use 
if necessary)

and where can I download it?

http://www.php.net/manual/ could be a good starting point.
N F

thank for all references
best regard
BBC



--
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] Using PHP/HTML effectivly

2006-06-14 Thread Alex Major
Hi List,
I've been (very slowly) working my way through some basic php, and
putting it into my html site. However recently (after trying things out such
as cookies or redirects where they have to be set before any page output)
I've found that the combination or certainly the way that I'm using php and
html together dosn't seem to go too well.

I have a question to you experienced PHP developers, how do you mix the
html/php together. When I've looked at things like the PHPBB forums, and
gone through files they will have absolutly no HTML, just php code. I'm not
sure how they manage their page styling, if anyone could explain this too
me. 

At the moment I have things such as







I'm sure that I'm not doing it the best possible way, so if anyone has any
tips for me.

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



RE: [PHP] references for beginner...

2006-06-14 Thread Jay Blanchard
[snip]
I just joined this forum
[/snip]

Some must read info;

http://zirzow.dyndns.org/php-general/NEWBIE
http://www.php.net/manual/en/security.php
http://phpsec.org/
http://www.hardened-php.net/advisories.15.html
http://phpsec.org/projects/guide/

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-14 Thread tg-php
I'm guessing that phpBB is doing things the "right way".. that is, separating 
presentation and logic.  In cases like that, you have your PHP code and your 
HTML in separate files with as little 'logic' in the HTML as possible.

I'm kind of oversimplifying the explaination and I'm sure there are "more 
profressional" php developers that can describe it more precisely, but the 
general theory is to let your programmers program and let your designers design 
and this is a way to keep them out of each other's hair and make the code and 
layout easier to maintain.

Just because you change the graphics or layout of a page, doesn't mean you need 
a PHP developer to go in there and wade through the tangles of PHP code to do 
so.  Most web design people are smart enough to understand things like "make 
sure this input box is of this type and has this name and/or id and/or other 
kind of label".  Even to keep basic PHP stuff like foreach loops intact when 
redesigning.  They don't wanve to have to see all the database calls and array 
processing that we end up dealing with.


Over simplfied example:




  Edit Form



Username: 
Is Active?: >




This keeps minimal PHP code in the tpl (template) file and keeps it mostly HTML 
for easy editing without confusing a non-PHP oriented web developer.

That's a really really basic example, but that's one general coding standard.

One of these days I hope to actually get to work like that.  I keep inheriting 
big projects that are too much of a mess already that they'd have to be 
re-written to work like that.. hah

Good luck Alex!

-TG

= = = Original message = = =

Hi List,
I've been (very slowly) working my way through some basic php, and
putting it into my html site. However recently (after trying things out such
as cookies or redirects where they have to be set before any page output)
I've found that the combination or certainly the way that I'm using php and
html together dosn't seem to go too well.

I have a question to you experienced PHP developers, how do you mix the
html/php together. When I've looked at things like the PHPBB forums, and
gone through files they will have absolutly no HTML, just php code. I'm not
sure how they manage their page styling, if anyone could explain this too
me. 

At the moment I have things such as







I'm sure that I'm not doing it the best possible way, so if anyone has any
tips for me.


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Calculating difference between two days

2006-06-14 Thread tg-php
Shouldn't be too difficult in PHP.

\n";
  echo "Minutes difference: $minutesdiff\n";
  echo "Hours difference: $hoursdiff\n";
  echo "Days difference: $daysdiff\n";
?>


And if you want a larger example to play with, here's something I did a couple 
years ago (forgive the word wrapping and any unrefinedness.. it's something I 
whipped up as a test when someone asked a similar question back then).

There's bound to be some way to do it in SQL as well, but unless there's a 
specific function for it like the other example given by another member, then 
you're likely to write a lot of really ugly SQL code to tackle the problem.

Good luck!

-TG

31536000,"Months"=>2592000,"Days"=>86400,"Hours"=>3600,"Minutes"=>60);
  
  # How many seconds between two dates/times
  $daydiff = mktime($ehour,$eminute,$esecond,$emonth,$eday,$eyear) -
  mktime($shour,$sminute,$ssecond,$smonth,$sday,$syear);
  
  if ($daydiff < 0) { $daydiff *= -1; $negative = TRUE; }
  
  # Just to make sure I didn't use $remainder somewhere else in my script and 
forgot
  if (isset($remainder)) unset($remainder);
  
  # Cycle through timeframes checking to see if number is large enough to be a 
full year/month/day/etc
  # If so, find out how many and store remainder for further processing
  # If not, set to zero and continue processing
  foreach ($secondsequiv as $timeframe=>$seconds) {
if (isset($remainder)) { $checkvalue = $remainder; } else { $checkvalue = 
$daydiff; }
if ($checkvalue >= $seconds) {
  $daydiffarr[$timeframe] = floor($checkvalue/$seconds);
  $remainder = $daydiff % $seconds;
} else {
  $daydiffarr[$timeframe] = 0;
}
  }
  
  # If $reminder is never used, then we're dealing with less than a minute's 
worth of time diff
  if (isset($remainder)) {
$daydiffarr["Seconds"] = $remainder;
  } else {
$daydiffarr["Seconds"] = $daydiff;
  }
  
  # Display results
  if ($negative) echo "NEGATIVE!!\n";
  foreach ($daydiffarr as $timeframe=>$count) {
echo "$timeframe = $count\n";
  }
?> 

= = = Original message = = =

Hi,
I need to calculate no. of days between two dates, actually between date
stored in DB and today's date.

Does anybody has an example I can use?

I found an example on
http://www.developertutorials.com/tutorials/php/calculating-difference-between-dates-php-051018/page1.html

but function gregoriantojd() doesn't work for me
Fatal error: Call to undefined function: gregoriantojd()

Found this:
Please read the manual:
  http://www.php.net/manual/en/ref.calendar.php
You need to either compile the extension in or load it.
Since you provided no details about your situation at all,
I cannot help you further.
on
http://bugs.php.net/bug.php?id=10151&edit=1


Thanks on any help.

-afan


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] declaring a class as stdClass?

2006-06-14 Thread Mariano Guadagnini

Hi list,
I hace an existencial doubt: i've seem many scripts declaring classes as 
stdClass. In the documentation (for PHP5 and also for 4), it says that 
this class is internal of php, and should't be used. By the manner I saw 
it's being used, i guess that it can be handy to create a 'generic' or 
so class, and append members when needed on the fly, without the need 
for a formal class declaration, but i could't find any good source 
explaining that. Has somebody some info about?


Thanks in advance.


Mariano Guadagnini.-


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.4/363 - Release Date: 13/06/2006

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



[PHP] Checking for empty()

2006-06-14 Thread Ashley M. Kirchner


   I have a form with various fields on it that I want to make sure 
aren't empty or the user didn't just hit the space bar or return (in a 
text field).  What's the best way to do this?  Seems empty() will fail 
on a textarea if the user simply hits a space or return and submits the 
form.


--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.

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



Re: [PHP] Checking for empty()

2006-06-14 Thread Brad Bonkoski
Weel, since this is a PHP list I will assume you are checking once the 
page is posted/submitted...


off the top of my head, the functions strlen() and isset() come to mind.
-Brad

Ashley M. Kirchner wrote:



   I have a form with various fields on it that I want to make sure 
aren't empty or the user didn't just hit the space bar or return (in a 
text field).  What's the best way to do this?  Seems empty() will fail 
on a textarea if the user simply hits a space or return and submits 
the form.




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



Re: [PHP] Checking for empty()

2006-06-14 Thread Ashley M. Kirchner

Brad Bonkoski wrote:
Weel, since this is a PHP list I will assume you are checking once the 
page is posted/submitted...

   That would be correct.  At the moment I'm checking with
  if (empty($_POST['var'])) { throw error flag }

   But as I read up on empty() I realized that if one simply hits a 
space and/or a return, empty() will fail.



off the top of my head, the functions strlen() and isset() come to mind.

   Will look into them.  Danke.

--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.

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



Re: [PHP] Simple class declaration returns error

2006-06-14 Thread Jochem Maas
Dave M G wrote:
> Brad,
>> What version of PHP are you using?
>> I suspect something less then 5.0 which means the public/private
>> declarations are not supported...
>> (So remove 'public' and see if it works)
> 
> Yes, it turns out that I am using PHP 4, and I thought I was using 5.
> Thank you for pointing it out.
> 
> Now I have to consider whether or not to make my code PHP 4 compatible,
> or upgrade to version 5.

I wouldn't bother with php4 objects if your only just starting out now -
by the time you really get the hang of objects php6 will probably be making an
entrance.

BUT starting with objects in php5 doesn't mean you have to dive right in
and use stuff like public/private/protected ... and stuff like interfaces...
they'll probably just take all the fun out of it when your just starting out.

jmho.

> 
> -- 
> Dave M G
> 

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



Re: [PHP] Checking for empty()

2006-06-14 Thread D. Dante Lorenso

Ashley M. Kirchner wrote:
I have a form with various fields on it that I want to make sure 
aren't empty or the user didn't just hit the space bar or return (in a 
text field).  What's the best way to do this?  Seems empty() will fail 
on a textarea if the user simply hits a space or return and submits 
the form.


You can always 'trim' before you do the empty check.  Just assign to a 
variable first since empty doesn't do non-var expressions


$value = trim($value);
if (empty($value)) {
   // error not filled in
}

Of course, you'll also want to validate the data type is a string or 
number also, etc...and not an array.  This is the goal of the up and 
coming input filtering features.


Dante

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



Re: [PHP] Checking for empty()

2006-06-14 Thread Stut

Ashley M. Kirchner wrote:
   I have a form with various fields on it that I want to make sure 
aren't empty or the user didn't just hit the space bar or return (in a 
text field).  What's the best way to do this?  Seems empty() will fail 
on a textarea if the user simply hits a space or return and submits the 
form.


if (strlen(trim($var)) == 0)
print "It's empty";

-Stut

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



Re: [PHP] declaring a class as stdClass?

2006-06-14 Thread D. Dante Lorenso

Mariano Guadagnini wrote:

Hi list,
I hace an existencial doubt: i've seem many scripts declaring classes 
as stdClass. In the documentation (for PHP5 and also for 4), it says 
that this class is internal of php, and should't be used. By the 
manner I saw it's being used, i guess that it can be handy to create a 
'generic' or so class, and append members when needed on the fly, 
without the need for a formal class declaration, but i could't find 
any good source explaining that. Has somebody some info about?


Also, along the lines of this same question, I can do this in PHP very 
easily:


  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' => 
'purple');

   $data = (object) $data;
   print_r($data);
   ?>

And my object is magically created for me as an instance of stdClass.  
Is there a way to cast as some other type of class?


  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' => 
'purple');

   $data = (MyCustomClass) $data;
   print_r($data);
   ?>

I ask this because the cast in my first example, the (object) cast is 
WAY faster than using the manual approach of:


  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' => 
'purple');

   $MYCLASS = new MyCustomClass();
   foreach ($data as $key => $value)
  $MYCLASS->$key = $value;
   }
   ?>

Dante

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



Re: [PHP] Checking for empty()

2006-06-14 Thread Jochem Maas
Ashley M. Kirchner wrote:
> 
>I have a form with various fields on it that I want to make sure
> aren't empty or the user didn't just hit the space bar or return (in a
> text field).  What's the best way to do this?  Seems empty() will fail
> on a textarea if the user simply hits a space or return and submits the
> form.

I often use trim() on *any* incoming data as the first step to sanitizing
the data - that gets rid of the whitespace problem you describe.

a second step often involves using strval(), intval(), floatval() et al.

subsequent steps might involve funcs like striptags() to remove any HTML
that some b** might be trying to XSS your site with.


in the future the filter extension will provide robust, standardized
ways to santize incoming data - I think it ill be a huge step forward.


> 

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



Re: [PHP] Seeking recommendations for use of include()

2006-06-14 Thread Jochem Maas
Dave M G wrote:
> Larry,
> 
> Thank you for responding.
>>
>> $untrusted_var = '../../../../../../../etc/passwd';
>> include($untrusted_var);
>>
>> Or in later versions of PHP, I *think* the following may even work:
>>
>> $untrusted_var = 'http://evilsite.com/pub/evil.php';
>> include($untrusted_var);
> 
> I'm still not sure I see the danger. By which I'm not saying that I deny
> there is danger, just that I don't see this.
> 
> In both cases cited above, the malicious user has to write the code into
> my script that says to include($untrusted_var). And, again, it seems to
> me that if the malicious user has made it far enough to gain enough
> access to be able to do that, the damage is already done. They already
> have full access and full write capability, and could do any number of
> crazy things.
> 
> I understand that I am being warned of a potential security risk, and I
> hope to come to understand it. But can someone show me more explicitly
> how someone could exploit a dynamic include() function with simple
> access through forms? And, can that access be exploited even when fairly
> common restrictions on form data is implemented (such as no tags and such)?

::index.php


::urls (ignore the fact that stuff would need to be urlencoded..)

http://yoursite.com/index.php?page=/etc/passwd
http://yoursite.com/index.php?page=http://evilsite.com/installrootkit.php



that is the most simple version of the problem, now consider that people
can use security bugs in 3rd party apps to upload php files (or complete [scam] 
sites)
which may not be directly accessible (e.g. in ../uploads relative to the 
webroot) then
they may be able to do stuff like:

http://yoursite.com/index.php?page=../uploads/rootkitinstallingphpfilepretendingtobeajpeg.jpg

and what goes for GET also goes for POST and COOKIE.

> 
> -- 
> Dave M G
> 

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-14 Thread Jon Anderson

This is my opinion on the matter...

From experience, I would say that mixing PHP and HTML together in a 
complicated page can often get very ugly. I prefer to separate out 
presentation and code into separate layers as much as possible.


I have most often used template systems such as Smarty (smarty.php.net) 
for that. I use Smarty for work - I find it quite nice. It allows you to 
separate your code from your presentation very effectively. It's easy to 
use, and provides things like caching for performance.


However, I came to the realization recently that PHP itself is 
essentially a very feature rich template system (nevermind the fact that 
it's a well defined language. ;-)


By splitting up my most recent project into includes, templates, and 
pages, I get a solution to the problem in pure PHP. In the end, code 
looks like code, and HTML looks (almost) like HTML and both are 
readable. (Same result as what Smarty gives you, without needing Smarty.)


Most pages look something like:



And most templates look something like:



...



 
 



...
Thanks for your interest in my data!


jon


Alex Major wrote:

Hi List,
I've been (very slowly) working my way through some basic php, and
putting it into my html site. However recently (after trying things out such
as cookies or redirects where they have to be set before any page output)
I've found that the combination or certainly the way that I'm using php and
html together dosn't seem to go too well.

I have a question to you experienced PHP developers, how do you mix the
html/php together. When I've looked at things like the PHPBB forums, and
gone through files they will have absolutly no HTML, just php code. I'm not
sure how they manage their page styling, if anyone could explain this too
me. 


At the moment I have things such as







I'm sure that I'm not doing it the best possible way, so if anyone has any
tips for me.

  


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



Re: [PHP] Calculating difference between two days

2006-06-14 Thread afan
Thanks for all your, very usefull examples.

-afan



> Shouldn't be too difficult in PHP.
>
>$yesterday = date("m/d/y", mktime(0,0,0,date("m"), date("d") - 1,
> date("y")));
>   $today = date("m/d/y");
>
>   $secondsdiff = strtotime($today) - strtotime($yesterday);
>   $minutesdiff = $secondsdiff / 60;
>   $hoursdiff = $minutesdiff / 60;
>   $daysdiff = $hoursdiff / 24;
>
>   echo "Seconds difference: $secondsdiff\n";
>   echo "Minutes difference: $minutesdiff\n";
>   echo "Hours difference: $hoursdiff\n";
>   echo "Days difference: $daysdiff\n";
> ?>
>
>
> And if you want a larger example to play with, here's something I did a
> couple years ago (forgive the word wrapping and any unrefinedness.. it's
> something I whipped up as a test when someone asked a similar question
> back then).
>
> There's bound to be some way to do it in SQL as well, but unless there's a
> specific function for it like the other example given by another member,
> then you're likely to write a lot of really ugly SQL code to tackle the
> problem.
>
> Good luck!
>
> -TG
>
># Standard format dates and times
>   $startdate = "04/12/04";
>   $starttime = "13:05:01";
>
>   $enddate = "10/14/04";
>   $endtime = "13:05:01";
>
>   # Break apart dates and times for mktime
>   list($smonth,$sday,$syear) = explode("/",$startdate);
>   list($emonth,$eday,$eyear) = explode("/",$enddate);
>   list($shour,$sminute,$ssecond) = explode(":",$starttime);
>   list($ehour,$eminute,$esecond) = explode(":",$endtime);
>
>   # Number of seconds in each timeframe, 1 month = 30 days
>   $secondsequiv
> array("Years"=>31536000,"Months"=>2592000,"Days"=>86400,"Hours"=>3600,"Minutes"=>60);
>
>   # How many seconds between two dates/times
>   $daydiff = mktime($ehour,$eminute,$esecond,$emonth,$eday,$eyear) -
>   mktime($shour,$sminute,$ssecond,$smonth,$sday,$syear);
>
>   if ($daydiff < 0) { $daydiff *= -1; $negative = TRUE; }
>
>   # Just to make sure I didn't use $remainder somewhere else in my script
> and forgot
>   if (isset($remainder)) unset($remainder);
>
>   # Cycle through timeframes checking to see if number is large enough to
> be a full year/month/day/etc
>   # If so, find out how many and store remainder for further processing
>   # If not, set to zero and continue processing
>   foreach ($secondsequiv as $timeframe=>$seconds) {
> if (isset($remainder)) { $checkvalue = $remainder; } else {
> $checkvalue = $daydiff; }
> if ($checkvalue >= $seconds) {
>   $daydiffarr[$timeframe] = floor($checkvalue/$seconds);
>   $remainder = $daydiff % $seconds;
> } else {
>   $daydiffarr[$timeframe] = 0;
> }
>   }
>
>   # If $reminder is never used, then we're dealing with less than a
> minute's worth of time diff
>   if (isset($remainder)) {
> $daydiffarr["Seconds"] = $remainder;
>   } else {
> $daydiffarr["Seconds"] = $daydiff;
>   }
>
>   # Display results
>   if ($negative) echo "NEGATIVE!!\n";
>   foreach ($daydiffarr as $timeframe=>$count) {
> echo "$timeframe = $count\n";
>   }
> ?>
>
> = = = Original message = = =
>
> Hi,
> I need to calculate no. of days between two dates, actually between date
> stored in DB and today's date.
>
> Does anybody has an example I can use?
>
> I found an example on
> http://www.developertutorials.com/tutorials/php/calculating-difference-between-dates-php-051018/page1.html
>
> but function gregoriantojd() doesn't work for me
> Fatal error: Call to undefined function: gregoriantojd()
>
> Found this:
> Please read the manual:
>   http://www.php.net/manual/en/ref.calendar.php
> You need to either compile the extension in or load it.
> Since you provided no details about your situation at all,
> I cannot help you further.
> on
> http://bugs.php.net/bug.php?id=10151&edit=1
>
>
> Thanks on any help.
>
> -afan
>
>
> ___
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
>

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



[PHP] order of include on include()

2006-06-14 Thread blackwater dev

If I have a file:

/code/folder1/test.php

and in that file, it has these includes:

include_once("../../file1.php");
include_once("../../file2.php");
include_once("../../file3.php");


I then have another file:

/code/test2.php

That file pulls in test.php.

include_once("folder1/test.php");

Why do I get errors on the includes?  Does php first pull in the includes of
test.php before pulling it into test2.php?  It seems to be looking for the
includes in test.php from where I am in test2.php and is failing.

Thanks!


RE: [PHP] order of include on include()

2006-06-14 Thread Jay Blanchard
[snip]
Why do I get errors on the includes?  
[/snip]

Includes are included in the order of their inclusion. If an include
includes a child function (such as a class declaration) its parent must
be included first.

What error did you get? My bet is it is a path issue.

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-14 Thread BBC

I used many functions as template to change the html syntax.
this is one of the function as a sample:
function tabletag($border="0",$width="100%",$height="100%",$cellpadding = 
"0",$cellspacing="0",$style="")

{
 print ("cellspacing=\"$cellspacing\" cellpadding=\"$cellpadding\" 
style=\"$style\">");

}
?>
so I don't need to type "", just call those functions.
and I don't think it works slowly (cause we just set one function for many 
tables)


- Original Message - 
From: "Alex Major" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, June 14, 2006 10:37 AM
Subject: [PHP] Using PHP/HTML effectivly



Hi List,
   I've been (very slowly) working my way through some basic php, and
putting it into my html site. However recently (after trying things out 
such

as cookies or redirects where they have to be set before any page output)
I've found that the combination or certainly the way that I'm using php 
and

html together dosn't seem to go too well.

I have a question to you experienced PHP developers, how do you mix the
html/php together. When I've looked at things like the PHPBB forums, and
gone through files they will have absolutly no HTML, just php code. I'm 
not

sure how they manage their page styling, if anyone could explain this too
me.

At the moment I have things such as







I'm sure that I'm not doing it the best possible way, so if anyone has any
tips for me.


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



[PHP] Re: [PHP-WIN] Re: Executing External Application

2006-06-14 Thread Stut

Please include the list when replying.

[EMAIL PROTECTED] wrote:

Stut wrote:
Eww!! Eww!! and thrice EWW!! There is *never*, and I mean *never* an 
acceptable reason to run a GUI app in response to a web request - even 
on an Intranet.


*NEVER*

IMMHO
  

Bah.  Pure ignorance.
Here's one reason.  I run Apache on my PC.  I wrote a Php script that I 
run as a scheduled task to zip up a folder once a day.  I used the 
WinZip command line interface.  It will not run until I allow Apache to 
interact with the desktop.  Simple, to the point, and it works.


WinZip is a GUI app. There are lots of CLI utilities for zipping - use 
one of those! If you're doing this as a personal utility, why is Apache 
getting involved in running a PHP script as a scheduled task?


Here's another.   I have a photo gallery script written in Php that 
triggers an Irfanview slide show.  It's very efficient and simple.


Never come across Irfanview, but a quick Google reveals a GUI app for 
viewing images. How is this useful for a web-based visitor?



You're Eww, Eww, Eww and Never!! rules are just so much hot air.


Maybe in your opinion, which you are entitled to just as much as I am. 
However, IMHO web-based appplications and GUI applications should not 
mix. Ever. But that's just my opinion. If your use is not as a web 
application, but rather as a way to start processes on your local 
machine I would question why Apache needs to be involved at all.


-Stut

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



Re: [PHP] Re: [PHP-WIN] Re: Executing External Application

2006-06-14 Thread Stut

Oops, wrong list, sorry guys.

Stut wrote:

Please include the list when replying.

[EMAIL PROTECTED] wrote:

Stut wrote:
Eww!! Eww!! and thrice EWW!! There is *never*, and I mean *never* an 
acceptable reason to run a GUI app in response to a web request - 
even on an Intranet.


*NEVER*

IMMHO
  

Bah.  Pure ignorance.
Here's one reason.  I run Apache on my PC.  I wrote a Php script that 
I run as a scheduled task to zip up a folder once a day.  I used the 
WinZip command line interface.  It will not run until I allow Apache 
to interact with the desktop.  Simple, to the point, and it works.


WinZip is a GUI app. There are lots of CLI utilities for zipping - use 
one of those! If you're doing this as a personal utility, why is Apache 
getting involved in running a PHP script as a scheduled task?


Here's another.   I have a photo gallery script written in Php that 
triggers an Irfanview slide show.  It's very efficient and simple.


Never come across Irfanview, but a quick Google reveals a GUI app for 
viewing images. How is this useful for a web-based visitor?



You're Eww, Eww, Eww and Never!! rules are just so much hot air.


Maybe in your opinion, which you are entitled to just as much as I am. 
However, IMHO web-based appplications and GUI applications should not 
mix. Ever. But that's just my opinion. If your use is not as a web 
application, but rather as a way to start processes on your local 
machine I would question why Apache needs to be involved at all.


-Stut


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



Re: [PHP] Using PHP/HTML effectivly

2006-06-14 Thread Alex Major
Thankyou everyone who responded to my original message. All of your ideas
have showed me the various ways of doing it, however I believe that the idea
from Jons message is best suited to my needs. I realise the logic behind it,
its put together some knowledge I have already so I think I'll use it for
the time being. 

Thankyou for taking the time to respond to my message.

Regards, 
Alex


On 14/6/06 19:48, "Jon Anderson" <[EMAIL PROTECTED]> wrote:

> This is my opinion on the matter...
> 
>  From experience, I would say that mixing PHP and HTML together in a
> complicated page can often get very ugly. I prefer to separate out
> presentation and code into separate layers as much as possible.
> 
> I have most often used template systems such as Smarty (smarty.php.net)
> for that. I use Smarty for work - I find it quite nice. It allows you to
> separate your code from your presentation very effectively. It's easy to
> use, and provides things like caching for performance.
> 
> However, I came to the realization recently that PHP itself is
> essentially a very feature rich template system (nevermind the fact that
> it's a well defined language. ;-)
> 
> By splitting up my most recent project into includes, templates, and
> pages, I get a solution to the problem in pure PHP. In the end, code
> looks like code, and HTML looks (almost) like HTML and both are
> readable. (Same result as what Smarty gives you, without needing Smarty.)
> 
> Most pages look something like:
> 
>  include('include/data_functions.php');
> if ($condition) {
>$title = 'Here is Some Data!';
> $data = getSomeData($var1,$var2);
> } else {
>$title = 'Here is the Other Data!';
>$data = getOtherData($var1,$var2);
> }
> include('template/page.php');
> ?>
> 
> And most templates look something like:
> 
> 
> 
> ...
> 
> 
> 
>   
>   
> 
> 
> 
> ...
> Thanks for your interest in my data!
> 
> 
> jon

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



Re: [PHP] Re: [PHP-WIN] Re: Executing External Application

2006-06-14 Thread Jochem Maas
Stut wrote:
> Oops, wrong list, sorry guys.

no worries - made me laugh anyway :-)

but one worries about the one you were trying to help:

cron to run apache to run php to run a gui app.

are the loons running the nut house after all?

> 
> Stut wrote:
>> Please include the list when replying.
>>
>> [EMAIL PROTECTED] wrote:
>>> Stut wrote:
 Eww!! Eww!! and thrice EWW!! There is *never*, and I mean *never* an
 acceptable reason to run a GUI app in response to a web request -
 even on an Intranet.

 *NEVER*

 IMMHO
   
>>> Bah.  Pure ignorance.
>>> Here's one reason.  I run Apache on my PC.  I wrote a Php script that
>>> I run as a scheduled task to zip up a folder once a day.  I used the
>>> WinZip command line interface.  It will not run until I allow Apache
>>> to interact with the desktop.  Simple, to the point, and it works.
>>
>> WinZip is a GUI app. There are lots of CLI utilities for zipping - use
>> one of those! If you're doing this as a personal utility, why is
>> Apache getting involved in running a PHP script as a scheduled task?
>>
>>> Here's another.   I have a photo gallery script written in Php that
>>> triggers an Irfanview slide show.  It's very efficient and simple.
>>
>> Never come across Irfanview, but a quick Google reveals a GUI app for
>> viewing images. How is this useful for a web-based visitor?
>>
>>> You're Eww, Eww, Eww and Never!! rules are just so much hot air.
>>
>> Maybe in your opinion, which you are entitled to just as much as I am.
>> However, IMHO web-based appplications and GUI applications should not
>> mix. Ever. But that's just my opinion. If your use is not as a web
>> application, but rather as a way to start processes on your local
>> machine I would question why Apache needs to be involved at all.
>>
>> -Stut
> 

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



Re: [PHP] Re: [PHP-WIN] Re: Executing External Application

2006-06-14 Thread Stut

Jochem Maas wrote:

Stut wrote:

Oops, wrong list, sorry guys.


no worries - made me laugh anyway :-)

but one worries about the one you were trying to help:

cron to run apache to run php to run a gui app.

are the loons running the nut house after all?


Well, it was on the PHP-Windows list.

-Stut

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



[PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread afan
Am I allowde to do this:

$query = mysql_query("SELECT member_id, member_name FROM members");
while($result = mysql_fetch_array($query))
{
  if(empty($result['member_name']))
  {
mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id =
".$result['member_id']."");
  }
}

As far as I know, after "SELECT" query, data are in buffer and I AM able
to connect to the same table and do UPDATE, right?

Thanks

-afan

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



[PHP] Production release of 4.4.3 soon?

2006-06-14 Thread Paul Ellis

Greetings -

Is there any further word on the production release of PHP 4.4.3? Last I 
heard, (May 22nd) Derick Rethans had kindly put an RC (4.4.3RC1) out at 
http://downloads.php.net/derick/ and mentioned May 30th as possible date 
for production release. I haven't seen anything since that time, 
though... I'm eager to upgrade since there have been so many 
vulnerabilities reported in recent weeks. Thanks for any additional 
info. -paul


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



[PHP] Re: can I do this: update table while selecting data from table?

2006-06-14 Thread Rafael
	As far as *I* know, yes, the SELECT statement is excuted at that 
particular moment, and any further execution will be independant of your 
initial (SELECT) query.  Was there any problem?


[EMAIL PROTECTED] wrote:

Am I allowde to do this:

$query = mysql_query("SELECT member_id, member_name FROM members");
while($result = mysql_fetch_array($query))
{
  if(empty($result['member_name']))
  {
mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id =
".$result['member_id']."");
  }
}

As far as I know, after "SELECT" query, data are in buffer and I AM able
to connect to the same table and do UPDATE, right?

Thanks

-afan

--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
> Am I allowde to do this:
> 
> $query = mysql_query("SELECT member_id, member_name FROM members");
> while($result = mysql_fetch_array($query))
> {
>   if(empty($result['member_name']))
>   {
> mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id =
> ".$result['member_id']."");
>   }
> }
> 
> As far as I know, after "SELECT" query, data are in buffer and I AM able
> to connect to the same table and do UPDATE, right?

no you'll have to reboot the machine first.








seriously though, have you tried it?

that said your [probably] better off just doing 1 query:

UPDATE members SET member_name = 'N/A' WHERE member_name = '';

that said your [probably] better off leaving the name empty or setting it NULL 
if
it's unknown and showing 'N/A' in whatever output screen it's relevant for any
names that are found to be empty.

> 
> Thanks
> 
> -afan
> 

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread Satyam

It looks very much as if you did:

update members set member_name = 'N/A' where member_name = null

Nevertheless, I would rather keep null within the database and use 'N/A' at 
the presentation level. My rule is that the data in the database should 
be in a machine oriented format.  For example, I store timestamps, never 
formated dates, numbers as actual numerical datatypes, not as strings, 
though PHP can cope with either.  'N/A' is a way to present that information 
to the user, which might even be, for example, language dependant.


On displaying, you could well do:

SELECT member_id, ifnull(member_name,'N/A') FROM members

Satyam


- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, June 14, 2006 11:37 PM
Subject: [PHP] can I do this: update table while selecting data from table?



Am I allowde to do this:

$query = mysql_query("SELECT member_id, member_name FROM members");
while($result = mysql_fetch_array($query))
{
 if(empty($result['member_name']))
 {
   mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id =
".$result['member_id']."");
 }
}

As far as I know, after "SELECT" query, data are in buffer and I AM able
to connect to the same table and do UPDATE, right?

Thanks

-afan

--
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: [PHP-WIN] Re: Executing External Application

2006-06-14 Thread tedd
At 10:23 PM +0100 6/14/06, Stut wrote:
>Jochem Maas wrote:
>>Stut wrote:
>>>Oops, wrong list, sorry guys.
>>
>>no worries - made me laugh anyway :-)
>>
>>but one worries about the one you were trying to help:
>>
>>  cron to run apache to run php to run a gui app.
>>
>>are the loons running the nut house after all?
>
>Well, it was on the PHP-Windows list.
>
>-Stut

That explains it.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-14 Thread tedd
At 1:28 PM -0700 6/14/06, BBC wrote:
>I used many functions as template to change the html syntax.
>this is one of the function as a sample:
>function tabletag($border="0",$width="100%",$height="100%",$cellpadding = 
>"0",$cellspacing="0",$style="")
>{
> print (" cellspacing=\"$cellspacing\" cellpadding=\"$cellpadding\" style=\"$style\">");
>}
>?>
>so I don't need to type "", just call those functions.
>and I don't think it works slowly (cause we just set one function for many 
>tables)

BBC:

Personally, I see what you are trying to do, but I would not be going that 
route.

Like many others, I don't work in a shop where one group does php and another 
does the designing and such -- I'm just a one man band who has to do it all and 
make it work.

For me, I use php/mysql, html, js, and css all together to do stuff -- but, I 
try to keep them as separate as I can.

CSS helps a LOT because I can use simple html tags like:


...


And put the presentation code for the table in css. CSS seldom mixes with php 
and it helps reduce the amount of code I have to review. Plus, css separates 
"look" from performance (i.e., php/js/html) -- I can change one without 
worrying about the other.

Typically, the amount of html code I have is far less than php. I often roll 
html code segments (like header and footer) into php includes and keep them 
tucked away so I don't have to look at anything except:

include(header.inc);

Now, there is html code that I have to "mix" into my php and I usually separate 
it by using the method you first suggested, such as:



bunches of html code



To me, that's easy to read and I have no problem mixing stuff that way.

Occasionally, I have to "intermix" html and php together in the same statement 
such as filling text field from a dB, such as:



But, it's pretty clear that I'm using php to set what the value is in an html 
statement.

Even fewer times, but I still do, I intermix css, js, html, and php all 
together, such as:





But still, I think it's pretty clear what I'm doing. CSS takes care of how the 
button looks; js takes care of what happens when the user clicks; php provides 
something from the dB; and html is the glue that holds everything together. 
They all work in concert.

One of the things I keep in mind is when I start using a lot of escape 
characters (as you did above), then I'm not doing it the "best way" (IMO) and I 
look for another solution.

I would much rather see code

?>

...

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread afan
?!?!?!?!?!?!



> [EMAIL PROTECTED] wrote:
>> Am I allowde to do this:
>>
>> $query = mysql_query("SELECT member_id, member_name FROM members");
>> while($result = mysql_fetch_array($query))
>> {
>>   if(empty($result['member_name']))
>>   {
>> mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id
>> =
>> ".$result['member_id']."");
>>   }
>> }
>>
>> As far as I know, after "SELECT" query, data are in buffer and I AM able
>> to connect to the same table and do UPDATE, right?
>
> no you'll have to reboot the machine first.
>
>
>
>
>
>
>
>
> seriously though, have you tried it?
>
> that said your [probably] better off just doing 1 query:
>
>   UPDATE members SET member_name = 'N/A' WHERE member_name = '';
>
> that said your [probably] better off leaving the name empty or setting it
> NULL if
> it's unknown and showing 'N/A' in whatever output screen it's relevant for
> any
> names that are found to be empty.
>
>>
>> Thanks
>>
>> -afan
>>
>
> --
> 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] can I do this: update table while selecting data from table?

2006-06-14 Thread afan
No, that was just an exapmle to explain better. Of course this is not the
REAL code. :)
And there are some more thing to do inside while loop.

Thanks.

-afan


> It looks very much as if you did:
>
> update members set member_name = 'N/A' where member_name = null
>
> Nevertheless, I would rather keep null within the database and use 'N/A'
> at
> the presentation level. My rule is that the data in the database
> should
> be in a machine oriented format.  For example, I store timestamps, never
> formated dates, numbers as actual numerical datatypes, not as strings,
> though PHP can cope with either.  'N/A' is a way to present that
> information
> to the user, which might even be, for example, language dependant.
>
> On displaying, you could well do:
>
> SELECT member_id, ifnull(member_name,'N/A') FROM members
>
> Satyam
>
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: 
> Sent: Wednesday, June 14, 2006 11:37 PM
> Subject: [PHP] can I do this: update table while selecting data from
> table?
>
>
>> Am I allowde to do this:
>>
>> $query = mysql_query("SELECT member_id, member_name FROM members");
>> while($result = mysql_fetch_array($query))
>> {
>>  if(empty($result['member_name']))
>>  {
>>mysql_query("UPDATE members SET member_name = 'N/A' WHERE member_id =
>> ".$result['member_id']."");
>>  }
>> }
>>
>> As far as I know, after "SELECT" query, data are in buffer and I AM able
>> to connect to the same table and do UPDATE, right?
>>
>> Thanks
>>
>> -afan
>>
>> --
>> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] declaring a class as stdClass?

2006-06-14 Thread Larry Garfield
To answer both of you:

$var = new stdClass();

is perfectly acceptable.  I do it all the time.  The caveat is that the 
behavior is slightly different in PHP 4 than PHP 5.

In PHP 4, $var would behave exactly like an associative array, just with 
different funky characters to access its properties.  Internally, in fact, 
they're represented the same.

In PHP 5, $var would behave exactly like an associative array, EXCEPT when 
passing it as a parameter to a function.  In PHP 4, objects pass by value by 
default.  In PHP 5, they pass by reference by default.

Also, yes, casting an object to an array or vice versa is much faster than 
manually iterating it.  So:

$var = (object)array('a'=>'foo', 'b'=>'bar', 'c'=>'baz');

Is perfectly acceptable.  I've never tried casting to some other type of 
class, though.  Give it a try and let us know how it goes. :-)

On Wednesday 14 June 2006 13:26, D. Dante Lorenso wrote:
> Mariano Guadagnini wrote:
> > Hi list,
> > I hace an existencial doubt: i've seem many scripts declaring classes
> > as stdClass. In the documentation (for PHP5 and also for 4), it says
> > that this class is internal of php, and should't be used. By the
> > manner I saw it's being used, i guess that it can be handy to create a
> > 'generic' or so class, and append members when needed on the fly,
> > without the need for a formal class declaration, but i could't find
> > any good source explaining that. Has somebody some info about?
>
> Also, along the lines of this same question, I can do this in PHP very
> easily:
>
>  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' =>
> 'purple');
> $data = (object) $data;
> print_r($data);
> ?>
>
> And my object is magically created for me as an instance of stdClass.
> Is there a way to cast as some other type of class?
>
>  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' =>
> 'purple');
> $data = (MyCustomClass) $data;
> print_r($data);
> ?>
>
> I ask this because the cast in my first example, the (object) cast is
> WAY faster than using the manual approach of:
>
>  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' =>
> 'purple');
> $MYCLASS = new MyCustomClass();
> foreach ($data as $key => $value)
>$MYCLASS->$key = $value;
> }
> ?>
>
> Dante

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] Seeking recommendations for use of include()

2006-06-14 Thread Dave M G

Jochem,

::index.php



Wouldn't strip_tags() eliminate the  tags that make this possible?

--
Dave M G

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



[PHP] Simulating a POST

2006-06-14 Thread Man-wai Chang

I hit the script by http://server/netgeo.post.php?ip=192.168.1.1

But the script entered an endless loop. What's wrong?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.16.20
  ^ ^   11:47:02 up 8 days 21:30 0 users load average: 1.09 1.06 1.21
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk


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



[PHP] Simulating a POST

2006-06-14 Thread Man-wai Chang

I hit the script by http://server/haha.php?ip=192.168.1.1

But the script entered an endless loop. What's wrong?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.16.20
  ^ ^   11:48:01 up 8 days 21:31 0 users load average: 1.06 1.06 1.20
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk


http://netgeo.caida.org/perl/netgeo.cgi?target=".$ip; 
if($NetGeoFP = fopen($NetGeoURL,r))
{ 
ob_start();
fpassthru($NetGeoFP);
$NetGeoHTML = ob_get_contents();
ob_end_clean();
fclose($NetGeoFP);
}
return $NetGeoHTML;
}

if ($HTTP_POST_VARS['btnsubmit']) {
print_r(getLocationCaidaNetGeo($_POST['ip']));
} else {
?>






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

[PHP] Upgrade to PHP5 on Fedora Core

2006-06-14 Thread Dave M G

PHP List,

My hosting service allows me enough access to do things like handle my 
own upgrades and full administrative access. Usually, because I am more 
of a web designer than an server administrator, I get their support 
staff to manage upgrades and installations.


However, that does cost money, so I thought this time, if it's easy 
enough, I would try upgrading PHP myself. Currently my hosting service 
is running PHP Version 4.4.2, and I would like to upgrade to the latest 
stable build of PHP 5.


At home, I use Ubuntu LTS, and to upgrade to PHP 5 I just used apt-get 
(with the Synaptic GUI) to upgrade. It was very easy.


The hosting machine is using Fedora Core 1. I'm less familiar with Red 
Hat systems, but I do understand that yum is the equivalent of apt-get.


So, I'm hoping I can just do:

yum install php5

... and be off and running.

But because I don't really want to suffer any downtime, I hoped to get 
confirmation here on this list that this will work, and check if I need 
any other configuration options.


If it makes a difference, I'm also running MySQL 5.0 on the system, and 
Apache 2.


Is there anything else I need to know for a smooth upgrade to PHP 5?

--
Dave M G

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



[PHP] mysql + PHP

2006-06-14 Thread weetat

Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value in 
country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

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



Re: [PHP] order of include on include()

2006-06-14 Thread Richard Lynch
On Wed, June 14, 2006 3:23 pm, blackwater dev wrote:
> If I have a file:
>
> /code/folder1/test.php
>
> and in that file, it has these includes:
>
> include_once("../../file1.php");
> include_once("../../file2.php");
> include_once("../../file3.php");

../ is just gonna give you headaches, sooner or later.

Just fix your include_path and be done with it.

> I then have another file:
>
> /code/test2.php
>
> That file pulls in test.php.
>
> include_once("folder1/test.php");
>
> Why do I get errors on the includes?

I don't think include_once is THAT smart...

Or maybe it just assumes you are using include_path in a sane way and
not doing this in the first place... :-)

include and include_once have nothing to do with the current file.

They ONLY look at your include_path.

Your include_path MIGHT (and probably should, in many applications)
have '.' as one of the directories in it.

But even then, I believe '.' simply means current working directory,
so unless you are dinking around with http://php.net/chdir (which you
probably shouldn't, usually) then it's just gonna be the ONE directory
of the very first PHP file loaded, no matter where all the other files
are.

Hope that helps.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Simulating a POST

2006-06-14 Thread David Dorward
Man-wai Chang wrote:
> I hit the script by http://server/netgeo.post.php?ip=192.168.1.1
> 
> But the script entered an endless loop. What's wrong?

Either there is a bug in the script, or you put in unexpected data, or both.

(Since "server" isn't a host we can access, and since you haven't shown us
the script, that's all that can really be said).

-- 
David Dorward      
 Home is where the ~/.bashrc is

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-14 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
> ?!?!?!?!?!?!

I hope youi used str_repeat() to generate that.

>>
>> seriously though, have you tried it?
>>
>> that said your [probably] better off just doing 1 query:
>>
>>  UPDATE members SET member_name = 'N/A' WHERE member_name = '';
>>
>> that said your [probably] better off leaving the name empty or setting it
>> NULL if
>> it's unknown and showing 'N/A' in whatever output screen it's relevant for
>> any
>> names that are found to be empty.
>>
>>> Thanks
>>>
>>> -afan
>>>
>> --
>> 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] Checking for empty()

2006-06-14 Thread Richard Lynch
If you just want to disallow strings of only whitespace,
http://php.net/trim them first.

The ideal sanitization, however, lists all the characters you DO want
to allow, rather than attempting (and probably failing) to try to
consider all the ways a user might (intentionally or not) screw up.

$CLEAN['name'] = preg_replace('/[^a-z0-9\'",\\. -]/i', '?',
$_REQUEST['name'];

might be an example that would cover virtually all names.

At least for Latin1 character set languages...

You're on your own if you need Unicode and all that...

Though the above would be not much worse than attempting to render
UTF-16 as Latin1 anyway, so there ya go.

NOTE:
An Apple developer from the 80s was named 'Bo3b'
And that 3 is not a typo.
Hippie parents.
That is why I intentionally allow 0-9.
Anybody who poked around on a Fat Mac [*] will remember the hidden
files with 'bo3b' as part of their name or resource type.  Yup.  That
was him.
YMMV
NAIAA
IANAL

* Fat Mac: 128K RAM!  And you could copy Mac Floppies with only a
couple floppy swaps!  Whoo Hooo!!!  Those were the days.  Lode Runner
totally rocked, though. :-)

On Wed, June 14, 2006 1:09 pm, Ashley M. Kirchner wrote:
>
> I have a form with various fields on it that I want to make sure
> aren't empty or the user didn't just hit the space bar or return (in a
> text field).  What's the best way to do this?  Seems empty() will fail
> on a textarea if the user simply hits a space or return and submits
> the
> form.
>
> --
> W | It's not a bug - it's an undocumented feature.
>   +
>   Ashley M. Kirchner    .   303.442.6410
> x130
>   IT Director / SysAdmin / Websmith . 800.441.3873
> x130
>   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave.
> #6
>   http://www.pcraft.com . .  ..   Boulder, CO 80303,
> U.S.A.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] declaring a class as stdClass?

2006-06-14 Thread Richard Lynch
On Wed, June 14, 2006 1:08 pm, Mariano Guadagnini wrote:
> I hace an existencial doubt: i've seem many scripts declaring classes
> as
> stdClass. In the documentation (for PHP5 and also for 4), it says that
> this class is internal of php, and should't be used. By the manner I
> saw
> it's being used, i guess that it can be handy to create a 'generic' or
> so class, and append members when needed on the fly, without the need
> for a formal class declaration, but i could't find any good source
> explaining that. Has somebody some info about?

When you do:

class foo { };

I believe that, down in the guts, foo is a "subclass" of stdClass.

Now, assuming you want to be all loosy-goosy and not really hard-core
other-language purist OOP...

$foo = new stdClass;

is not really significantly different from:

class foo { }; $foo = new foo;

So, put it this way:  If your OOP inhibitions are loose enough to want
to use stdClass in the first place, and then start throwing data into
it like:

$foo->undeclared_member_variable = 42;

Then, really, I don't think using stdClass is gonna be a Big Issue,
compared to what you are already doing.

This is merely my opinion, and is not meant to reflect the Documented
Featureset, and certainly not the current direction Internals seems to
be taking with OOPurism.

Since I never actually use class (much) in the first place, I don't
really care either way. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-14 Thread Satyam

perhaps this will work:

Select country , name from tbl_chassis order by ifnull(country,'')

didn't try it.


- Original Message - 
From: "weetat" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, June 15, 2006 8:14 AM
Subject: [PHP] mysql + PHP



Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value in 
country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

--
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] declaring a class as stdClass?

2006-06-14 Thread Richard Lynch
On Wed, June 14, 2006 1:26 pm, D. Dante Lorenso wrote:
> Mariano Guadagnini wrote:
>> Hi list,
>> I hace an existencial doubt: i've seem many scripts declaring
>> classes
>> as stdClass. In the documentation (for PHP5 and also for 4), it says
>> that this class is internal of php, and should't be used. By the
>> manner I saw it's being used, i guess that it can be handy to create
>> a
>> 'generic' or so class, and append members when needed on the fly,
>> without the need for a formal class declaration, but i could't find
>> any good source explaining that. Has somebody some info about?
>
> Also, along the lines of this same question, I can do this in PHP very
> easily:
>
>  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' =>
> 'purple');
> $data = (object) $data;
> print_r($data);
> ?>
>
> And my object is magically created for me as an instance of stdClass.
> Is there a way to cast as some other type of class?
>
>  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' =>
> 'purple');
> $data = (MyCustomClass) $data;
> print_r($data);
> ?>
>
> I ask this because the cast in my first example, the (object) cast is
> WAY faster than using the manual approach of:
>
>  $data = array('apple' => 'red', 'banana' => 'yellow', 'plum' =>
> 'purple');
> $MYCLASS = new MyCustomClass();
> foreach ($data as $key => $value)
>$MYCLASS->$key = $value;
> }
> ?>

In the earliest days of PHP OOP, a class (or its instance, if you
prefer) was little more than a "glorified struct" for those of you who
know C.

So, really, typecasting from an object to an array or vice-versa,
didn't really involve much of a change.

While I am sure class/object has change a lot internally, there is
still legacy code (and dinosaur coders like me) who never quite catch
up to the "new school"

You're probably gonna see this for awhile, and unless it's a
documented backwards-compatibility breaking change, it is unlikely to
change.

And, actually, the whole SPL library seems to delight in blurring the
distinction between object/array.

Then there's the funky-ass internal DOM / XML thingie that blurs it so
badly, it breaks var_dump()... :-(

At a wild guess, there are probably 1 in a zillion legitimate lines of
code where a typecast from object to array or vice versa is Good Code,
about 10,000 places it's arguable, and (zillion - 10,000 - 1) places
where it's just an abuse of the feature.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-14 Thread Richard Lynch
On Wed, June 14, 2006 12:37 pm, Alex Major wrote:
> I've been (very slowly) working my way through some basic php, and
> putting it into my html site. However recently (after trying things
> out such
> as cookies or redirects where they have to be set before any page
> output)
> I've found that the combination or certainly the way that I'm using
> php and
> html together dosn't seem to go too well.

You have stumbled into the (unoriginal, I'm afraid) concept of
separating business logic (PHP) from presentation (HTML)

There are about a thousand sub-schools of this, including all kinds of
acronyms (MVC springs to mind).

You COULD spend the rest of your life studying and never write another
line of code...

There are also a variety of PHP "Template Libraries" (such as Smarty)
which more-or-less lead you by the nose (and sometimes force) you to
separate your Business Logic (PHP) from your Presentation (HTML).

There are also some schools of thought where *SOME* of the PHP is
actually NOT really businees logic, but is, in fact, part of the
presentation.

Consider, for example, the "simple" concept of a date.

Ignoring for the moment the various different calendaring systems, and
historical re-vampings, and sticking to the most rudimentary
representation of Unix timestamp such as that used by
http://php.net/date function...

It could be argued that, really, the decision to display:
6/15/2006 versus 15-06-2006 versus June 16, 2006, is really not
"business logic" per se, but merely a Presentation Detail.

So *some* developers prefer that the minutiae of that particular
decision not be FORCED to be in the Business Logic by some external
library attempting to separate Business Logic and HTML.

But, I digress...

> I have a question to you experienced PHP developers, how do you mix
> the
> html/php together. When I've looked at things like the PHPBB forums,
> and
> gone through files they will have absolutly no HTML, just php code.
> I'm not
> sure how they manage their page styling, if anyone could explain this
> too
> me.

Errr.  I think perhpas phpBB would not be the first place I'd send a
newbie to try and figure this out, personally...

> At the moment I have things such as
> 
>  Some php code making a page header
> ?>
> 
> 
>  Content...
> ?>
> 
>
> I'm sure that I'm not doing it the best possible way, so if anyone has
> any
> tips for me.

I would say that, in general, for a SIMPLE web application, and for a
disciplined developer (or one learning to become a disciplined
developer) it would be sufficient to do:



  


  
  
  


One implication of this is that all your header() calla, and all the
Business Logic to decide what/when to DO your header() calls, goes in
the top bit.

This then takes care of the problem of stray output making header()
calls not work.

I can guarantee that somebody on this list is going to be agahst at
this recommendation of such a crude solution -- But it has served me
well for a decade for SIMPLE WEB APPLICATIONS and is much less effort
and more maintainable simply by scale/scope of code-base for SIMPLE
WEB APPLICATIONS.

If you're attempting to write the next Google or something on that
scale, then this *IS* admittedly a horrible idea.

For a beginner, however, you'll learn a lot more, a lot faster doing
this than trying to stumble through some over-engineered monstrosity
template library.

Now I'd better really get out my flame-retardant undies.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-14 Thread weetat

hi , not working .
The empty value still sorted first.

Thanks.

Satyam wrote:

perhaps this will work:

Select country , name from tbl_chassis order by ifnull(country,'')

didn't try it.


- Original Message - From: "weetat" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, June 15, 2006 8:14 AM
Subject: [PHP] mysql + PHP



Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value 
in country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

--
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] Calculating difference between two days

2006-06-14 Thread Richard Lynch
On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote:
> I need to calculate no. of days between two dates, actually between
> date
> stored in DB and today's date.

Almost for sure your best answer is actually in your SQL engine with
something like date_subtract in MySQL.

PHP's date functions are, err, a but unwieldy...

I mean, okay, if you already have the four or five different software
packages installed, and you understand them, I'm sure it's really very
nice, but for the simple usage, for what most people need, the SQL
date-handling is generally sufficient and easier.

> Does anybody has an example I can use?

http://dev.mysql.com/ will have one if you search for date_add, almost
for sure.

-- 
Like Music?
http://l-i-e.com/artists.htm

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