RE: [PHP] Sorting arrays
-Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 1:52 AM To: Jake McHenry; 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sorting arrays
Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sorting arrays
-Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona The user doesn't even have to hit back, each time the form is submitted, the data is rearranged in opposite order. Too keep my data together, here is what the data in the arrays looks like: Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Then, in my script, after the new data is merged with the existing array, I sort: $array = $_SESSION['Air_Reservations']; sort($array) New output: Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) See now? I didn't add a new record this time, but it happens with our without adding anything new. Each time the array is sorted, this happens. Thanks, Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting arrays
Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 1:52 AM To: Jake McHenry; 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com This is very strange. sort() ALWAYS sorts the same way when you call it the same way, period. Perhaps you're not sorting on the correct data? Could you please show us exactly what your arrays look like, which sort function you are using, and how you're calling it? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where to get PHP manual?
I tried downloading the manual @ php.net but it just don't seems to connect. It keeps loading for a very long time. Is there any other place I can get or any kind soul that can send it to my email? [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting arrays
Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona The user doesn't even have to hit back, each time the form is submitted, the data is rearranged in opposite order. Too keep my data together, here is what the data in the arrays looks like: Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Then, in my script, after the new data is merged with the existing array, I sort: $array = $_SESSION['Air_Reservations']; sort($array) New output: Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) See now? I didn't add a new record this time, but it happens with our without adding anything new. Each time the array is sorted, this happens. Thanks, Jake It may be that because those are strings they are being sorted strangely. I have two suggestions. 1) Use a sub-associative array or an object for those entries. Delimited strings are ok, but actual structures are generally better. 2) use usort() and specify a function which sorts those dates correctly (sorting those won't sort by year, only month). OR you could convert those dates to UNIX timstamps (with strtotime() possibly) and sort them that way (this may also require using usort()). Try making an array with ONLY dates in it (not the extra info) and see if it sorts those correctly. One more thing: how are you passing these values between pages? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sorting arrays
-Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 1:52 AM To: Jake McHenry; 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com This is very strange. sort() ALWAYS sorts the same way when you call it the same way, period. Perhaps you're not sorting on the correct data? Could you please show us exactly what your arrays look like, which sort function you are using, and how you're calling it? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I just tried switching to natsort and it still does the same thing. I just posted the array structure, here they are again: First time natsort($array) returns Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) Second time natsort($array) returns Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Nothing has changed in the array, but the order. Why does this stuff always happen to me? lol Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sorting arrays
-Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona The user doesn't even have to hit back, each time the form is submitted, the data is rearranged in opposite order. Too keep my data together, here is what the data in the arrays looks like: Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Then, in my script, after the new data is merged with the existing array, I sort: $array = $_SESSION['Air_Reservations']; sort($array) New output: Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) See now? I didn't add a new record this time, but it happens with our without adding anything new. Each time the array is sorted, this happens. Thanks, Jake It may be that because those are strings they are being sorted strangely. I have two suggestions. 1) Use a sub-associative array or an object for those entries. Delimited strings are ok, but actual structures are generally better. 2) use usort() and specify a function which sorts those dates correctly (sorting those won't sort by year, only month). OR you could convert those dates to UNIX timstamps (with strtotime() possibly) and sort them that way (this may also require using usort()). Try making an array with ONLY dates in it (not the extra info) and see if it sorts those correctly. One more thing: how are you passing these values between pages? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The data is being passed via POST arrays, then I'm taking the POST data, running through a foreach loop, and creating the string, then putting
RE: [PHP] Sorting arrays
-Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona The user doesn't even have to hit back, each time the form is submitted, the data is rearranged in opposite order. Too keep my data together, here is what the data in the arrays looks like: Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Then, in my script, after the new data is merged with the existing array, I sort: $array = $_SESSION['Air_Reservations']; sort($array) New output: Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) See now? I didn't add a new record this time, but it happens with our without adding anything new. Each time the array is sorted, this happens. Thanks, Jake It may be that because those are strings they are being sorted strangely. I have two suggestions. 1) Use a sub-associative array or an object for those entries. Delimited strings are ok, but actual structures are generally better. 2) use usort() and specify a function which sorts those dates correctly (sorting those won't sort by year, only month). OR you could convert those dates to UNIX timstamps (with strtotime() possibly) and sort them that way (this may also require using usort()). Try making an array with ONLY dates in it (not the extra info) and see if it sorts those correctly. One more thing: how are you passing these values between pages? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Ok, built the test array, here's the code and results: foreach ($_POST['Change_Date'] as $key = $value) { $build =
RE: [PHP] Sorting arrays
-Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 3:14 AM To: 'Justin Patrin' Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona The user doesn't even have to hit back, each time the form is submitted, the data is rearranged in opposite order. Too keep my data together, here is what the data in the arrays looks like: Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Then, in my script, after the new data is merged with the existing array, I sort: $array = $_SESSION['Air_Reservations']; sort($array) New output: Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) See now? I didn't add a new record this time, but it happens with our without adding anything new. Each time the array is sorted, this happens. Thanks, Jake It may be that because those are strings they are being sorted strangely. I have two suggestions. 1) Use a sub-associative array or an object for those entries. Delimited strings are ok, but actual structures are generally better. 2) use usort() and specify a function which sorts those dates correctly (sorting those won't sort by year, only month). OR you could convert those dates to UNIX timstamps (with strtotime() possibly) and sort them that way (this may also require using usort()). Try making an array with ONLY dates in it (not the extra info) and
RE: [PHP] Sorting arrays [SOLVED I THINK]
-Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 3:14 AM To: 'Justin Patrin' Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending order instead of ascending as it was the first time around. The arrays contain dates, and I want them in ascending order. Is there a way to limit any of the sort routines to ascending only? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page is for adding / editing / removing airline reservations. What I have done so far is when the user first gets to this specific page, they enter their info. If they put a check in the add next flight checkbox, then the same form comes up again, each time adding the new info to the same array, building upon the old info. The arrays are then displayed back into form fields where the user can edit any info submitted. I'm sorting the arrays by the flight dates. Each time the user enters a new flight, the array is sorted by date. This is where I'm seeing the problem. The first flight is fine, of course. The second is fine. The third flight entered and all of the flights are now in reverse order. Then the next flight entered, they're all in the correct order, etc, etc. This problem will most likely happen to my other arrays further on in the project. Is there any way I can make sure that the dates are always in the correct order? I'm pretty confused so user puts information into form, he/she submits it, and you have 1 date, he press back button, fill the same form again submits form, new date is added and it's in correct order, he/she does it for the third and it's in reverse order, he/she does it for the fourth and it's in correct order... funny... could you paste here the sorting part of code? Brona The user doesn't even have to hit back, each time the form is submitted, the data is rearranged in opposite order. Too keep my data together, here is what the data in the arrays looks like: Array ( [0] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes [1] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [2] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [3] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [4] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [5] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No ) Then, in my script, after the new data is merged with the existing array, I sort: $array = $_SESSION['Air_Reservations']; sort($array) New output: Array ( [0] = 02-11-2004|Salt Lake|UT|Wilkes-Barre|PA||No|No [1] = 01-23-2004|Salem|WA|Wilkes-Barre|PA||No|No [2] = 01-08-2004|Denver|CO|Wilkes-Barre|PA||No|No [3] = 01-02-2004|Wilkes-Barre|PA|Denver|CO||Yes|Yes [4] = 01-16-2004|Wilkes-Barre|PA|Salem|WA||Yes|Yes [5] = 01-30-2004|Wilkes-Barre|PA|Salt Lake|UT||Yes|Yes ) See now? I didn't add a new record this time, but it happens with our without adding anything new. Each time the array is sorted, this happens. Thanks, Jake It may be that because those are strings they are being sorted strangely. I have two suggestions. 1) Use a sub-associative array or an object for those entries. Delimited strings are ok, but actual structures are generally better. 2) use usort() and specify a function which sorts those dates correctly (sorting those won't sort by year, only month). OR you could convert those dates to UNIX timstamps (with strtotime() possibly) and sort them that way (this may also require using usort()). Try making an array with ONLY dates in it (not the extra info) and
Re: [PHP] session_start() make netscape 4.7 reload page.
Jonathan Zhang wrote: test.php -- ? session_start(); ? form input type=text name=test /form For Win2kpro+netscape 4.7,all form data you enter in this page will lost when resize the browser's window size, ns4.7 have reload this page when resize the window. But if you remove the session_start() from this page, the issue will not exist. I use Win2kpro+netscape 7.1, resizing the window can keep the input data. I don't have netscape 4.7 installed, so can not test it. Perhaps there is some bug in it. You may update Netscape to 7.1 for a lasy solution. Best Bao Is there any solution for it? thanks, Jonathan Zhang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: What would the best way to veladate a URL string?
On Sat, Dec 13, 2003 at 08:17:08PM -0500, Paul Chvostek wrote: Validate? How about something like: eregi('^(f|ht)tp://([a-z0-9._:-]+@)?([a-z0-9][a-z0-9-]+\.)+[a-z][a-z]+(/([a-z0-9.%=-]+)?)?',$string); I like it, but I would start with '^(ftp|gttp|https):...' People could be using SSL. -- Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start() make netscape 4.7 reload page.
Jonathan Zhang wrote: test.php -- ? session_start(); ? form input type=text name=test /form For Win2kpro+netscape 4.7,all form data you enter in this page will lost when resize the browser's window size, ns4.7 have reload this page when resize the window. But if you remove the session_start() from this page, the issue will not exist. Is there any solution for it? thanks, Jonathan Zhang Netscape 4.x has this annoying behavior, it tries to fetch a fresh copy whenever you resize window, view source code or print the page. You might try to use session_cache_limiter() function to control the cache headers send, try private_no_expire first. Do not set it to public if the page contains private information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE?
Mike wrote: if you are using windows, I would highlt recommend PHPEdit, it is open source and has function completion. It boosts productivity a lot http://www.phpedit.net/products/PHPEdit/ Mike Not that good. IIRC, all the error messages and the prompts are in German, one need to guess which button should press if you don't know the very language. Best Bao On Sat, 2003-12-13 at 17:06, Jough Jeaux wrote: Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. --Jough -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Operation in an Array
How can i make an operation like adding variables in an array for example $array[$a+$b]; Thanks Harry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP IDE?
Jough Jeaux [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. If you are going to work with templates, you can take a look at TemplateTamer, which has IDE geared for such development. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] e-commerce with php
Hi! I don't know anything about e-commerce. I want to build a e-commerce site with php-mysql. So i have turorial for this idea. Can you help me about it? i know php and mysql but i dont have any information about ssl, e-commerce, paying with credit card. thank you very much! you can send me online document as attachment. or you can send me an adress or etc. _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with install
ok, Just installed PHP with Xitami, with Apache 1.3 AND 2. I've used PHP versions 4.33 and 4.3.4. I'm running Windows XP, mucking around with some pages that came with my Web Programming book, most of the php pages work, but anything involving sessions, forms and cookies etc just doesn't work. Anyone any pages that they know work that I can try, so I can figure out what the problem is? Should they work, even though the PHP code is actually quite old? (the version that came with the book is 4.0.3) The stuff works ok under 4.0.3, but I need the functionality of the latest version for some stuff on my Uni course... Anyone able to help me, or point me in the right direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php compile error with mysql undefined reference to `mysql_real_escape_string'
Hi all! I'm installing php4.3.3, apache 1.3.28 with mysql3.22.32 I'm using this option --with-mysql=/usr/local/mysql But when I compile the php code, I get this error: ext/mysql/php_mysql.o: In function `zif_mysql_client_encoding': /root/fuente/archivos/php-4.3.3/ext/mysql/php_mysql.c:1118: undefined reference to `mysql_character_set_name' ext/mysql/php_mysql.o: In function `zif_mysql_real_escape_string': /root/fuente/archivos/php-4.3.3/ext/mysql/php_mysql.c:1705: undefined reference to `mysql_real_escape_string' collect2: ld returned 1 exit status To solve it..I try the option --disable-cli on ./configure, and all ok. But now I have the same problem (/php-4.3.3/ext/mysql/php_mysql.c:1118: undefined reference to `mysql_character_set_name') when I try to compile the apache... Please!!! Does anybody know how to solve it? Thanks in advance!! __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trouble parsing an XML document
Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-ORIG'}; // here is the broblem function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE?
Not that good. IIRC, all the error messages and the prompts are in German, one need to guess which button should press if you don't know the very language. They were all in english last time I used it (which was a while ago) Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
doesn't look like a xml parser problem. I haven't tried your code but i think the error is $this-$k alfredo wrote: Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-ORIG'}; // here is the broblem function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE?
with folding you can fold your code in chunks, you basically setup a start fold and an end fold and place code between them, then you can open and close (fold) that block of code as you need to or don't need to see it... for example: # {{{ PHP Code to do something... .. .. 1 lines of code... .. .. # }}} would collapse to one line when folded and look something like: + PHP Code to do something then when you hit space on it it expands. (I use {{{ and }}} as my start and end folds) ctags allows you to build a dictionary of words which you can hook into vim, that way you can do tab completion on PHP words etc. I also like to map keystrokes to coding templates for things like functions, loops, declarations etc. Everyone's got their own setup :) Plus I always use a CVS repository for my work, so my routine of, code, test, commit is habit. Looking at the responses there seems to be a lot of neat editors out there, to each his own. regards, Ahbaid. Jough Jeaux wrote: Hmm, I'm currently a vim user also. You'll have to elaborate on this folding and ctag business though... --- Ahbaid Gaffoor [EMAIL PROTECTED] wrote: vim - with folding and ctags sweet. Ahbaid Jough Jeaux wrote: Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. --Jough __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/
Re: [PHP] Where to get PHP manual?
--- Johnny Koh [EMAIL PROTECTED] wrote: I tried downloading the manual @ php.net but it just don't seems to connect. It keeps loading for a very long time. Is there any other place I can get or any kind soul that can send it to my email? Try one of the mirrors. They might work for you: Argentina ar.php.net Datahost Argentina ar2.php.net XMundo Network Solutions Armenia Armenia am.php.net Matenadaran Research Institute Australia Australia au.php.net Planet Mirror au2.php.net Ilisys Web Hosting Ltd. au3.php.net AusGamers Austria Austria at.php.net Goodie Domain Service at2.php.net netmonic - your personal isp Belgium Belgium be.php.net Easynet BE be2.php.net BELNET - Belgian Research Network Bolivia Bolivia bo.php.net MEGALINK Bosnia and Herzegovina Bosnia and Herzegovina ba.php.net SARNET, University Computer Center, Banja Luka Brazil Brazil br.php.net HostNet Internet br2.php.net Digirati Internet Bulgaria Bulgaria bg.php.net Bulgaria Online bg2.php.net Data.BG Canada Canada ca.php.net easyDNS ca2.php.net Acta Divina Peer1 Networks ca3.php.net egateDOMAINS Chile Chile cl.php.net Caos Consultores cl2.php.net TECNOERA China China cn.php.net China GNU/Linux Forum cn2.php.net Network Information Center of Beijing Polytechnic University Colombia Colombia co.php.net Universidad del Cauca Costa Rica Costa Rica cr.php.net Corp. Hostarica S.A. cr2.php.net Universidad Latina de Costa Rica Croatia Croatia hr.php.net Croatian Linux User Group Czech Republic Czech Republic cz.php.net InWay, a.s. cz2.php.net Czech Technical University Denmark Denmark dk.php.net Børsen Online dk2.php.net WebPartner A/S Estonia Estonia ee.php.net OK Interactive ee2.php.net Northside Solutions Finland Finland fi.php.net Mediatraffic Oy fi2.php.net Tietokonepalvelu Mikrolahti France France fr.php.net nexen.net fr2.php.net Crihan fr3.php.net WorldAKT.com Germany Germany de.php.net @GLOBE GmbH de2.php.net nic4you.de de3.php.net Schlund + Partner Greece Greece gr2.php.net ACE-Hellas S.A. Hong Kong Hong Kong hk.php.net inframatrix internet solutions hk2.php.net daPyxis Network Limited Hungary Hungary hu.php.net PHPhost.hu Iceland Iceland is.php.net Linux, Iceland is2.php.net RHnet India India in.php.net Directi Web Hosting in2.php.net Directi Web Hosting Indonesia Indonesia id.php.net a3plusmedia.NET Iran Iran ir.php.net Morva System Co. Ireland Ireland ie.php.net Esat Net ie2.php.net TIBUS Israel Israel il.php.net Fresh.co.il il2.php.net NSA Internet Security, Ltd. Italy Italy it.php.net Open Technology Consulting it2.php.net Italia OnLine S.p.a. Japan Japan jp.php.net HappySize, Inc. jp2.php.net snotch Latvia Latvia lv.php.net DEAC Liechtenstein Liechtenstein li.php.net Lie-Comtel li2.php.net Digi-Technik Partners Lithuania Lithuania lt.php.net Alternatyvus Valdymas lt2.php.net Vilnius University, Faculty of Communications Luxembourg Luxembourg lu.php.net root eSolutions ISP Malaysia Malaysia my.php.net MyBSD Malaysia Project Mexico Mexico mx.php.net uServers Mexico Netherlands Netherlands nl.php.net WEBtic Internet Consultancy nl2.php.net TrueServer nl3.php.net Nederland.net New Zealand New Zealand nz.php.net EXPIO Communications nz2.php.net InSPire Net Ltd Norway Norway no.php.net Overture Services Norway no2.php.net Key2Network Poland Poland pl.php.net MainSeek.com pl2.php.net eStrefa.pl Portugal Portugal pt.php.net Telepac pt2.php.net PTM.COM Republic of Korea Republic of Korea kr.php.net HolyNet kr2.php.net LSN Romania Romania ro.php.net LASTING System ro2.php.net VipNET Russian Federation Russian Federation ru.php.net Direct Internet ru2.php.net Cronyx Plus LLC ru3.php.net tsuren.net Singapore Singapore sg.php.net ezNetworking Solutions Pte. Ltd. Slovakia Slovakia sk.php.net Bentel sk2.php.net Mediate s.r.o. Slovenia Slovenia si.php.net INSiDE Racunalnistvo si2.php.net Oxxus Hosting South Africa South Africa za.php.net CSIR Mikomtek za2.php.net Rhodes University Computer Users Society Spain Spain es.php.net GRN Serveis Telematics es2.php.net RedIRIS Sweden Sweden se.php.net Chalmers Lindholmen se2.php.net Burken.NU Switzerland Switzerland ch.php.net Laboratoire de Bases de Données ch2.php.net benscom.com Ltd. Taiwan Taiwan tw.php.net TIENTI tw2.php.net National Chiao-Tung University Thailand Thailand th.php.net THAIWEB.network Turkey Turkey tr.php.net Bilkent Sunsite tr2.php.net proGEN Internet ve Bilisim Teknolojileri Ukraine Ukraine ua.php.net PACOnet ua2.php.net Max Khaikin United Kingdom United Kingdom uk.php.net Kewlio.net Limited uk2.php.net Camel Network Yugoslavia Yugoslavia yu.php.net Astrahosting Inc Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to get PHP manual?
Johnny -- ...and then Johnny Koh said... % % I tried downloading the manual @ php.net but it just don't seems to connect. % It keeps loading for a very long time. It will take a while, all right; even loading it locally as a single HTML file it takes quite a bit to load 8M. % % Is there any other place I can get or any kind soul that can send it to my % email? [EMAIL PROTECTED] It gzips down to a bit under 1.5M; if the mirrors don't work for you, let me know and I'll send you a copy. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] Sort flags
Hi all, quick question. Whenever I try putting any flags with the any of the sort functions, I get this error: Warning: Wrong parameter count for natsort() in /var/www/secure/travelrequest/handler.php on line 950 My sort call looks like this: natsort($array, SORT_STRING); Running PHP v. 4.2.2-17.2 w/ apache v. 2.0.40-21.5 Any ideas? Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Email Forwarders
It is not a php issue, it is more a configuration issue for your mail server, most of them use the .forward file to manage email forwarding. You can use the file functions (http://uk.php.net/manual/en/ref.filesystem.php) to read and write this file. It should be fairly simple. Start with ?php echo file_get_contents(/home/yourname/.forward); ? then read and write this file (it should contain your forwards already), assuming they are using sendmail like email server You may have read/write permission errors, depending on how the server was configured. Mike Matt Palermo wrote: I have a hosted website which uses CPanel. I can login to CPanel and create as many email forwarders as I want. Is there a way I can write a PHP script to manage these email forwarders? For example, somebody registers on my site and they want to be added to the for a certain email address (as an email forwarder). How would I write a script that could access this email forwarders file and insert a new address to it (or delete one if that is the case)? Does anyone know if this can be done. I am trying to use these mail forwarders as a moch mailing list, so when an email is sent to a specific address, it will automatically be distributed to everyone on the forwarding list. Please help if you have any ideas or suggestions. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sort flags
Jake McHenry wrote: Hi all, quick question. Whenever I try putting any flags with the any of the sort functions, I get this error: Warning: Wrong parameter count for natsort() in /var/www/secure/travelrequest/handler.php on line 950 My sort call looks like this: natsort($array, SORT_STRING); natsort() only takes one parameter. The sort flags are used with sort() and are constants, so they shoudln't have double quotes around them. sort($array,SORT_STRING); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do i save images created using PHP
hi, i am able to create images in php (png, jpeg) in IE. when i try to save the image it gets saved to the directed path. when i try to open the saved document i get an error message or else the file opens but with a whole lot of text gibberish (stuff life division by zero , etc) this code is for a optimization proj and has some math in it.Kindly help, CLive. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: e-commerce with php
Pehepe Php [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! I don't know anything about e-commerce. I want to build a e-commerce site with php-mysql. So i have turorial for this idea. Can you help me about it? i know php and mysql but i dont have any information about ssl, e-commerce, paying with credit card. thank you very much! you can send me online document as attachment. or you can send me an adress or etc. _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail Hi You could have a look at osc2nuke: http://www.osc2nuke.org/ Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] url rewriting within sessions - confused newbie needs help - [FIXED]
I finally discovered the problem. There was extra whitespace after the php closing tag ? that was being interpreted as part of the header. Removing the whitespace fixed the problem. Peter Peter Walter wrote: Mike, I hope you mean session_start(). Yes, I did. Getting a bit dyslexic nowadays. Well, you would, because PHP would use the value from the PHPSESSID= URL parameter. ... except that on the second call, the url (as displayed by the browser) does not contain the PHPSESSID parameter, yet I am still able to retrieve the session variables correctly ... My immediate reaction to this is that session.use_cookies must be set to 0 (or Off) in your php.ini (or equivalent). Have you checked this? If it looks correct, what does a phpinfo() page show? php.ini contains the following settings: [Session] session.save_handler = files session.save_path = /tmp session.use_cookies = 1 session.name = PHPSESSID session.auto_start= 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability= 1 session.gc_maxlifetime= 1440 session.referer_check = session.entropy_length= 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 1 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=fakeentry In phpinfo(), the local value matches the master value for all entries, and match the entries in php.ini. I appreciate that this issue isn't a big deal - but I had hoped to understand php well enough to tell the difference between a bug and a feature. If it would help, I could send you the url for the page? (password protected) Peter Ford, Mike [LSS] wrote: On 11 December 2003 18:01, Peter Walter wrote: Mike, Thanks for the additional explanation, and I understand the sequence of events as you described. However, please bear with me a bit - the results I am getting do not quite match your explanation. Let me clarify what I am doing: I have a page (index.php) which starts out by calling start_session(), I hope you mean session_start(). then emits some html code containing some form variables for search criteria. After the form variables, I have a submit button that refers to index.php. Following that, I have php logic that extracts the search criteria (if set) from $HTTP_POST_VARS, performs a MySQL query, then creates a table of results (if any); one of the table entries contains a a href= link to determine which row the user selected. The first time I load the page, I assume the session is created by start_session(), and the cookie is sent to the browser. When I click on the submit button, the page is reloaded - I assume with the session active - as per your explanation. According tho the documentation I have read, the second time the page is loaded, start_session() will simply reuse the existing session parameters. At this point, the browser should already have the cookie - if it did not, I would not be able to retrieve the session variables Well, you would, because PHP would use the value from the PHPSESSID= URL parameter. - but the url links in the table are still rewritten. I do not understand why. My immediate reaction to this is that session.use_cookies must be set to 0 (or Off) in your php.ini (or equivalent). Have you checked this? If it looks correct, what does a phpinfo() page show? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE?
Jough Jeaux wrote: Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. --Jough __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ I use HTML-kit all the time. Has a built-in ftp client, lots of plugins available, in-program previews (via local webserver), and much more. http://www.htmlkit.com Erwin Kerk Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (0/T) executeing script below public
Hey, thanks, didnt know that. But is it possible to also add the start or stop parameter? Cheers, -Ryan You could just as easily ?php shell_exec(/path/to/script/scriptname start); ? Assuming that: 1) the webserver has rights to execute the script 2) you *must* execute this from the webserver 3) it's not a script to start/stop the webserver (since you obviously wouldn't be able to start it this way) 4) your php script is properly secured. Otherwise, just SSH in. It's more secure and just as easy. Bob - Original Message - From: Ryan A [EMAIL PROTECTED] To: Jay Blanchard [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, December 12, 2003 2:21 PM Subject: Re: [PHP] (0/T) executeing script below public Hey, Thanks for replying. The server is on Linux and is remotely hosted, my local machine is on win2k pro. A client wants me to set this up, I have setup the whole thing but this needs to be started you keep mentioning command line, what command line? You mean I should SSH in? (As you can see, am a newbie in shell scripts and ssh etc - kindly excuse) Kindly reply. Thanks, -Ryan [snip] #!/bin/sh scriptname start (or) scriptname stop [/snip] It is a shell script. They are usually placed in /usr/local/bin/ and chmod'd to execute. To run it you type this at the command line; scriptname start (or) scriptname stop This script accepts one argument, either 'stop' or 'start' [/snip] I should have added that you can run them from other folders using the './scriptname arg' from the command line. Depends on OS -- 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 Digest 14 Dec 2003 23:30:33 -0000 Issue 2473
php-general Digest 14 Dec 2003 23:30:33 - Issue 2473 Topics (messages 172675 through 172696): Re: What would the best way to veladate a URL string? 172675 by: andre.as.no-ip.com Re: session_start() make netscape 4.7 reload page. 172676 by: Marek Kilimajer Re: PHP IDE? 172677 by: BAO RuiXian 172679 by: rush 172684 by: Mike 172686 by: Ahbaid Gaffoor 172695 by: Erwin Kerk Operation in an Array 172678 by: Harry.de e-commerce with php 172680 by: pehepe php 172693 by: Eric Bolikowski help with install 172681 by: Paul Vinten php compile error with mysql undefined reference to `mysql_real_escape_string' 172682 by: Ivone Uribe trouble parsing an XML document 172683 by: alfredo 172685 by: Raditha Dissanayake Re: Where to get PHP manual? 172687 by: Chris Shiflett 172688 by: David T-G Sort flags 172689 by: Jake McHenry 172691 by: John W. Holmes Re: Email Forwarders 172690 by: Mike How do i save images created using PHP 172692 by: crdsouza.buffalo.edu Re: url rewriting within sessions - confused newbie needs help - [FIXED] 172694 by: Peter Walter Re: (0/T) executeing script below public 172696 by: Ryan A Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- On Sat, Dec 13, 2003 at 08:17:08PM -0500, Paul Chvostek wrote: Validate? How about something like: eregi('^(f|ht)tp://([a-z0-9._:-]+@)?([a-z0-9][a-z0-9-]+\.)+[a-z][a-z]+(/([a-z0-9.%=-]+)?)?',$string); I like it, but I would start with '^(ftp|gttp|https):...' People could be using SSL. -- Regards, Andre ---End Message--- ---BeginMessage--- Jonathan Zhang wrote: test.php -- ? session_start(); ? form input type=text name=test /form For Win2kpro+netscape 4.7,all form data you enter in this page will lost when resize the browser's window size, ns4.7 have reload this page when resize the window. But if you remove the session_start() from this page, the issue will not exist. Is there any solution for it? thanks, Jonathan Zhang Netscape 4.x has this annoying behavior, it tries to fetch a fresh copy whenever you resize window, view source code or print the page. You might try to use session_cache_limiter() function to control the cache headers send, try private_no_expire first. Do not set it to public if the page contains private information. ---End Message--- ---BeginMessage--- Mike wrote: if you are using windows, I would highlt recommend PHPEdit, it is open source and has function completion. It boosts productivity a lot http://www.phpedit.net/products/PHPEdit/ Mike Not that good. IIRC, all the error messages and the prompts are in German, one need to guess which button should press if you don't know the very language. Best Bao On Sat, 2003-12-13 at 17:06, Jough Jeaux wrote: Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. --Jough ---End Message--- ---BeginMessage--- Jough Jeaux [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. If you are going to work with templates, you can take a look at TemplateTamer, which has IDE geared for such development. rush -- http://www.templatetamer.com/ ---End Message--- ---BeginMessage--- Not that good. IIRC, all the error messages and the prompts are in German, one need to guess which button should press if you don't know the very language. They were all in english last time I used it (which was a while ago) Mike ---End Message--- ---BeginMessage--- with folding you can fold your code in chunks, you basically setup a start fold and an end fold and place code between them, then you can open and close (fold) that block of code as you need to or don't need to see it... for example: # {{{ PHP Code to do something... .. .. 1 lines of code... .. .. # }}} would collapse to one line when folded and look something like: + PHP Code to do something then when you hit space on it it expands. (I use {{{ and }}} as my start and end folds) ctags allows you to build a dictionary of words which you can hook into vim, that way you can do tab completion on PHP words etc. I also like to map keystrokes to coding templates for things like functions, loops, declarations etc. Everyone's got their own setup :) Plus I always use a CVS repository for my work, so my routine of, code, test, commit is habit. Looking at the responses there seems
[PHP] Re: PHP IDE?
Rush, templatetamer looks like an environment that I would be interested in using; however, what support resources are available for templatetamer? Is there a news server, bulletin board, or other help resource for people new to templatetamer? Peter Rush wrote: Jough Jeaux [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. If you are going to work with templates, you can take a look at TemplateTamer, which has IDE geared for such development. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pear install problem
Hi all. I'm trying to install PHPDocumentor (www.phpdoc.org) and I'm getting an error when using the pear install feature. I've got the necessary files stored in /home/phpDocumentor-1.2.2 but when I run pear install /home/phpDocumentor-1.2.2/package.xml I get the following error: Invalid checksum : 44835 calculated, 0 expected I've been looking around on google but I haven't been able to find much of any use. Can anyone give me an idea as to what's causing this and how to fix it? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How could I count the elements of each dimension of an array?
How could I count the elements of each dimension of an array? I have this script, but it failed, thanks for any help ? $ojpp[0] = 1; $ojpp[1] = 2; $ojpp[2] = 3; $ojpp[3] = 4; $ojpp[0][1] = 1; $ojpp[0][2] = 2; $ojpp[0][3] = 3; $ojpp[0][0][1] = 1; $ojpp[0][0][2] = 2; $test1 = count($ojpp); // first dimension $test2 = count($ojpp[0]); // second dimension $test3 = count($ojpp[0][0]); // third dimension echo $test1; echo $test2; echo $test3; echo pre; print_r($ojpp); echo /pre; ?
[PHP] Re: How could I count the elements of each dimension of an array?
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How could I count the elements of each dimension of an array? I have this script, but it failed, thanks for any help $ojpp[0] = 1; $ojpp[1] = 2; $ojpp[2] = 3; $ojpp[3] = 4; $ojpp[0][1] = 1; $ojpp[0][2] = 2; $ojpp[0][3] = 3; $ojpp[0][0][1] = 1; $ojpp[0][0][2] = 2; $test1 = count($ojpp); // first dimension $test2 = count($ojpp[0]); // second dimension $test3 = count($ojpp[0][0]); // third dimension echo $test1; echo $test2; echo $test3; echo pre; print_r($ojpp); echo /pre; The problem with the code above isn't with how you count the dimensions of the array, but how you assign values to the second and third dimensions. Ordinarily, the code $ojpp[0][1] = 1 will create an array at $ojpp[0] and set it's second element to be 1. On the first line of your code, however you have *already* assigned the string value 1 to $ojpp[0]. So when PHP sees the code $ojpp[0][1] = 1 it thinks you're trying to use the 'curly braces' syntax for accessing single characters of a string. This syntax is not widely known, but essentially means you can access characters in a string like elements of an array, by using curly braces. For example,? echo $string{2}; ? will print the third character in $string. For reasons unknown to me, PHP will also let you use square brackets on a string to perform the same action ... eg ? echo $string[2]; ? although this alternate syntax is being phased out. ( For more info see: http://us2.php.net/manual/en/language.types.string.php ). So essentially PHP intereperets $ojpp[0][1] = 1 as being an attempt to assign 1 as the second character to the string already assigned to $ojpp[0]. Which begs the question: why assign 1 to $ojpp in the first line of your code when you seem to want to reaplce it with an array on lines 5 - 8? This kind of coding bug is a by-product of a type-juggling, permissive languge that doesn't require you to pre-declare variables. To fix your code, change the first line of your code to read: $ojpp[0] = array(); Hope that helps, Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Operation in an Array
Harry.De [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How can i make an operation like adding variables in an array for example $array[$a+$b]; You'll have to be more specific. What exactly do you want to do? Add values of an array together? Their keys? Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP IDE?
snip Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. --Jough /snip If you're willing to purchase a commercial product I'd highly recommend Zend's IDE. I've been working on a large PHP development project for a little over a year now and switched to the Zend IDE about three months ago and it has really increased my productivity. My $0.02 CDN ($0.0151483 USD). P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Printing PHP Source with a PHP Script
Hi everyone, I'm trying to output PHP source within a PHP Script. The following script seems to work(Viewing HTML Source reveals the PHP Source), but the Browser output is very different. Is there a function or header I should set before echoing the PHP Source? Thanks. ? //filereader.php //script arguments: filereader.php?file= $fh = fopen($file,rb); $src = fread($fh,filesize($file)); fclose($fh); echo 'htmlmeta http-equiv=Content-Type content=text/plain'; echo $src; echo '/html'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Printing PHP Source with a PHP Script
Gohaku wrote: Hi everyone, I'm trying to output PHP source within a PHP Script. The following script seems to work(Viewing HTML Source reveals the PHP Source), but the Browser output is very different. Is there a function or header I should set before echoing the PHP Source? Thanks. ? //filereader.php //script arguments: filereader.php?file= $fh = fopen($file,rb); $src = fread($fh,filesize($file)); fclose($fh); echo 'htmlmeta http-equiv=Content-Type content=text/plain'; echo $src; echo '/html'; ? echo htmlentities($src); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] treu type fonts
sorry for the late delay. How would I output the image to a file on the hard drive Thanks -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, 11 December 2003 11:19 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] treu type fonts On Thursday 11 December 2003 06:06, cj wrote: I tried the png like you suggested and the same thing happens. I get nothing on the screen but if I do a right click and properties on the spot where the image should be the image type is a png image. 1) Enable FULL error reporting. 2) For debugging purposes, instead outputting the image directly, write it to disk first. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* We are on the verge: Today our program proved Fermat's next-to-last theorem. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 */ -- 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] Printing PHP Source with a PHP Script
John W. Holmes wrote: Gohaku wrote: Hi everyone, I'm trying to output PHP source within a PHP Script. The following script seems to work(Viewing HTML Source reveals the PHP Source), but the Browser output is very different. Is there a function or header I should set before echoing the PHP Source? Thanks. ? //filereader.php //script arguments: filereader.php?file= $fh = fopen($file,rb); $src = fread($fh,filesize($file)); fclose($fh); echo 'htmlmeta http-equiv=Content-Type content=text/plain'; echo $src; echo '/html'; ? echo htmlentities($src); there is a function just for this highlight_file($file); is all you need Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Printing PHP Source with a PHP Script
On Sunday, December 14, 2003, at 09:51 PM, John W. Holmes wrote: Gohaku wrote: Hi everyone, I'm trying to output PHP source within a PHP Script. The following script seems to work(Viewing HTML Source reveals the PHP Source), but the Browser output is very different. Is there a function or header I should set before echoing the PHP Source? Thanks. ? //filereader.php //script arguments: filereader.php?file= $fh = fopen($file,rb); $src = fread($fh,filesize($file)); fclose($fh); echo 'htmlmeta http-equiv=Content-Type content=text/plain'; echo $src; echo '/html'; ? echo htmlentities($src); Thank you, that's just what I was looking for. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trying to check for a valid URL String.
Philip J. Newman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] so far i got ... if (!ereg(^http:\/\/([_\.0-9a-zA-Z-]+\.)+[a-zA-Z]/i,$websiteUrl) { On a quick glance, three things stand out: 1) You allow underscores in the website domain, but these are not valid characters for domain names. 2) You allow dashes in the first pattern, but do not escape the dash character. 3) You have not provided a quantifier to the top-level domain pattern: [a-zA-Z], so it is only looking for one character fits the class [a-zA-Z]. Hope that helps, Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start() make netscape 4.7 reload page.
Marek, Thank you very much. Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jonathan Zhang wrote: test.php -- ? session_start(); ? form input type=text name=test /form For Win2kpro+netscape 4.7,all form data you enter in this page will lost when resize the browser's window size, ns4.7 have reload this page when resize the window. But if you remove the session_start() from this page, the issue will not exist. Is there any solution for it? thanks, Jonathan Zhang Netscape 4.x has this annoying behavior, it tries to fetch a fresh copy whenever you resize window, view source code or print the page. You might try to use session_cache_limiter() function to control the cache headers send, try private_no_expire first. Do not set it to public if the page contains private information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trying to check for a valid URL String.
On Monday, December 15, 2003, at 02:34 PM, Al wrote: Philip J. Newman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] so far i got ... if (!ereg(^http:\/\/([_\.0-9a-zA-Z-]+\.)+[a-zA-Z]/i,$websiteUrl) { On a quick glance, three things stand out: 1) You allow underscores in the website domain, but these are not valid characters for domain names. 2) You allow dashes in the first pattern, but do not escape the dash character. 3) You have not provided a quantifier to the top-level domain pattern: [a-zA-Z], so it is only looking for one character fits the class [a-zA-Z]. I'd also add (depending on the situation): 4) allow for https:// and ftp:// and other schemes 5) allow for .htaccess password combinations (guest:[EMAIL PROTECTED]) 6) allow for a trailing slash (http://example.com/) 7) allow for directories and files [paths] (http://example.com/path/to/foo.something) 8) allow for query strings (everything after the ?) and anchors (#) #7 #8 may seem stupid, but not everyone's base url is a full domain -- sometimes people are burried a few levels deep in directories, and you will undoubtedly get people copying and pasting things like 'example.com/index.html?id=5#foo' Now, the above is starting to look pretty complex huh? Take a look at http://php.net/parse_url It returns the URL as an array of manageable chunks (scheme, domain, path, query, fragment) which you can then perform small, focused checks and regexp's on to check the url conforms to what you want. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] true type fonts again
G'day all I have been able to the the image to display, which is a gif image of a rectange. But the text doesn't get displayed on the image. There are no error messages on the screen The other messages entitled true type fonts is a thread I started as well, but the image was not being displayed on the screen at all. So now I have the image but no text on the image. What could be causing this, and what should I have a look at? Thanks P.S: the code I use is below ?php header(Content-type: image/gif); $im = imagecreate(400,30); $white = imagecolorallocate($im, 202,112,112); $black = imagecolorallocate($im, 255,255,255); // Replace path by your own font path imagettftext($im, 20, 0, 10, 20, $black, arial, Testing... Omega: amp;#937;); imagegif($im); imagedestroy($im); ? The Glennies Group P.O. Box 5136 Studfield Post Office WANTIRNA SOUTH VIC 3152 Ph: 61 3 9800 3906 E-mail: [EMAIL PROTECTED] Website: glennies.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php