OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 17 Aug 2005 18:28:20 -0000 Issue 3630

php-general-digest-helplists.php.net
Date: Wed Aug 17 2005 - 13:28:20 CDT


php-general Digest 17 Aug 2005 18:28:20 -0000 Issue 3630

Topics (messages 220730 through 220791):

Output Buffering Error? 4.3.10??
        220730 by: Joe Harman

Re: edit $variable online?
        220731 by: Mark Rees
        220767 by: André Medeiros

Re: PHP 5 limits "readfile" to 1.9 MB?
        220732 by: Catalin Trifu
        220752 by: Jordan Miller
        220761 by: Catalin Trifu
        220762 by: Jordan Miller
        220764 by: Jordan Miller
        220790 by: Rory Browne

Re: Anyone on the list using Moodle?
        220733 by: wayne
        220735 by: wayne
        220736 by: Jasper Bryant-Greene
        220740 by: wayne
        220741 by: Jasper Bryant-Greene

Re: access multiple databases
        220734 by: Mark Rees

PEAR and MSSQL
        220737 by: Chris Boget
        220750 by: tg-php.gryffyndevelopment.com
        220763 by: Michael Sims

Re: counting nested array
        220738 by: Robin Vickery
        220747 by: Ing. Josué Aranda

Re: 'God' has spoken... :-)
        220739 by: Dotan Cohen

LDAP, PHP and MS Active Directory
        220742 by: Mark Rees

Re: php 5.04 register_globals aint acting right.
        220743 by: Jochem Maas

Re: Be careful! Look at what this spammer did.
        220744 by: Rory Browne
        220765 by: Dotan Cohen
        220784 by: Greg Schnippel
        220787 by: Edward Vermillion

UML/OO/Design Pattern book recommendations?
        220745 by: Alex Gemmell
        220749 by: Marco Tabini
        220753 by: Alex Gemmell
        220757 by: Marco Tabini

run remote shell script
        220746 by: Roger Thomas
        220748 by: Matthew Weier O'Phinney

optional argument when creating a function
        220751 by: D A GERM
        220755 by: John Nichel
        220759 by: Jordan Miller
        220766 by: Matthew Weier O'Phinney
        220788 by: D A GERM

How Can I delete an Item of one array
        220754 by: Tomás Rodriguez Orta
        220756 by: John Nichel
        220758 by: Raz
        220760 by: Jordan Miller

Help correcting a form mailer problem...
        220768 by: zedleon
        220769 by: Joe Wollard

mail()
        220770 by: George B
        220771 by: John Nichel
        220772 by: Jordan Miller
        220773 by: André Medeiros
        220774 by: John Nichel
        220775 by: George B
        220776 by: George B
        220777 by: John Nichel
        220778 by: John Nichel
        220779 by: George B
        220781 by: Shaw, Chris - Accenture
        220782 by: John Nichel
        220783 by: Jay Blanchard
        220785 by: George B
        220786 by: Shaw, Chris - Accenture
        220791 by: George B

ob_start changed from php4 to php5?
        220780 by: Marten Lehmann
        220789 by: Rory Browne

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hello,

is anyone here getting an intermittent error like this one while
running output buffering?
----------------------------------------
Warning: Unexpected character in input: ' in
/*****/********/tpl.page.product.php on line 10

Parse error: parse error, unexpected T_STRING in
/*****/********/tpl.page.product.php on line 10
----------------------------------------

if I refresh the page the error goes away.... and if I shut off the
output buffering the error never occurs....

I am running PHP 4.3.10 on our server... could it be a problem that
exsisted in this version

Thanks for your help!
Joe
Harman
---------
Do not go where the path may lead, go instead where there is no path
and leave a trail. - Ralph Waldo Emerson

attached mail follows:


"Jesús Alain Rodríguez Santos" <wmastercfg.jovenclub.cu> wrote in message
news:1939.192.168.6.60.1124215951.squirrelcorreo.cfg.jovenclub.cu...
> Hi, I have in a php page one ($variable = 85), I woud like to change the
> value from this variable online, without any data base, for example ussing
> a form where I can put the new value and it change the value of the
> $variable.
>

Do you mean that you have a page like this, for example:

1.php
<?php
$variable=85;
if( $variable>85 ){
    do things;
}
?>

And you wish to permanently change the value of $variable to 86?

You could use file rewriting functions to do this. Look in the manual for
fputs, fread, fwrite and their friends.

If you wish to change the value temporarily for a single user visit
(session), use a session variable to store it. If you wish to change it for
a period of time, then perhaps consider using a class to retrieve the
variable.

>
> --
> Este mensaje ha sido analizado por MailScanner
> en busca de virus y otros contenidos peligrosos,
> y se considera que está limpio.
>

attached mail follows:


If I were you I'd have a file just to define those kind of values (ie.
config.php), wich would be included as needed.

On 8/17/05, Mark Rees <mreesitsagoodprice.com> wrote:
> "Jesús Alain Rodríguez Santos" <wmastercfg.jovenclub.cu> wrote in message
> news:1939.192.168.6.60.1124215951.squirrelcorreo.cfg.jovenclub.cu...
> > Hi, I have in a php page one ($variable = 85), I woud like to change the
> > value from this variable online, without any data base, for example ussing
> > a form where I can put the new value and it change the value of the
> > $variable.
> >
>
>
> Do you mean that you have a page like this, for example:
>
> 1.php
> <?php
> $variable=85;
> if( $variable>85 ){
> do things;
> }
> ?>
>
> And you wish to permanently change the value of $variable to 86?
>
> You could use file rewriting functions to do this. Look in the manual for
> fputs, fread, fwrite and their friends.
>
> If you wish to change the value temporarily for a single user visit
> (session), use a session variable to store it. If you wish to change it for
> a period of time, then perhaps consider using a class to retrieve the
> variable.
>
>
>
>
> >
> > --
> > Este mensaje ha sido analizado por MailScanner
> > en busca de virus y otros contenidos peligrosos,
> > y se considera que está limpio.
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


        Hi,

     I've had a similar problem. The download always stopped at exactly 2.000.000 bytes.
     You have to work around that with:
     $fp = fopen($file, 'r');
     if($fp) {
        while(!feof($fp)) {
                echo fread($fp, 1024768);//see the huge buffer to read into
        }
     } else {
        //whatever error handler
     }

Catalin

Jordan Miller wrote:
> Hello all,
>
> I am new to this list and I have searched the archives to no avail. I
> am having a peculiar problem when upgrading to PHP 5: My downloads are
> now limited to the first 1.9 MB of the file in question, with the
> download either terminating at 1.9 MB or seemingly continuously stuck
> in a downloading process at 1.9 MB. The code in the PHP script has not
> changed and all parameters that I could find that are relevant to this
> problem are given below:
>
> the minimal code needed for download:
> // $file_to_read is the complete path of the file to download
> header("Content-Type: application/pdf");
> header( "Content-Disposition: inline; filename=\"$filename\"");
> $len = filesize($file_to_read);
> header("Content-Length: $len");
> readfile($file_to_read);
>
> php.ini file for both php version 4 and 5 contain the following
> settings that may be relevant:
>
> allow_url_fopen = On
> max_execution_time = 300 ; Maximum execution time of each script,
> in seconds
> max_input_time = 300 ; Maximum amount of time each script may spend
> parsing request data
> memory_limit = 8M ; Maximum amount of memory a script may consume
> (8MB)
> post_max_size = 200M
> upload_max_filesize = 200M
>
>
> Some additional details:
> All files less than 1.9 MB download fine
> It is not a corrupted file, because all files larger than 1.9 MB fail
> after 1.9 MB
> The connection is not timing out (download of 1.9 MB takes only ~15 sec)
> Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
> Fails for both Safari and Firefox
> Fails regardless of "inline" or "attachment"
> Fails regardless of "pdf" or "ppt" content-type
> This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same
> settings, above
>
>
> What am I doing wrong??? Any other parameter in php.ini I should have
> set? Any suggestions are much appreciated.
>
> thanks,
> Jordan

attached mail follows:


Catalin,

Wow, that worked great, thanks.

I'm curious why you set a static buffer of 1024768... why not just do
filesize($file), as shown at http://www.php.net/fread ? Is it better
for memory usage to have a potentially smaller buffer? Also, you may
want an fclose($fp) after the file has been downloaded.

So is this a bug in PHP 5 or are they just purposely limiting the
abilities of the "readfile" command?

Jordan

On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:

> Hi,
>
> I've had a similar problem. The download always stopped at
> exactly 2.000.000 bytes.
> You have to work around that with:
> $fp = fopen($file, 'r');
> if($fp) {
> while(!feof($fp)) {
> echo fread($fp, 1024768);//see the huge buffer to read into
> }
> } else {
> //whatever error handler
> }
>
> Catalin
>
>
> Jordan Miller wrote:
>
>
>> Hello all,
>> I am new to this list and I have searched the archives to no
>> avail. I am having a peculiar problem when upgrading to PHP 5: My
>> downloads are now limited to the first 1.9 MB of the file in
>> question, with the download either terminating at 1.9 MB or
>> seemingly continuously stuck in a downloading process at 1.9 MB.
>> The code in the PHP script has not changed and all parameters
>> that I could find that are relevant to this problem are given below:
>> the minimal code needed for download:
>> // $file_to_read is the complete path of the file to download
>> header("Content-Type: application/pdf");
>> header( "Content-Disposition: inline; filename=\"$filename
>> \"");
>> $len = filesize($file_to_read);
>> header("Content-Length: $len");
>> readfile($file_to_read);
>> php.ini file for both php version 4 and 5 contain the following
>> settings that may be relevant:
>> allow_url_fopen = On
>> max_execution_time = 300 ; Maximum execution time of each
>> script, in seconds
>> max_input_time = 300 ; Maximum amount of time each script may
>> spend parsing request data
>> memory_limit = 8M ; Maximum amount of memory a script may
>> consume (8MB)
>> post_max_size = 200M
>> upload_max_filesize = 200M
>> Some additional details:
>> All files less than 1.9 MB download fine
>> It is not a corrupted file, because all files larger than 1.9 MB
>> fail after 1.9 MB
>> The connection is not timing out (download of 1.9 MB takes only
>> ~15 sec)
>> Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
>> Fails for both Safari and Firefox
>> Fails regardless of "inline" or "attachment"
>> Fails regardless of "pdf" or "ppt" content-type
>> This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the
>> same settings, above
>> What am I doing wrong??? Any other parameter in php.ini I should
>> have set? Any suggestions are much appreciated.
>> thanks,
>> Jordan
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>

attached mail follows:


        Hi,

     Indeed a fclose($fp) is needed (wrote it as an example :)).
     1MB is more than enough as a buffer. If you have a 53MB file,
what will happen then ?
     I have no idea if it's a bug or a feature. Either way I did lose
some hair over this when I switched from PHP4 to PHP5.

Catalin

Jordan Miller wrote:
> Catalin,
>
> Wow, that worked great, thanks.
>
> I'm curious why you set a static buffer of 1024768... why not just do
> filesize($file), as shown at http://www.php.net/fread ? Is it better
> for memory usage to have a potentially smaller buffer? Also, you may
> want an fclose($fp) after the file has been downloaded.
>
> So is this a bug in PHP 5 or are they just purposely limiting the
> abilities of the "readfile" command?
>
> Jordan
>
>
>
> On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:
>
>
>> Hi,
>>
>> I've had a similar problem. The download always stopped at
>> exactly 2.000.000 bytes.
>> You have to work around that with:
>> $fp = fopen($file, 'r');
>> if($fp) {
>> while(!feof($fp)) {
>> echo fread($fp, 1024768);//see the huge buffer to read into
>> }
>> } else {
>> //whatever error handler
>> }
>>
>> Catalin
>>
>>
>> Jordan Miller wrote:
>>
>>
>>> Hello all,
>>> I am new to this list and I have searched the archives to no avail.
>>> I am having a peculiar problem when upgrading to PHP 5: My
>>> downloads are now limited to the first 1.9 MB of the file in
>>> question, with the download either terminating at 1.9 MB or
>>> seemingly continuously stuck in a downloading process at 1.9 MB.
>>> The code in the PHP script has not changed and all parameters that
>>> I could find that are relevant to this problem are given below:
>>> the minimal code needed for download:
>>> // $file_to_read is the complete path of the file to download
>>> header("Content-Type: application/pdf");
>>> header( "Content-Disposition: inline; filename=\"$filename \"");
>>> $len = filesize($file_to_read);
>>> header("Content-Length: $len");
>>> readfile($file_to_read);
>>> php.ini file for both php version 4 and 5 contain the following
>>> settings that may be relevant:
>>> allow_url_fopen = On
>>> max_execution_time = 300 ; Maximum execution time of each
>>> script, in seconds
>>> max_input_time = 300 ; Maximum amount of time each script may
>>> spend parsing request data
>>> memory_limit = 8M ; Maximum amount of memory a script may
>>> consume (8MB)
>>> post_max_size = 200M
>>> upload_max_filesize = 200M
>>> Some additional details:
>>> All files less than 1.9 MB download fine
>>> It is not a corrupted file, because all files larger than 1.9 MB
>>> fail after 1.9 MB
>>> The connection is not timing out (download of 1.9 MB takes only ~15
>>> sec)
>>> Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
>>> Fails for both Safari and Firefox
>>> Fails regardless of "inline" or "attachment"
>>> Fails regardless of "pdf" or "ppt" content-type
>>> This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the
>>> same settings, above
>>> What am I doing wrong??? Any other parameter in php.ini I should
>>> have set? Any suggestions are much appreciated.
>>> thanks,
>>> Jordan
>>>
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>>

attached mail follows:


Ok, just checking (I am new to the fopen() function). That makes
sense. Awesome, thanks!

Jordan

On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote:

> Hi,
>
> Indeed a fclose($fp) is needed (wrote it as an example :)).
> 1MB is more than enough as a buffer. If you have a 53MB file,
> what will happen then ?
> I have no idea if it's a bug or a feature. Either way I did lose
> some hair over this when I switched from PHP4 to PHP5.
>
> Catalin
>
>
> Jordan Miller wrote:
>
>> Catalin,
>> Wow, that worked great, thanks.
>> I'm curious why you set a static buffer of 1024768... why not just
>> do filesize($file), as shown at http://www.php.net/fread ? Is it
>> better for memory usage to have a potentially smaller buffer?
>> Also, you may want an fclose($fp) after the file has been
>> downloaded.
>> So is this a bug in PHP 5 or are they just purposely limiting the
>> abilities of the "readfile" command?
>> Jordan
>> On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:
>>
>>> Hi,
>>>
>>> I've had a similar problem. The download always stopped at
>>> exactly 2.000.000 bytes.
>>> You have to work around that with:
>>> $fp = fopen($file, 'r');
>>> if($fp) {
>>> while(!feof($fp)) {
>>> echo fread($fp, 1024768);//see the huge buffer to read into
>>> }
>>> } else {
>>> //whatever error handler
>>> }
>>>
>>> Catalin
>>>
>>>
>>> Jordan Miller wrote:
>>>
>>>
>>>
>>>> Hello all,
>>>> I am new to this list and I have searched the archives to no
>>>> avail. I am having a peculiar problem when upgrading to PHP 5:
>>>> My downloads are now limited to the first 1.9 MB of the file
>>>> in question, with the download either terminating at 1.9 MB
>>>> or seemingly continuously stuck in a downloading process at
>>>> 1.9 MB. The code in the PHP script has not changed and all
>>>> parameters that I could find that are relevant to this problem
>>>> are given below:
>>>> the minimal code needed for download:
>>>> // $file_to_read is the complete path of the file to
>>>> download
>>>> header("Content-Type: application/pdf");
>>>> header( "Content-Disposition: inline; filename=
>>>> \"$filename \"");
>>>> $len = filesize($file_to_read);
>>>> header("Content-Length: $len");
>>>> readfile($file_to_read);
>>>> php.ini file for both php version 4 and 5 contain the
>>>> following settings that may be relevant:
>>>> allow_url_fopen = On
>>>> max_execution_time = 300 ; Maximum execution time of each
>>>> script, in seconds
>>>> max_input_time = 300 ; Maximum amount of time each script
>>>> may spend parsing request data
>>>> memory_limit = 8M ; Maximum amount of memory a script may
>>>> consume (8MB)
>>>> post_max_size = 200M
>>>> upload_max_filesize = 200M
>>>> Some additional details:
>>>> All files less than 1.9 MB download fine
>>>> It is not a corrupted file, because all files larger than 1.9
>>>> MB fail after 1.9 MB
>>>> The connection is not timing out (download of 1.9 MB takes only
>>>> ~15 sec)
>>>> Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
>>>> Fails for both Safari and Firefox
>>>> Fails regardless of "inline" or "attachment"
>>>> Fails regardless of "pdf" or "ppt" content-type
>>>> This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with
>>>> the same settings, above
>>>> What am I doing wrong??? Any other parameter in php.ini I
>>>> should have set? Any suggestions are much appreciated.
>>>> thanks,
>>>> Jordan
>>>>
>>>>
>>>>
>>>
>>> --
>>> 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
>
>
>
>

attached mail follows:


turns out it's a known bug, fixed in CVS already... haven't tried the
PHP 5.1 beta release yet.

http://bugs.php.net/bug.php?id=32970

On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote:

> Hi,
>
> Indeed a fclose($fp) is needed (wrote it as an example :)).
> 1MB is more than enough as a buffer. If you have a 53MB file,
> what will happen then ?
> I have no idea if it's a bug or a feature. Either way I did lose
> some hair over this when I switched from PHP4 to PHP5.
>
> Catalin
>
>
> Jordan Miller wrote:
>
>> Catalin,
>> Wow, that worked great, thanks.
>> I'm curious why you set a static buffer of 1024768... why not just
>> do filesize($file), as shown at http://www.php.net/fread ? Is it
>> better for memory usage to have a potentially smaller buffer?
>> Also, you may want an fclose($fp) after the file has been
>> downloaded.
>> So is this a bug in PHP 5 or are they just purposely limiting the
>> abilities of the "readfile" command?
>> Jordan
>> On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:
>>
>>> Hi,
>>>
>>> I've had a similar problem. The download always stopped at
>>> exactly 2.000.000 bytes.
>>> You have to work around that with:
>>> $fp = fopen($file, 'r');
>>> if($fp) {
>>> while(!feof($fp)) {
>>> echo fread($fp, 1024768);//see the huge buffer to read into
>>> }
>>> } else {
>>> //whatever error handler
>>> }
>>>
>>> Catalin
>>>
>>>
>>> Jordan Miller wrote:
>>>
>>>
>>>
>>>> Hello all,
>>>> I am new to this list and I have searched the archives to no
>>>> avail. I am having a peculiar problem when upgrading to PHP 5:
>>>> My downloads are now limited to the first 1.9 MB of the file
>>>> in question, with the download either terminating at 1.9 MB
>>>> or seemingly continuously stuck in a downloading process at
>>>> 1.9 MB. The code in the PHP script has not changed and all
>>>> parameters that I could find that are relevant to this problem
>>>> are given below:
>>>> the minimal code needed for download:
>>>> // $file_to_read is the complete path of the file to
>>>> download
>>>> header("Content-Type: application/pdf");
>>>> header( "Content-Disposition: inline; filename=
>>>> \"$filename \"");
>>>> $len = filesize($file_to_read);
>>>> header("Content-Length: $len");
>>>> readfile($file_to_read);
>>>> php.ini file for both php version 4 and 5 contain the
>>>> following settings that may be relevant:
>>>> allow_url_fopen = On
>>>> max_execution_time = 300 ; Maximum execution time of each
>>>> script, in seconds
>>>> max_input_time = 300 ; Maximum amount of time each script
>>>> may spend parsing request data
>>>> memory_limit = 8M ; Maximum amount of memory a script may
>>>> consume (8MB)
>>>> post_max_size = 200M
>>>> upload_max_filesize = 200M
>>>> Some additional details:
>>>> All files less than 1.9 MB download fine
>>>> It is not a corrupted file, because all files larger than 1.9
>>>> MB fail after 1.9 MB
>>>> The connection is not timing out (download of 1.9 MB takes only
>>>> ~15 sec)
>>>> Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
>>>> Fails for both Safari and Firefox
>>>> Fails regardless of "inline" or "attachment"
>>>> Fails regardless of "pdf" or "ppt" content-type
>>>> This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with
>>>> the same settings, above
>>>> What am I doing wrong??? Any other parameter in php.ini I
>>>> should have set? Any suggestions are much appreciated.
>>>> thanks,
>>>> Jordan
>>>>
>>>>
>>>>
>>>
>>> --
>>> 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
>
>
>
>

attached mail follows:


Just for your information there was a topic on this a few months ago.

It definately wasn't intentional - Rasmus didn't know about it until then.

On 8/17/05, Jordan Miller <jmilhymiegladstone.com> wrote:
> turns out it's a known bug, fixed in CVS already... haven't tried the
> PHP 5.1 beta release yet.
>
> http://bugs.php.net/bug.php?id=32970
>
>
>
> On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote:
>
> > Hi,
> >
> > Indeed a fclose($fp) is needed (wrote it as an example :)).
> > 1MB is more than enough as a buffer. If you have a 53MB file,
> > what will happen then ?
> > I have no idea if it's a bug or a feature. Either way I did lose
> > some hair over this when I switched from PHP4 to PHP5.
> >
> > Catalin
> >
> >
> > Jordan Miller wrote:
> >
> >> Catalin,
> >> Wow, that worked great, thanks.
> >> I'm curious why you set a static buffer of 1024768... why not just
> >> do filesize($file), as shown at http://www.php.net/fread ? Is it
> >> better for memory usage to have a potentially smaller buffer?
> >> Also, you may want an fclose($fp) after the file has been
> >> downloaded.
> >> So is this a bug in PHP 5 or are they just purposely limiting the
> >> abilities of the "readfile" command?
> >> Jordan
> >> On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:
> >>
> >>> Hi,
> >>>
> >>> I've had a similar problem. The download always stopped at
> >>> exactly 2.000.000 bytes.
> >>> You have to work around that with:
> >>> $fp = fopen($file, 'r');
> >>> if($fp) {
> >>> while(!feof($fp)) {
> >>> echo fread($fp, 1024768);//see the huge buffer to read into
> >>> }
> >>> } else {
> >>> //whatever error handler
> >>> }
> >>>
> >>> Catalin
> >>>
> >>>
> >>> Jordan Miller wrote:
> >>>
> >>>
> >>>
> >>>> Hello all,
> >>>> I am new to this list and I have searched the archives to no
> >>>> avail. I am having a peculiar problem when upgrading to PHP 5:
> >>>> My downloads are now limited to the first 1.9 MB of the file
> >>>> in question, with the download either terminating at 1.9 MB
> >>>> or seemingly continuously stuck in a downloading process at
> >>>> 1.9 MB. The code in the PHP script has not changed and all
> >>>> parameters that I could find that are relevant to this problem
> >>>> are given below:
> >>>> the minimal code needed for download:
> >>>> // $file_to_read is the complete path of the file to
> >>>> download
> >>>> header("Content-Type: application/pdf");
> >>>> header( "Content-Disposition: inline; filename=
> >>>> \"$filename \"");
> >>>> $len = filesize($file_to_read);
> >>>> header("Content-Length: $len");
> >>>> readfile($file_to_read);
> >>>> php.ini file for both php version 4 and 5 contain the
> >>>> following settings that may be relevant:
> >>>> allow_url_fopen = On
> >>>> max_execution_time = 300 ; Maximum execution time of each
> >>>> script, in seconds
> >>>> max_input_time = 300 ; Maximum amount of time each script
> >>>> may spend parsing request data
> >>>> memory_limit = 8M ; Maximum amount of memory a script may
> >>>> consume (8MB)
> >>>> post_max_size = 200M
> >>>> upload_max_filesize = 200M
> >>>> Some additional details:
> >>>> All files less than 1.9 MB download fine
> >>>> It is not a corrupted file, because all files larger than 1.9
> >>>> MB fail after 1.9 MB
> >>>> The connection is not timing out (download of 1.9 MB takes only
> >>>> ~15 sec)
> >>>> Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
> >>>> Fails for both Safari and Firefox
> >>>> Fails regardless of "inline" or "attachment"
> >>>> Fails regardless of "pdf" or "ppt" content-type
> >>>> This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with
> >>>> the same settings, above
> >>>> What am I doing wrong??? Any other parameter in php.ini I
> >>>> should have set? Any suggestions are much appreciated.
> >>>> thanks,
> >>>> Jordan
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> 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
>
>

attached mail follows:


On Tue, 2005-08-16 at 17:41 -0400, wayne wrote:
> Hi,
> Before I post some of the install script for
> Moodle I thought that I would ask how
> $CFG gets instantiated in the install.php script.
> Thanks.
>
Attach is the first 85 line of the moodle install
script.What I would like to know is, if I put
some code like this after the use of $CFG->

$default_classes = get_declared_classes ();
print "<br>" . "THE BEGINNING = ";
  foreach ($default_classes as $class_name)
     print 'the class is ==' . $class_name . '<br />';

shouldn't I see the class that $CFG was instantiated
from?
Thanks.

attached mail follows:


On Tue, 2005-08-16 at 17:41 -0400, wayne wrote:
> Hi,
> Before I post some of the install script for
> Moodle I thought that I would ask how
> $CFG gets instantiated in the install.php script.
> Thanks.
>
Okay, I got a reply from a moodle user pointing
me to an archive, apparently someone had the same
question. The answer seems to be that $CFG is
an array dressed up as an object.The books that
I'm learning from don't show this concept. Could
some kind soul give an example.
Thanks.

attached mail follows:


wayne wrote:
> Okay, I got a reply from a moodle user pointing
> me to an archive, apparently someone had the same
> question. The answer seems to be that $CFG is
> an array dressed up as an object.The books that
> I'm learning from don't show this concept. Could
> some kind soul give an example.
> Thanks.

http://php.net/manual/en/language.types.object.php

When you use the uninitialised $CFG as an object, an object of class
stdClass is created. You can then assign and read stuff to and from its
properties, basically like you said, as an "array dressed up as an object".

There's no real reason for doing this although it may be a hack because
some of the required files in that script may expect a $CFG object to exist.

Jasper

attached mail follows:


On Wed, 2005-08-17 at 04:47 -0400, wayne wrote:
> On Tue, 2005-08-16 at 17:41 -0400, wayne wrote:
> > Hi,
> > Before I post some of the install script for
> > Moodle I thought that I would ask how
> > $CFG gets instantiated in the install.php script.
> > Thanks.
> >
> Okay, I got a reply from a moodle user pointing
> me to an archive, apparently someone had the same
> question. The answer seems to be that $CFG is
> an array dressed up as an object.The books that
> I'm learning from don't show this concept. Could
> some kind soul give an example.
> Thanks.
>
I have one other question that I would like answered.
One of the respondents in the archive file to the
above question said that "in PHP objects don't
have to be explicitly instantiated", could someone
point me to some docs that explains this.The person
never did give an explanation.
Thanks

attached mail follows:


wayne wrote:
> I have one other question that I would like answered.
> One of the respondents in the archive file to the
> above question said that "in PHP objects don't
> have to be explicitly instantiated", could someone
> point me to some docs that explains this.The person
> never did give an explanation.

The post I just sent to the list regarding your earlier question
explains this. If you do not instantiate an object before using it, it
is automatically instantiated as an object of the stdClass class. You
can then add and read attributes, like an "array dressed up as an object."

Jasper

attached mail follows:


"Bing Du" <du_binghotmail.com> wrote in message
news:3A.99.33075.C7552034pb1.pair.com...
> Hi,
>
> I need to access both MySQL and SQL server 2000 in a PHP script on RHEL
> 3. In phpinfo(), I noticed 'supported databases' shows 'MySQL ODBC
> PostgreSQL Microsoft SQL Server FrontBase Oracle 8 (oci8)'. And
> 'Configure Command' has '--with-unixODBC=shared' included. Do I need to
> install anything else, like iodbc?
>

Have you uncommented

extension=php_mssql.dll

in php.ini?

Are you having any specific problems or error messages?

> Would anybody give me some guidance how I should start from here?
>
> Thanks,
>
> Bing

attached mail follows:


We are using PEAR as our database abstraction layer for connectivity to
MSSQL. It seems that, for some inexplicable reason, that our code is
losing it's connection to the sql server.
 
We have a section of our site where users can come in and fill out a
form
to get an insurance quote. Once the form is submitted, there is quite a
lot of back end database processing, both read and write, which is
happening
against the same set of tables for every submission. If just a few
people
access the site at the same time and submit the form concurrently,
things
are alright. But once more people start doing so, it seems to cause the
sql server to hang. In the middle of the process, one of the users will
run
a query which causes a problem (and it's not the same every time) and
in the middle of the process for the other users, when it goes to try to

connect to the database again (via one of the class' that are getting
instantiated and executed as part of the overall process), PEAR returns
an error saying there is no database selected. The DSN has the correct
data and it works when there are fewer users, but for some reason it
says
that the db has not been selected.
 
So it seems that the cause of that error is in the connect method of the
mssql class. We are using persistent connections but for some reason
when it goes to try to execute the mssql_pconnect it seems as if the
connection PHP has to MSSQL has been severed? But whatever has
happened, the only resolution to the problem is restarting apache. As
soon as we restart apache, everything starts working again (for the most
part). Though, if multiple users go in again and submit the form, PEAR
returns that same error (no database selected), the system then hangs
and an apache restart is again required.
 
I've gone through all of our code and for the life of me I cannot figure
out
what might be causing the connection to sever in such a way. As far as
I can tell, we aren't leaving any open transactions (though, the
symptoms
seem to indicate that may be the root cause?) and we really aren't doing
anything funky with regards to the queries we are running against the
database
(other than the sheer number of queries - the application requires
*alot*
of database processing). So I'm wondering if anyone else has run up
against a problem similar to this.
 
We've run this test against 3 different servers and the exact same thing
(as described above) happens on all 3.
 
Server 1 specs:
Windows 2000
Apache 2.0.53
PHP 4.3.8
MSSQL Server 2000 Enterprise SP3
 
Server 2 specs:
Windows 2003
Apache 2.0.53
PHP 4.3.11
MSSQL Server 2000 Enterprise SP4
 
Server 3 specs:
Windows 2003
Apache 2.0.53
PHP 4.3.11
MSSQL Server 2000 Enterprise SP4
 
Any help, suggestions or ideas at all would be very appreciated and most
welcome!
 
thnx,
Chris

attached mail follows:


Date: Wed, 17 Aug 2005 10:50:20 -0400
To: <php-generallists.php.net>
From: <tg-phpgryffyndevelopment.com>
CC: <chris.bogetwild.net>
Message-Id: <E1E5PHB-00045S-23www11.dixiesys.com>
Subject: Re: [PHP] PEAR and MSSQL

Without wading through all the code and queries it might be difficult to give you an exact answer, but maybe some of us can point out a 'gotcha' or two that you can check.

One that jumps to mind that I had issues with using ADODB (abstraction layer), and it was mostly with speed but I could see it causing other issues, is connecting and disconnecting from the database too much.

Here's some pseudo code:

Bad -

foreach $insertlist as $insertdata {
  dbconnect();
  dbinsert($insertdata);
  dbdisconnect();
}

Good -

dbconnect();
foreach $insertlist as $insertdata {
  dbinsert($insertdata);
}
dbdisconnect();

I was doing it inadvertantly because of the way I had things structured and my use of includes and such. Once I figured out that was causing a LOT of slowdown, I was able to do just one connect and disconnect in a script with lots of insert, update, select, etc statements in the middle.

It's possible for a database to reach max # connections and such. If you have a lot of people hammering at a system at once, you may not be closing the connection properly and/or creating too many connections. SQL Server should handle a lot, but even it has it's limits.

A random factoid about SQL Server.. and I don't remember the specifics, but if you use IDENTITY (?) to grab the last inserted ID, you'll get the last inserted ID for any user, not just the the current user who just did an insert. I believe you use INDENTITY (double sign) to specify the current user's last insert.

Some of our developers at my last job had an issue with hitting the wrong ID (on a trigger I believe it was) and causing a mess. I could see where something like that could cause a script to go nuts. Just a (probably unrelated) 'gotcha' when it comes to SQL Server.

I'm sure someone else has some snakebites they can share :)

-TG

= = = Original message = =
We are using PEAR as our database abstraction layer for connectivity to
MSSQL. It seems that, for some inexplicable reason, that our code is
losing it's connection to the sql server.
 
We have a section of our site where users can come in and fill out a
form to get an insurance quote. Once the form is submitted, there is quite a
lot of back end database processing, both read and write, which is
happening against the same set of tables for every submission. If just a few
people access the site at the same time and submit the form concurrently,
things are alright. But once more people start doing so, it seems to cause the
sql server to hang. In the middle of the process, one of the users will
run a query which causes a problem (and it's not the same every time) and
in the middle of the process for the other users, when it goes to try to

connect to the database again (via one of the class' that are getting
instantiated and executed as part of the overall process), PEAR returns
an error saying there is no database selected. The DSN has the correct
data and it works when there are fewer users, but for some reason it
says that the db has not been selected.
 
So it seems that the cause of that error is in the connect method of the
mssql class. We are using persistent connections but for some reason
when it goes to try to execute the mssql_pconnect it seems as if the
connection PHP has to MSSQL has been severed? But whatever has
happened, the only resolution to the problem is restarting apache. As
soon as we restart apache, everything starts working again (for the most
part). Though, if multiple users go in again and submit the form, PEAR
returns that same error (no database selected), the system then hangs
and an apache restart is again required.
 
I've gone through all of our code and for the life of me I cannot figure
out what might be causing the connection to sever in such a way. As far as
I can tell, we aren't leaving any open transactions (though, the
symptoms seem to indicate that may be the root cause?) and we really aren't doing
anything funky with regards to the queries we are running against the
database (other than the sheer number of queries - the application requires
*alot* of database processing). So I'm wondering if anyone else has run up
against a problem similar to this.
 
We've run this test against 3 different servers and the exact same thing
(as described above) happens on all 3.
 
Server 1 specs:
Windows 2000
Apache 2.0.53
PHP 4.3.8
MSSQL Server 2000 Enterprise SP3
 
Server 2 specs:
Windows 2003
Apache 2.0.53
PHP 4.3.11
MSSQL Server 2000 Enterprise SP4
 
Server 3 specs:
Windows 2003
Apache 2.0.53
PHP 4.3.11
MSSQL Server 2000 Enterprise SP4
 
Any help, suggestions or ideas at all would be very appreciated and most
welcome!
 
thnx,
Chris

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

attached mail follows:


Chris Boget wrote:
> We are using PEAR as our database abstraction layer for connectivity
> to MSSQL. It seems that, for some inexplicable reason, that our code
> is losing it's connection to the sql server.

I've had similar problems in the past, only in my situation it was connecting from a
Linux machine to MSSQL via FreeTDS. However, from your description it seems like
our problems MIGHT have the same root cause. I would suggest that you try the
following:

(1) Disable persistent connections. This is just my own personal experience, but
I've never been able to get PHP's persistent connection mechanism to work reliably,
at least with MSSQL. My experience is that it causes intermittent problems which
all seem to indicate that the connections eventually become unreliable or unusable,
and the persistent connection code doesn't seem to be able to recover from this
situation gracefully. At least with normal connections you don't have to worry
about a problem with one request persisting to the next.

(2) MSSQL Server seems to have a problem with applications that open many
connections in rapid succession. Disabling persistent connections will exacerbate
this problem, as a connection will be opened for each request. It seems these
problems are caused, at least in part, by SQL server limiting the number of incoming
connections it will queue up. This behavior can be controlled by adjusting MSSQL's
WinsockListenBacklog setting. The default setting is 5, which means that the server
will queue up a maximum of 5 incoming connections. The server will then reset any
new connections that come in as long as the queue is full. In my situation, I
adjusted this value to 10, and this had a HUGE affect. We still have problems from
time to time, but now they are very rare and they could probably be eliminated
completely by adjusting this number even higher, I just haven't gotten around to
doing that yet.

For more information on how to adjust the WinsockListenBacklog setting, see these MS
knowledgebase articles:

http://support.microsoft.com/default.aspx?kbid=328476
http://support.microsoft.com/kb/154628/EN-US/

The following PHP bug reports seem to be related to this:

http://bugs.php.net/bug.php?id=19541
http://bugs.php.net/bug.php?id=29074

Try disabling persistent connections and adjusting the WinsockListenBacklog to 10
and see what results you get.

HTH

attached mail follows:


On 8/17/05, Ing. Josué Aranda <josuearandagmail.com> wrote:
> OK this the little function i made to solve this..
>
> function countNested($array){
> foreach($array as $value){
> if(is_array($value))
> $total=$this->countNested($value)+$total;
> }else{
> $total=$total+1;
> }
> }
> return $total;
> }

Looks OK-ish - there's a missing '{' on the third line but apart from
that it should work fine as a class method.
 
> any optimizations are welcome....

You can simplify the if-block as below, which might save you as much
as a microsecond or two :-)

   function countNested($array){
      $total = 0;
       foreach ($array as $value) {
           $total += is_array($value) ? $this->countNested($value) : 1;
       }
       return $total;
   }

attached mail follows:


hahaha, thanks robin you save some seconds of mi life... it looks more
"pro" with that if...

On 8/17/05, Robin Vickery <robinvgmail.com> wrote:
> On 8/17/05, Ing. Josué Aranda <josuearandagmail.com> wrote:
> > OK this the little function i made to solve this..
> >
> > function countNested($array){
> > foreach($array as $value){
> > if(is_array($value))
> > $total=$this->countNested($value)+$total;
> > }else{
> > $total=$total+1;
> > }
> > }
> > return $total;
> > }
>
> Looks OK-ish - there's a missing '{' on the third line but apart from
> that it should work fine as a class method.
>
> > any optimizations are welcome....
>
> You can simplify the if-block as below, which might save you as much
> as a microsecond or two :-)
>
> function countNested($array){
> $total = 0;
> foreach ($array as $value) {
> $total += is_array($value) ? $this->countNested($value) : 1;
> }
> return $total;
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
____________________

JOSUE ARANDA>>>

attached mail follows:


On 8/15/05, Miles Thompson <milesallnovascotia.com> wrote:
> The problem with PHP 5 is that the ISP's have to be so conservative.
> There's no tagging mechanism which says "process these files with PHP5, use
> PHP 4 for everything else."
>

Does anyone here remember that on php 3 the file extensions were
.php3? That made moving to php4 easy- files ending in .php3 was parsed
as 3, and files ending in .php were parsed as 4. Why not do something
similar when moving to 5 or 6?

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/118/chumbawamba.php
Chumbawamba Song Lyrics

attached mail follows:


Apologies if this turns out to be a cross-post. I sent it to the list
evolt, but have seen no traffic on that list for two days now.

-------------------------------------------

Hello

I am using PHP v5 to write an intranet. The site is hosted on a windows 2000
server running Apache. I want to incorporate some form of Windows
authentication to allow or deny access to given resources based on usernames
and group membership.

I am trying to accomplish this using LDAP. I am able to connect and bind to
our Active Directory server (also Windows 2000) from PHP, but when I want to
perform a search, I need to know what the base record is. This is in the
format o=my company, c=the country it is in.

This is where the problem lies. How do I find out this information? Is there
some facility in Active Directory that allows me to see what the actual
name-values are for all the records (like sn=rees)?

The line of code causing the problem is this: $ds is a bound connection to
the LDAP server
$sr=ldap_search($ds, "o=company name, c=uk", "sn=g*");

It returns "Operations error"

Thanks in advance

Mark

--
www.itsagoodprice.com - top-brand electronics for less.

attached mail follows:


Daniel Baughman wrote:
> Its simply a Boolean to indicate whether or not a query should be ran and
> displayed, and further more its for a small intranet.
>
> Register_globals is the directive I meant to say. But your right about
> globals. Some applications haven't made that change yet... So unless I want
> to rewrite them (which is time consuming if you didn't originally write the
> thing) I need to enable it.

stick this in a auto_prepend_file (or at the top of a global include:

<?

extract($_REQUEST);

?>

crude, but not exactly a rewrite.

>
> I have the directive in my php.ini, which is defaulted to the %systemdir% in
> windows... But it certainly isn't registering them... I can easily write an
> include and stick in to mimic the behaviour.. but was wondering if anyone
> else ran into these issues.

probably the php.ini you are editing is not the same as the file php is using
to determine its config.

>
> -----Original Message-----
> From: Jochem Maas [mailto:jochemiamjochem.com]
> Sent: Tuesday, August 16, 2005 7:27 AM
> To: Daniel Baughman
> Cc: php-generallists.php.net
> Subject: Re: [PHP] php 5.04 register_globals aint acting right.
>
>
> Daniel Baughman wrote:
>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> I have register globals enabled, or set to "On". Isn't this suppose to
>>take all of the $_POST variables and $_GET variables and make initialize
>>them by name?
>
>
> register_globals should do that. but not "register globals",
> regardless is a shitty setting. don't use it. besides its depreciated
> just use $_POST['whatever']
>
>
>>i.e. $_POST['runquery'] will be accessible via simply $runquery
>
>
> looks like you are stuffing SQL into a GET/POST param - sure you want to do
> that?
>
>
>
>
>>??
>>
>>
>>Dan Baughman
>>IT Technician
>>Professional Bull Riders, Inc.
>>719-471-3008 x 3161
>>
>>CONFIDENTIAL, FOR DESIGNATED RECIPIENTS ONLY: The preceding e-mail
>
> message
>
>>(including any attachments) contains information that may be confidential,
>>privileged, or non-public information. It is intended to be conveyed only
>
> to
>
>>the designated recipient(s) named above. If you are not an intended
>>recipient, please notify the sender by replying to this message and then
>>delete all copies of it from your computer system. Any use, dissemination,
>>distribution, or reproduction of this message by unintended recipients is
>>not authorized and may be unlawful. DISCLAIMER OF ELECTRONIC TRANSACTION:
>
>
>>This communication does not reflect an intention by the sender to conduct
>
> a
>
>>transaction or make any agreement by electronic means. Nothing contained
>>herein shall constitute an electronic signature or a contract under any
>
> law,
>
>>rule or regulation applicable to electronic transactions.
>>
>>
>>
>
>

attached mail follows:


Can you explain exactly what he tried to do. I should probably be able
to figure this out, but I'm not feeling too well today.

He modded his message to put different email addresses into the
message field using mime headers?

On 8/16/05, Dotan Cohen <dotancohengmail.com> wrote:
> I have a form that my visitors can email me from. Some jerk is trying
> to fool the mail() function into sending his spam, and I got this
> today:
> <start asshole code>
> ejmxmdmxhdotancohen.com
> Content-Type: multipart/mixed; boundary=\"===============0110030565==\"
> MIME-Version: 1.0
> Subject: 7510b460
> To: ejmxmdmxhdotancohen.com
> bcc: bergkoch8aol.com
> From: ejmxmdmxhdotancohen.com
>
> This is a multi-part message in MIME format.
>
> --===============0110030565==
> Content-Type: text/plain; charset=\"us-ascii\"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
>
> blrt
> --===============0110030565==--
> </start asshole code>
>
> I just updated the code to stop this. I think that if anybody else has
> a form that goes to the mail() function, they should learn from this
> email and put up some code to block it.
>
> Dotan Cohen
> http://lyricslist.com/lyrics/artist_albums/367/n_sync.php
> N Sync Song Lyrics
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On 8/17/05, Rory Browne <rory.brownegmail.com> wrote:
> Can you explain exactly what he tried to do. I should probably be able
> to figure this out, but I'm not feeling too well today.
>
> He modded his message to put different email addresses into the
> message field using mime headers?
>

I'll reply soon off list, as I don't think it appropriate to give
potential spammers an archive full of new tricks.

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/373/newton-john_olivia.php
Newton-John, Olivia Song Lyrics

attached mail follows:


> I'll reply soon off list, as I don't think it appropriate to give
> potential spammers an archive full of new tricks.

I don't know -- I think its always better to discuss this in the open
if there is a real security risk that people should be aware of.

A couple days after your posting to PHP-General, I saw the same kind
of probe on my system:

<begin clueless code>
Content-Type: multipart/mixed; boundary="===============0493326424=="
MIME-Version: 1.0
Subject: c3b8e7fc
To: wmlhlkgyre.org
bcc: bergkoch8aol.com
From: wmlhlkgyre.org

This is a multi-part message in MIME format.

--===============0493326424==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

awhvtr
--===============0493326424==--
</end clueless code>

This was submitted through a simple web contact form with a message,
subject, and body form fields. The hakor submitted the above as the
body of the message 3-4 times than seemed to give up (although he did
send a few obnoxious threats). I don't believe this did anything
because

1) I never got a bounce message from the made-up address he attempted
to send to ("wmlhlkgyre.org")

2) I believe that since the mail function already sent out the
headers, any subsequent "headers" would just be ignored. Or they would
be treated as text since they occurred in the message portion and not
parsed literally.

Not sure that there is any risk here, but I'm shrouding my contact
script (changing the form variables and script name to something less
obvious) just in case.

- Greg

attached mail follows:


Greg Schnippel wrote:
>>I'll reply soon off list, as I don't think it appropriate to give
>>potential spammers an archive full of new tricks.
>
>
> I don't know -- I think its always better to discuss this in the open
> if there is a real security risk that people should be aware of.
>

I tend to agree on things like this. If it's a generic problem then I
think it does everyone some good to discuss it in the open. Although I
can see the point of not discussing specific problems with specific
applications, at least not until a fix is in and notices have been sent
out. Then I think it falls back to the "it does everyone some good to
have it in the open" senerio. I learn a lot from my mistakes, but I also
learn from other's mistakes too, if I'm given the chance.

> 2) I believe that since the mail function already sent out the
> headers, any subsequent "headers" would just be ignored. Or they would
> be treated as text since they occurred in the message portion and not
> parsed literally.
>

I was wondering the same thing. That it would just send the message and
the MTA's would ignore any other addresses listed in the actual message
text.

> Not sure that there is any risk here, but I'm shrouding my contact
> script (changing the form variables and script name to something less
> obvious) just in case.
>
> - Greg
>

I think I'm just going to generate some random number to submit to the
processor and if it's not there then ignore it.

attached mail follows:


Hello all!

I am readjusting my brain from years of procedural programming and I'm
rapidly improving my ability to program object-oriented PHP. I'm no
expert but I am keen to get my hands on as much good teaching material
as I can.

I already have a good appreciation for OO concepts BUT I often tie
myself in knots (code myself into a corner) because I don't know how to
plan my OO projects "correctly".

Can anyone recommend some books that describe:
- how to plan OO projects (PHP specific would be good but isn't necessary)
- how to use UML (is UML what I am after?)
- OO design patterns for web applications

Thanks for helping me become a better programmer!

Alex

attached mail follows:


Hello Alex

On 8/17/05 9:33 AM, "Alex Gemmell" <agemmellgmail.com> wrote:

> Can anyone recommend some books that describe:
> - how to plan OO projects (PHP specific would be good but isn't necessary)

http://www.amazon.com/exec/obidos/tg/detail/-/1590593804/qid=1124289801/sr=8
-4/ref=pd_bbs_4/103-9475507-6895034?v=glance&s=books&n=507846

> - OO design patterns for web applications

http://www.phparch.com/shop_product.php?itemid=96

(disclaimer: I work for the company that published this book).

HTH,

Marco

>
> Thanks for helping me become a better programmer!
>
> Alex

attached mail follows:


Blimey! I'm not a regular to these lists so I certainly didn't expect
replies from two names I recognise and respect from my years of
trawling the internet for valuable PHP and CSS information!

The books you both recommend look like exactly what I am after, with
the slight caveat that I am actually using PHP4 at work and these
books seem to focus on PHP5. I appreciate the real improvements PHP5
has over PHP4 with regards to OO but I have been a little hesitant to
make the leap. Perhaps now I will do so.

I've also been toying with a subscription to PHP Architect since it
first came out. It felt a bit to advanced for me back then but maybe
now I'm ready for it. Congrats Marco - I think you've bagged a new
subscriber!

(I've had StyleMaster for a short while now so you've already done
your work John!)

Thanks John and Marco for your swift replies, I'll be sure to check
out those books.

Alex

On 17/08/05, Marco Tabini <marcottabini.ca> wrote:
> Hello Alex
>
> On 8/17/05 9:33 AM, "Alex Gemmell" <agemmellgmail.com> wrote:
>
> > Can anyone recommend some books that describe:
> > - how to plan OO projects (PHP specific would be good but isn't necessary)
>
> http://www.amazon.com/exec/obidos/tg/detail/-/1590593804/qid=1124289801/sr=8
> -4/ref=pd_bbs_4/103-9475507-6895034?v=glance&s=books&n=507846
>
> > - OO design patterns for web applications
>
> http://www.phparch.com/shop_product.php?itemid=96
>
> (disclaimer: I work for the company that published this book).
>
> HTH,
>
>
> Marco
>
> >
> > Thanks for helping me become a better programmer!
> >
> > Alex
>
>
>
>

--
Alex Gemmell
|:| agemmellgmail.com |:|

attached mail follows:


On 8/17/05 11:08 AM, "Alex Gemmell" <agemmellgmail.com> wrote:

> Blimey! I'm not a regular to these lists so I certainly didn't expect
> replies from two names I recognise and respect from my years of
> trawling the internet for valuable PHP and CSS information!

:)
 
> The books you both recommend look like exactly what I am after, with
> the slight caveat that I am actually using PHP4 at work and these
> books seem to focus on PHP5. I appreciate the real improvements PHP5
> has over PHP4 with regards to OO but I have been a little hesitant to
> make the leap. Perhaps now I will do so.

I really think you ought to take a look at PHP 5 -- I used it for my latest
project (I'll admit that I only did so because the project was an experiment
and I had nothing to lose, but I'm happy I did anyway) and it made a big
difference, well beyond the OOP stuff.

Incidentally, Jason's book on Design Patterns covers *both* PHP 4 and PHP 5
(when appropriate, there is code for both versions, and the differences in
implementations are explained).
 
> I've also been toying with a subscription to PHP Architect since it
> first came out. It felt a bit to advanced for me back then but maybe
> now I'm ready for it. Congrats Marco - I think you've bagged a new
> subscriber!

Thanks :)

Cheers,

Marco

attached mail follows:


My PHP script is in svrA. How do I run a shell script in svrB?
svrB does not have PHP and Apache :(
Is this at all possible? Please advise.

--
Roger

---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

attached mail follows:


* Roger Thomas <sniperhome.net.my>:
> My PHP script is in svrA. How do I run a shell script in svrB?
> svrB does not have PHP and Apache :(
> Is this at all possible? Please advise.

Use ssh. You will have to setup remote key authentication from svrA to
svrB (so that a password will not be needed), and then in your script
you would call:

    system('ssh svrB /path/to/scriptToRun');

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

attached mail follows:


I'm throwing a warning on a function I created. I
thought a & in front of the argument was supposed to
make it optional. Is there something else I need to do
make that argument optional?

<CODE>
//I simplified the code
function doEmail($username, &$link)
{
   if (isset($link))
   {
      print "$link $username";
   }
   else
   {
      print "$username";
   }
}

doEmail($arg1);
doEmail($arg1, $arg2);
</CODE>

Here is the error:
Warning: Missing argument 2 for doemail() in
/srv/www/htdocs/test-a/staff/email_scramble.php on
line 24

thanks in advance for any help.

--
D. Aaron Germ
Scarborough Library, Shepherd University
(304) 876-5423

"Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy)

attached mail follows:


D A GERM wrote:
> I'm throwing a warning on a function I created. I
> thought a & in front of the argument was supposed to
> make it optional. Is there something else I need to do
> make that argument optional?

The ampersand does not make it optional. It passes it by reference...
http://us2.php.net/manual/en/language.references.php

> <CODE>
> //I simplified the code
> function doEmail($username, &$link)
> {
> if (isset($link))
> {
> print "$link $username";
> }
> else
> {
> print "$username";
> }
> }
>
> doEmail($arg1);
> doEmail($arg1, $arg2);
> </CODE>
>
> Here is the error:
> Warning: Missing argument 2 for doemail() in
> /srv/www/htdocs/test-a/staff/email_scramble.php on
> line 24

To make the second variable optional, give it a value in the argument
list when defining the function...

function doEmail ( $username, $link = NULL ) {

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


apparently the ampersand means to treat $link as a reference, not as
an optional argument:
http://www.softwareprojects.org/php-functions-12.htm

I think the way to do it would be to set a default value in your
function so that if a value is set by the calling statement that
would override it:

function doEmail($username, $link = false)
{
     if ($link !=== false)
     {
         // "doEmail($arg1, $arg2);" gets sent here
         print "$link $username";
     }
     else
     {
         // "doEmail($arg1);" gets sent here
         print "$username";
     }
}

haven't tested this, but give it a try.

Jordan

On Aug 17, 2005, at 10:00 AM, D A GERM wrote:

> I'm throwing a warning on a function I created. I
> thought a & in front of the argument was supposed to
> make it optional. Is there something else I need to do
> make that argument optional?
>
> <CODE>
> //I simplified the code
> function doEmail($username, &$link)
> {
> if (isset($link))
> {
> print "$link $username";
> }
> else
> {
> print "$username";
> }
> }
>
> doEmail($arg1);
> doEmail($arg1, $arg2);
> </CODE>
>
> Here is the error:
> Warning: Missing argument 2 for doemail() in
> /srv/www/htdocs/test-a/staff/email_scramble.php on
> line 24
>
> thanks in advance for any help.
>
> --
> D. Aaron Germ
> Scarborough Library, Shepherd University
> (304) 876-5423
>
> "Well then what am I supposed to do with all my creative ideas-
> take a bath and wash myself with them? 'Cause that is what soap is
> for" (Peter, Family Guy)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>

attached mail follows:


* D A GERM <dgermshepherd.edu>:
> I'm throwing a warning on a function I created. I
> thought a & in front of the argument was supposed to
> make it optional. Is there something else I need to do
> make that argument optional?

As others have noted, the ampersand tells the function to grab a
reference to the variable passed.

There are two ways to do optional arguments:

1) Set a default value for the argument (must be last argument in the
   list, or else all other arguments in the list must also have default
   values):

   function doEmail($username, $link = null) {}
   function doEmail($username, $link = null, $linkName = '') {}

2) Parse the argument list via the func_* functions:

   function doEmail($username)
   {
       $argCount = func_num_args();
       if (1 < $argCount) {
           // Retrieve second argument, from a 0-based array:
           $link = func_get_arg(1);
       }
       ...
   }

   function doEmail($username)
   {
       $argCount = func_num_args();
       if (1 < $argCount) {
           // Retrieve all arguments
           $args = func_get_args();
           
           // Remove $username from it
           array_shift($args);

           // Get $link:
           $link = array_shift($args);
       }
       ...
   }

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

attached mail follows:


Thank you everyone for your help.

I tried this and it worked with throwing any errors.

<CODE>
function doEmail($username, $link = null)
</CODE>

Matthew Weier O'Phinney wrote:

>* D A GERM <dgermshepherd.edu>:
>
>
>>I'm throwing a warning on a function I created. I
>>thought a & in front of the argument was supposed to
>>make it optional. Is there something else I need to do
>>make that argument optional?
>>
>>
>
>As others have noted, the ampersand tells the function to grab a
>reference to the variable passed.
>
>There are two ways to do optional arguments:
>
>1) Set a default value for the argument (must be last argument in the
> list, or else all other arguments in the list must also have default
> values):
>
> function doEmail($username, $link = null) {}
> function doEmail($username, $link = null, $linkName = '') {}
>
>2) Parse the argument list via the func_* functions:
>
> function doEmail($username)
> {
> $argCount = func_num_args();
> if (1 < $argCount) {
> // Retrieve second argument, from a 0-based array:
> $link = func_get_arg(1);
> }
> ...
> }
>
> function doEmail($username)
> {
> $argCount = func_num_args();
> if (1 < $argCount) {
> // Retrieve all arguments
> $args = func_get_args();
>
> // Remove $username from it
> array_shift($args);
>
> // Get $link:
> $link = array_shift($args);
> }
> ...
> }
>
>
>
>

--
D. Aaron Germ
Scarborough Library, Shepherd University
(304) 876-5423

"Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy)

attached mail follows:


Hi people.

How Can I do this.
I want to delete an element behind of array?, what function What Can I use?

best regards TOMAS

-------------------------------------------------------------------------
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia.

attached mail follows:


Message-ID: <43035477.9090406kegworks.com>
Date: Wed, 17 Aug 2005 11:15:03 -0400
From: John Nichel <johnkegworks.com>
MIME-Version: 1.0
To: php-generallists.php.net
Content-Type: text/plain; charset=ISO-8859-1; formatowed
Content-Transfer-Encoding: 8bit
Subject: Re: [PHP] How Can I delete an Item of one array

Tomás Rodriguez Orta wrote:
> Hi people.
>
> How Can I do this.
> I want to delete an element behind of array?, what function What Can I use?

The last element in the array?
http://us2.php.net/manual/en/function.array-pop.php

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


> I want to delete an element behind of array?, what function What Can I use?

Do you mean remove the last member of an array? If so check out
array_pop() at www.php.net

raz

attached mail follows:


you use the unset() function:

unset($array[$key]); // http://www.php.net/unset

you can reindex the keys if they are numeric with:

$reindexedArray = array_values($array); // http://www.php.net/
array_values

Jordan

On Aug 17, 2005, at 1:12 PM, Tomás Rodriguez Orta wrote:

> Hi people.
>
> How Can I do this.
> I want to delete an element behind of array?, what function What
> Can I use?
>
> best regards TOMAS
>
>
> ----------------------------------------------------------------------
> ---
> Este correo fue escaneado en busca de virus con el MDaemon
> Antivirus 2.27
> en el dominio de correo angerona.cult.cu y no se encontro ninguna
> coincidencia.

attached mail follows:


I previously built a sticky form with dynamic checkbox array's.........
The form works beautifully thanks to help from Jochem Mass and Kathleen
Ballard.

I now have a slightly different problem...I have built an email form to send
the form data.
I copied and used the following code which works great in the sticky
form.....

if (isset($_POST['gmev']) && is_array($_POST['gmev'])) {

   foreach ($_POST['gmev'] as $gmev_day) {

   print "<p>You have registered for the: <b>$gmev_day</b> Good Morning East
Valley Event.</p>";
}

} else {

   print 'You are not registered for any events!';

}

The results is this:
           "You have registered for the: September 9th Good Morning East
Valley Event."

Now when I use the