[PHP] Spamed?
Are you a spammer? (I found your email on a spammer website!?!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] base64-encoding in cookies?
Hello Fletcher Mattox, urlencode the string before set the cookie or replace array(' ',urlencode('/')) to array('+','/') Best regards, === At 2007-02-07, 15:59:13 you wrote: === Hi, A campus web server (not under my control) returns an authentication string in a cookie named AUTH. The cookie's value is an encrypted, base64 encoded string. Unfortunately, when I examine $_COOKIE['AUTH'], it is clear that all of the '+' characters have been replaced with a ' ' character in the base64 string. Why is this? Obviously, this corrupts the data and makes it impossible to base64-decode the string correctly. I believe this is a php issue and not, say, an apache issue because a perl program can correctly authenticate the same cookie based on perl's $ENV{'HTTP_COOKIE'}. i.e., the perl cookie contains the original '+'. Does anyone know how to make php (v5.1.5) do the right thing with base64 encoded cookies? Thanks Fletcher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = = = = = = = = = = = = = = = = = = = = Nicholas Yim [EMAIL PROTECTED] 2007-02-07 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spamed?
what's this qustion ??? where ? - Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, February 07, 2007 9:34 AM Subject: [PHP] Spamed? Are you a spammer? (I found your email on a spammer website!?!) -- 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] Spamed?
ok, Fabio tour computer is infected by W32/MyDoom-AR (worm) http://www.sophos.fr/security/analyses/w32mydoomar.html - Original Message - From: Sébastien WENSKE [EMAIL PROTECTED] To: [EMAIL PROTECTED]; php-general@lists.php.net Sent: Wednesday, February 07, 2007 9:39 AM Subject: Re: [PHP] Spamed? what's this qustion ??? where ? - Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, February 07, 2007 9:34 AM Subject: [PHP] Spamed? Are you a spammer? (I found your email on a spammer website!?!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 Commercial Development
Robert Cummings skrev: On Tue, 2007-02-06 at 23:45 +0100, Keryx Web wrote: Could you point out to me where exactly the discussion became about PHP4 versus PHP5? I seem to be smelling the red herring technique of changing the conversation focus so as to inappropriately lend credence to the initial argument because the secondary red herring argument can be argued more in your favour despite its irrelevance. The thread was started by Eric Gorr who wrote: blockquoteI haven't tracked this particular issue, but I know when PHP5 was first released is wasn't recommended in a commercial/production environment. However, a lot of time has passed and we're at v5.2 now...have things changed? Have GoogleYahoo, for example, moved to PHP5? Or is PHP4 still the recommendation for such environments? /blockquote Since I am unaware of what version of PHP Yahoo mainly uses (I've heard some of their developers talk, and they use PHP 5) and since Google seems to be a Java shop, I took the liberty of giving my oiwn view of why PHP should be used for professional development. And I said that for reasons of security and performance prepared statements usually are the best way of interacting with a DBMS. To me they are the main reason why I shun PHP 4 when developing new apps. Other things I personally like about PHP 5: - The OO model. - Tidy 2.0 - All things XML (Simple, DOM, Reader, now also Writer, etc) - Assign by reference in foreach loops Can a professional app be developed without these? Probably, but why limit your arsenal? Lars Gunther -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opera advice needed!
If there's an opera expert around could you please check out the following link: http://www.fcviikingit.com/new/testimenu.php This script contacts a DB and prints out the results as javascript to the client browser. As I mentioned earlier It works ok with IE, FF, Netscape but not with Opera. However the same script works with all mentioned browsers on my test server. I can't get this sorted! Thanks -W Roman Neuhauser [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] # [EMAIL PROTECTED] / 2007-02-07 08:32:47 +0200: Hello, I just noticed when I published a new menu system that it does NOT work in the ISP hosted server. However it works ok on my test server. Here's the test I have done all in same client machine (=unchanged browser settings): My test server: IE6 7-OK Opera 9.02 - OK Firefox -OK ISP server: IE6 7-OK Opera 9.02 - DOES NOT WORK! Firefox -OK The system relies on JS also I can see from the browser source code that all PHP has printed out all JS like it should but the menu is not printed to browser. Could you give me some pointers how to troubleshoot this? It must be something server related but not folder or file rights according to my testing. Might be a content-type issue. http://www.wireshark.org/ -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opera advice needed!
7 feb 2007 kl. 09.50 skrev William Stokes: If there's an opera expert around could you please check out the following link: http://www.fcviikingit.com/new/testimenu.php This script contacts a DB and prints out the results as javascript to the client browser. As I mentioned earlier It works ok with IE, FF, Netscape but not with Opera. However the same script works with all mentioned browsers on my test server. I can't get this sorted! Thanks -W Opera 9.02 on Mac OS is fine, as far I can tell. However, I would start by validating your html source. Right now, your html code is little bit messed up. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.fcviikingit.com% 2Fnew%2Ftestimenu.php //frank Roman Neuhauser [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] # [EMAIL PROTECTED] / 2007-02-07 08:32:47 +0200: Hello, I just noticed when I published a new menu system that it does NOT work in the ISP hosted server. However it works ok on my test server. Here's the test I have done all in same client machine (=unchanged browser settings): My test server: IE6 7-OK Opera 9.02 - OK Firefox -OK ISP server: IE6 7-OK Opera 9.02 - DOES NOT WORK! Firefox -OK The system relies on JS also I can see from the browser source code that all PHP has printed out all JS like it should but the menu is not printed to browser. Could you give me some pointers how to troubleshoot this? It must be something server related but not folder or file rights according to my testing. Might be a content-type issue. http://www.wireshark.org/ -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- 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] Opera advice needed!
ShitSHitSHIT!!! I had javascript disabled in Opera. The browsed just ignored it's own settings while brosing my server??? Feeling stopid. :O -W (Just costed me 3 hours) William Stokes [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] Thanks, I got the html sorter and the page now passes validation. But still with Opera 9.02 on WinXP nothing is printed out. (can see the javascript in the source code though) This must be some js shit. I just can't understand how the same script(s) work with the same client pc/browser when the files are in my test server... -W Frank Arensmeier [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] 7 feb 2007 kl. 09.50 skrev William Stokes: If there's an opera expert around could you please check out the following link: http://www.fcviikingit.com/new/testimenu.php This script contacts a DB and prints out the results as javascript to the client browser. As I mentioned earlier It works ok with IE, FF, Netscape but not with Opera. However the same script works with all mentioned browsers on my test server. I can't get this sorted! Thanks -W Opera 9.02 on Mac OS is fine, as far I can tell. However, I would start by validating your html source. Right now, your html code is little bit messed up. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.fcviikingit.com% 2Fnew%2Ftestimenu.php //frank Roman Neuhauser [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] # [EMAIL PROTECTED] / 2007-02-07 08:32:47 +0200: Hello, I just noticed when I published a new menu system that it does NOT work in the ISP hosted server. However it works ok on my test server. Here's the test I have done all in same client machine (=unchanged browser settings): My test server: IE6 7-OK Opera 9.02 - OK Firefox -OK ISP server: IE6 7-OK Opera 9.02 - DOES NOT WORK! Firefox -OK The system relies on JS also I can see from the browser source code that all PHP has printed out all JS like it should but the menu is not printed to browser. Could you give me some pointers how to troubleshoot this? It must be something server related but not folder or file rights according to my testing. Might be a content-type issue. http://www.wireshark.org/ -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- 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] Opera advice needed!
It appears to be working fine for me using Opera 8 and 9.10 on WinXP. Have you fixed it? If not, check your preferences in Opera. You may have JS disabled for non-local sites or similar. Edward -Original Message- From: William Stokes [mailto:[EMAIL PROTECTED] Sent: 07 February 2007 10:00 To: php-general@lists.php.net Subject: Re: [PHP] Opera advice needed! Thanks, I got the html sorter and the page now passes validation. But still with Opera 9.02 on WinXP nothing is printed out. (can see the javascript in the source code though) This must be some js shit. I just can't understand how the same script(s) work with the same client pc/browser when the files are in my test server... -W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opera advice needed!
Thanks, I got the html sorter and the page now passes validation. But still with Opera 9.02 on WinXP nothing is printed out. (can see the javascript in the source code though) This must be some js shit. I just can't understand how the same script(s) work with the same client pc/browser when the files are in my test server... -W Frank Arensmeier [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] 7 feb 2007 kl. 09.50 skrev William Stokes: If there's an opera expert around could you please check out the following link: http://www.fcviikingit.com/new/testimenu.php This script contacts a DB and prints out the results as javascript to the client browser. As I mentioned earlier It works ok with IE, FF, Netscape but not with Opera. However the same script works with all mentioned browsers on my test server. I can't get this sorted! Thanks -W Opera 9.02 on Mac OS is fine, as far I can tell. However, I would start by validating your html source. Right now, your html code is little bit messed up. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.fcviikingit.com% 2Fnew%2Ftestimenu.php //frank Roman Neuhauser [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] # [EMAIL PROTECTED] / 2007-02-07 08:32:47 +0200: Hello, I just noticed when I published a new menu system that it does NOT work in the ISP hosted server. However it works ok on my test server. Here's the test I have done all in same client machine (=unchanged browser settings): My test server: IE6 7-OK Opera 9.02 - OK Firefox -OK ISP server: IE6 7-OK Opera 9.02 - DOES NOT WORK! Firefox -OK The system relies on JS also I can see from the browser source code that all PHP has printed out all JS like it should but the menu is not printed to browser. Could you give me some pointers how to troubleshoot this? It must be something server related but not folder or file rights according to my testing. Might be a content-type issue. http://www.wireshark.org/ -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- 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] Opera advice needed!
On Wed, 2007-02-07 at 12:16 +0200, William Stokes wrote: ShitSHitSHIT!!! I had javascript disabled in Opera. The browsed just ignored it's own settings while brosing my server??? Feeling stopid. While it works fine, I get a slew of warnings for your sloppy css since you don't give units to a whole bunch of width settings :) CSS - http://www.fcviikingit.com/new/testimenu.php HTML style attribute Invalid value for property: width Line 1: width:135; Unfortunately the line information is usually crap in opera. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 Commercial Development
On Wed, 2007-02-07 at 09:47 +0100, Lars Gunther wrote: Robert Cummings skrev: On Tue, 2007-02-06 at 23:45 +0100, Keryx Web wrote: Could you point out to me where exactly the discussion became about PHP4 versus PHP5? I seem to be smelling the red herring technique of changing the conversation focus so as to inappropriately lend credence to the initial argument because the secondary red herring argument can be argued more in your favour despite its irrelevance. The thread was started by Eric Gorr who wrote: blockquoteI haven't tracked this particular issue, but I know when PHP5 was first released is wasn't recommended in a commercial/production environment. However, a lot of time has passed and we're at v5.2 now...have things changed? Have GoogleYahoo, for example, moved to PHP5? Or is PHP4 still the recommendation for such environments? /blockquote Ah, quite true, though our particular branch wasn't about this :) Since I am unaware of what version of PHP Yahoo mainly uses (I've heard some of their developers talk, and they use PHP 5) and since Google seems to be a Java shop, I took the liberty of giving my oiwn view of why PHP should be used for professional development. And I said that for reasons of security and performance prepared statements usually are the best way of interacting with a DBMS. To me they are the main reason why I shun PHP 4 when developing new apps. Other things I personally like about PHP 5: - The OO model. - Tidy 2.0 - All things XML (Simple, DOM, Reader, now also Writer, etc) - Assign by reference in foreach loops Can a professional app be developed without these? Probably, but why limit your arsenal? You make a decent point, but then, due to the Turing complete nature of languages anything PHP5 can do PHP4 can also do. And since PHP5 has a smaller adoption arena and PHP5 can with run PHP4 apps (with some attention to detail), why limit your audience? As you can see, there are pros and cons to either decision and much depends on your focus. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JS prompt - php
Hey all! Quick question (and hopefully a simple one) I have a link on a page, when the client clicks that link it should show them a JS prompt and ask for their name (so far I have done this) When they write their name, I want that data to be sent to my php script via AJAX (yes?) so the page does not reload or anything (actually, how can i reload the page to reflect the change?) I have googled but I see whole ajax classes and what not, I dont know if I am using the correct keywords or what... you would happen to have a working piece of code that you could share with me.. would you? Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.
Re: [PHP] Opera advice needed!
William Stokes wrote: Hello, I just noticed when I published a new menu system that it does NOT work in the ISP hosted server. However it works ok on my test server. Here's the test I have done all in same client machine (=unchanged browser settings): works fine in opera 9.10 ubuntu edgy eft. clive -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] JS prompt - php
Ryan A wrote: Hey all! Quick question (and hopefully a simple one) I have a link on a page, when the client clicks that link it should show them a JS prompt and ask for their name (so far I have done this) When they write their name, I want that data to be sent to my php script via AJAX (yes?) so the page does not reload or anything (actually, how can i reload the page to reflect the change?) I have googled but I see whole ajax classes and what not, I dont know if I am using the correct keywords or what... you would happen to have a working piece of code that you could share with me.. would you? Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. Google Ajax How-to or Ajax How-to POST The 3rd or 4th item for plain how-to is: http://swik.net/Ajax/How+to+use+XMLHttpRequest This first item for how-to POST: http://www.captain.at/howto-ajax-form-post-request.php -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opera advice needed!
Robert Cummings wrote: On Wed, 2007-02-07 at 12:16 +0200, William Stokes wrote: ShitSHitSHIT!!! I had javascript disabled in Opera. The browsed just ignored it's own settings while brosing my server??? Feeling stopid. While it works fine, I get a slew of warnings for your sloppy css since you don't give units to a whole bunch of width settings :) CSS - http://www.fcviikingit.com/new/testimenu.php HTML style attribute Invalid value for property: width Line 1: width:135; Unfortunately the line information is usually crap in opera. the words the line information are like a lego brick, in so far that you can plugin just about any combination of words in it's place and the sentence still makes sense :-P Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 to PHP5 issue
On Feb 5, 2007, at 2:00 PM, Jochem Maas wrote: you don't need to use the box - you can install a 2nd copy of apache and run php4 on it and use the apache ProxyPass directive to make the php4/apache setup available via the apache(2)/php5 [std] webserver. search the archives for 'ProxyPass' You actually don't even have to run a second instance of Apache. From what I've heard of other hosting companies doing, you can use the same Apache installation and run PHP4 and PHP5 concurrently. However, the only thing you'd have to do is one of the following: 1) For PHP4 apps and scripts, leave the .php extension and rename all PHP5 apps and scripts with a .php5 extension. Where you have the string: DirectoryIndex index.php index.html add: index.php5 to it. And where you have the string: AddType application/x-httpd-php .php Change it to: AddType application/x-httpd-php4 .php Also, add another line: AddType application/x-httpd-php5 .php5 Make sure you include both the php4 and php5 modules, restart apache and voila! PHP4 and PHP5 on the same server using 1 installation of Apache. 2) Do the same as above, but use .php4 extensions instead of .php5. 3) Additionally, after doing 5 minutes of Googling, I found that you can have .htaccess files to control which applications use PHP4 and which use PHP5 with the following directive: AddHandler application/x-httpd-php5 .php This would circumvent having to rename the extensions of your PHP files, as you could then do directory specific PHP4/5 app running. You still have to make certain Apache has both the PHP4 and PHP5 modules loaded, obviously. -- Christopher Weldon President CEO Cerberus Interactive, Inc. [EMAIL PROTECTED] (866) 813-4603 x605 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] JS prompt - php
At 5:11 AM -0800 2/7/07, Ryan A wrote: Hey all! Quick question (and hopefully a simple one) I have a link on a page, when the client clicks that link it should show them a JS prompt and ask for their name (so far I have done this) When they write their name, I want that data to be sent to my php script via AJAX (yes?) so the page does not reload or anything (actually, how can i reload the page to reflect the change?) I have googled but I see whole ajax classes and what not, I dont know if I am using the correct keywords or what... you would happen to have a working piece of code that you could share with me.. would you? Thanks! Ryan Ryan: Your terminology is clear enough and you're on the right path, but it's not simple. The way it works is that you have a javascript ajax file, which is loaded by your main page and creates a request object. When the user clicks something, it receives a send request, and handles the response, which in turn updates the page via the DOM without a refresh. Clear? Keep looking at ajax. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 to PHP5 issue
Christopher Weldon wrote: You actually don't even have to run a second instance of Apache. From what I've heard of other hosting companies doing, you can use the same Apache installation and run PHP4 and PHP5 concurrently. However, the only thing you'd have to do is one of the following: 1) For PHP4 apps and scripts, leave the .php extension and rename all PHP5 apps and scripts with a .php5 extension. Where you have the string: DirectoryIndex index.php index.html add: index.php5 to it. And where you have the string: AddType application/x-httpd-php .php Change it to: AddType application/x-httpd-php4 .php Also, add another line: AddType application/x-httpd-php5 .php5 Make sure you include both the php4 and php5 modules, restart apache and voila! PHP4 and PHP5 on the same server using 1 installation of Apache. 2) Do the same as above, but use .php4 extensions instead of .php5. 3) Additionally, after doing 5 minutes of Googling, I found that you can have .htaccess files to control which applications use PHP4 and which use PHP5 with the following directive: AddHandler application/x-httpd-php5 .php This would circumvent having to rename the extensions of your PHP files, as you could then do directory specific PHP4/5 app running. You still have to make certain Apache has both the PHP4 and PHP5 modules loaded, obviously. -- This has come up a few times recently, and I added my own two cents, which required two separate Apaches installs on the same server, which I'd done for myself. But this solution is really cool! -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP book reviewers wanted
Hello, on 02/06/2007 01:25 PM tedd said the following: Demonstrating good English writing skills and having published good book reviews in the past gets me preference. gets me preference ??? Me get any money for this? Hey, go easy on the non-native speakers... I'm betting your Spanish is worse than his English... No doubt -- I have enough problems with English. My point was, or at least my failed attempt was: 1) humor; 2) pointing out a proof reading error in a request for roof reading skills. I found that ironically humorous. No disrespect was intended, it was just a jab between posters. My apologies if any offense was taken. Cheers, tedd PS: He is a native speaker, it's just not English. :-) No offense was taken on my part. I am aware that the PHPClasses site is not perfect for everybody. So, when I mention something in public related to the site, I am used to get reactions that really do not favour the site. I do not take that personally though that site is basically run by MMI (Me, Myself and I). -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to parse PHP tags in a string?
Hi all, Is there a PHP function that parses a string as it was the content of a PHP file? I have a CMS application and editors write the news items text into a text area. Since they have some knowledge of PHP, I'd like to allow them to insert ? ... ? or ?= ... ? and have the content blocks parsed and executed. OK, this could be easily done parsing the string and passing the block contents to eval(). However I wonder wether there is some function already doing that (maybe in a more efficient way). Thanks a lot in advance. === Marco Brandizi [marco_AT_leafbioscience_DOT_com] http://gca.btbs.unimib.it/brandizi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions working/not
Hey - -- - Would anyone be so kind as to un-stick my brain? I can't get sessions to work on my development machine (localhost). They work fine on my testing server (an internal IP). Development: W2K, Testing Server W2K Server, both using IIS 5, PHP 5.2. The php.ini SESSION settings are the same on both machines. Seems to me I made this choice at some point, but now my feeble brain can't bring it up. bueller Anyone? Anyone? /bueller Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 to PHP5 issue
Myron Turner wrote: Christopher Weldon wrote: You actually don't even have to run a second instance of Apache. From what I've heard of other hosting companies doing, you can use the same Apache installation and run PHP4 and PHP5 concurrently. if you use CGI for one of them then yes - but not if you [want to] use the apache module for both of them, this is due to symbol clashes between php4 and php5 modules when they are loaded simultaneously. please correct me if I have the wrong end of the stick. However, the only thing you'd have to do is one of the following: 1) For PHP4 apps and scripts, leave the .php extension and rename all PHP5 apps and scripts with a .php5 extension. Where you have the string: DirectoryIndex index.php index.html add: index.php5 to it. And where you have the string: AddType application/x-httpd-php .php Change it to: AddType application/x-httpd-php4 .php Also, add another line: AddType application/x-httpd-php5 .php5 Make sure you include both the php4 and php5 modules, restart apache and voila! PHP4 and PHP5 on the same server using 1 installation of Apache. 2) Do the same as above, but use .php4 extensions instead of .php5. 3) Additionally, after doing 5 minutes of Googling, I found that you can have .htaccess files to control which applications use PHP4 and which use PHP5 with the following directive: AddHandler application/x-httpd-php5 .php This would circumvent having to rename the extensions of your PHP files, as you could then do directory specific PHP4/5 app running. You still have to make certain Apache has both the PHP4 and PHP5 modules loaded, obviously. -- This has come up a few times recently, and I added my own two cents, which required two separate Apaches installs on the same server, which I'd done for myself. But this solution is really cool! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to parse PHP tags in a string?
- Original Message - From: Zak Mc Kracken [EMAIL PROTECTED] Hi all, Is there a PHP function that parses a string as it was the content of a PHP file? I have a CMS application and editors write the news items text into a text area. Since they have some knowledge of PHP, I'd like to allow them to insert ? ... ? or ?= ... ? and have the content blocks parsed and executed. OK, this could be easily done parsing the string and passing the block contents to eval(). However I wonder wether there is some function already doing that (maybe in a more efficient way). I would not recommend you do such a thing, you are opening up all the PHP environment to the editors, including reading variables and calling functions they whould see nor run. Instead, I would sugest you allow them to embed within the text a series of functions or variables which you would define, enclosed in whatever symbols you find suitable (easy to search and unambiguous) which would allow your program to replace by whatever data you may provide for them to use but in no case I would open up the whole of the PHP environment to them. You would pick those functions with a regular expression and do a switch on the keyword found and process it. Thus each keyword would have a case to process it and might call a PHP function or read a variable, but no 'default:', if it is not within the allowed functions, forget it. And never make eval() accessible to users. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opera advice needed!
On Wed, 2007-02-07 at 16:19 +0100, Jochem Maas wrote: Robert Cummings wrote: On Wed, 2007-02-07 at 12:16 +0200, William Stokes wrote: ShitSHitSHIT!!! I had javascript disabled in Opera. The browsed just ignored it's own settings while brosing my server??? Feeling stopid. While it works fine, I get a slew of warnings for your sloppy css since you don't give units to a whole bunch of width settings :) CSS - http://www.fcviikingit.com/new/testimenu.php HTML style attribute Invalid value for property: width Line 1: width:135; Unfortunately the line information is usually crap in opera. the words the line information are like a lego brick, in so far that you can plugin just about any combination of words in it's place and the sentence still makes sense :-P I strongly disagree. IMHO, Opera is superior to Firefox. I develop entirely in Opera and then fix things up for Firefox and IE. But then, Opera doesn't make me download a 3rd party extension to get rid of that tabbed browsing blight. Also Opera was the first to do proper zooming on a page... Firefox still doesn't get it right. And Opera has superior speed. Nope, Firefox, while nowhere near as bad as IE, still isn't as good as Opera. I'm probably in the minority with my opinion on this, but ummm, I don't care :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to parse PHP tags in a string?
Zak Mc Kracken wrote: Hi all, Is there a PHP function that parses a string as it was the content of a PHP file? I have a CMS application and editors write the news items text into a text area. Since they have some knowledge of PHP, I'd like to allow them to insert ? ... ? or ?= ... ? and have the content blocks parsed and executed. OK, this could be easily done parsing the string and passing the block contents to eval(). However I wonder wether there is some function already doing that (maybe in a more efficient way). Thanks a lot in advance. Hi, This is a very dangerous thing to do, as it will allow execution of arbitrary PHP code. I highly recommend that you not allow this. Instead, some kind of plugin system could be allowed where editors can specify a plugin (something like [plugin name=blah param1=blah param2=halb]) and they upload the PHP code to a file on the server, register that file as the plugin blah and go from there. Anything else is begging to get the site hacked and cause yet another vulnerability in a php app. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] All-in-one PHP Classes
# [EMAIL PROTECTED] / 2007-02-07 09:59:15 +1100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-02-06 12:47:47 +0100: Have been reading posts daily for two months now on the list, and am very pleased at how informative these can be. I have noticed, many examples where one is pointed to using classes downloadable on the internet. This is when i realized how often these classes that do everything are very BIG. Big classes and long methods are signs of bad code, no matter if it's downloadable for free or costs money. Pfft. Depends on the code. A developer api is going to have long methods / functions, simply because of error checking. Could you give me an example? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP book reviewers wanted
Hello, on 02/06/2007 01:29 PM tedd said the following: Anyway, since you brought that up, I would like to clarify that this is often misunderstood issue. Nobody likes ads, including myself. Ads are obviously necessary to keep the site viable. Otherwise it would have been closed a long time ago. Why are ads necessary? I don't follow. Pay the bills. It may not be evident, but this is my full time day job. This is not an hobby site. Not only the site needs to generate revenue to pay for its operation costs, but also to keep me working full time on it. It is a privilege for me to be able to work in my own project at full time. But obviously I have to keep it as a viable business too. That is why the site would have been closed if it were not the ads. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP book reviewers wanted
Hello, on 02/07/2007 01:53 AM Richard Lynch said the following: Demonstrating good English writing skills and having published good book reviews in the past gets me preference. gets me preference ??? Me get any money for this? Hey, go easy on the non-native speakers... I'm betting your Spanish is worse than his English... Thanks for helping to clarify the native speakers. Just a minor correction. My Spanish is not better than my English. I am a native Portuguese speaker. ;-) cultural_momentPortuguese is also a latin based language like Spanish, French, Italian and Romanian, but it is a distinct idiom./cultural_moment Dang I'm felling stoopid. I even have all the facts in my brain to have not made that mistake, had I matched up column M with row P... Sorry. No problem. No apologies are necessary. Nobody knows everything. Even if you knew it, it is ok to get confused once in a while. My memory used to be better when I was younger, or at least when I did not have to work overnight. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 to PHP5 issue
Jochem Maas wrote: Myron Turner wrote: Christopher Weldon wrote: You actually don't even have to run a second instance of Apache. From what I've heard of other hosting companies doing, you can use the same Apache installation and run PHP4 and PHP5 concurrently. if you use CGI for one of them then yes - but not if you [want to] use the apache module for both of them, this is due to symbol clashes between php4 and php5 modules when they are loaded simultaneously. please correct me if I have the wrong end of the stick. Thanks for the heads up. I'm sure I would have tried it out, probably sooner than later. Maybe someone has some further advice on this. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] base64-encoding in cookies?
I wrote: A campus web server (not under my control) returns an authentication string in a cookie named AUTH. The cookie's value is an encrypted, base64 encoded string. Unfortunately, when I examine $_COOKIE['AUTH'], it is clear that all of the '+' characters have been replaced with a ' ' character in the base64 string. Why is this? Obviously, this corrupts the data and makes it impossible to base64-decode the string correctly. I believe this is a php issue and not, say, an apache issue because a perl program can correctly authenticate the same cookie based on perl's $ENV{'HTTP_COOKIE'}. i.e., the perl cookie contains the original '+'. Does anyone know how to make php (v5.1.5) do the right thing with base64 encoded cookies? This problem seems to be http://bugs.php.net/bug.php?id=35523 where it was dismissed as Bogus without any explanation why. It seems that '+' characters are intentionally converted to spaces in all cookies. This makes no sense to me. Can someone explain it? Thanks, Fletcher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] base64-encoding in cookies?
On Wed, 2007-02-07 at 13:49 -0600, Fletcher Mattox wrote: I wrote: A campus web server (not under my control) returns an authentication string in a cookie named AUTH. The cookie's value is an encrypted, base64 encoded string. Unfortunately, when I examine $_COOKIE['AUTH'], it is clear that all of the '+' characters have been replaced with a ' ' character in the base64 string. Why is this? Obviously, this corrupts the data and makes it impossible to base64-decode the string correctly. I believe this is a php issue and not, say, an apache issue because a perl program can correctly authenticate the same cookie based on perl's $ENV{'HTTP_COOKIE'}. i.e., the perl cookie contains the original '+'. Does anyone know how to make php (v5.1.5) do the right thing with base64 encoded cookies? This problem seems to be http://bugs.php.net/bug.php?id=35523 where it was dismissed as Bogus without any explanation why. It seems that '+' characters are intentionally converted to spaces in all cookies. This makes no sense to me. Can someone explain it? I haven't looked, but there's a good chance it's part of the specs. Same thing happens in URLs. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] base64-encoding in cookies?
-Original Message- From: Fletcher Mattox [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 2:49 PM To: php-general@lists.php.net Subject: Re: [PHP] base64-encoding in cookies? I wrote: A campus web server (not under my control) returns an authentication string in a cookie named AUTH. The cookie's value is an encrypted, base64 encoded string. Unfortunately, when I examine $_COOKIE['AUTH'], it is clear that all of the '+' characters have been replaced with a ' ' character in the base64 string. Why is this? Obviously, this corrupts the data and makes it impossible to base64-decode the string correctly. I believe this is a php issue and not, say, an apache issue because a perl program can correctly authenticate the same cookie based on perl's $ENV{'HTTP_COOKIE'}. i.e., the perl cookie contains the original '+'. Does anyone know how to make php (v5.1.5) do the right thing with base64 encoded cookies? This problem seems to be http://bugs.php.net/bug.php?id=35523 where it was dismissed as Bogus without any explanation why. It seems that '+' characters are intentionally converted to spaces in all cookies. This makes no sense to me. Can someone explain it? Thanks, Fletcher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Could it have something to do with url encoding? For example: http://example.com/page.php?foo=ABC+123 echo $_GET['foo']; // should produce: ABC 123 http://example.com/page.php?foo=ABC%2B123 echo $_GET['foo']; // should produce: ABC+123 HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] base64-encoding in cookies?
Exactly what I was going to mention, Brad. Here's some more info. Quoted from PHP manual for urlencode(): Returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type. This differs from the RFC1738 encoding (see rawurlencode()) in that for historical reasons, spaces are encoded as plus (+) signs. Try this: $space = ; echo Urlencoded: . urlencode($space) . br\n; echo Rawurlencoded: . rawurlencode($space) . br\n; And you get: Urlencoded: + Rawurlencoded: %20 If the only issue the OP is having is that the spaces are being transformed from + to space then maybe just do a urlencode($_COOKIE['AUTH']) and try doing the base64 decode off of that. This assumes that urlencode() Doesn't mangle other data in the cookie data. Or a string replace to +. Kind of a non-technical answer, so maybe there's a better way to do this. Maybe a setting in apache or PHP. Don't really have time to research it right now, just wanted to point out the urlencode() and rawurlencode() info. PHP manual pages here: http://us3.php.net/manual/en/function.urlencode.php http://us2.php.net/manual/en/function.rawurlencode.php -TG = = = Original message = = = -Original Message- From: Fletcher Mattox [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 2:49 PM To: php-general@lists.php.net Subject: Re: [PHP] base64-encoding in cookies? I wrote: A campus web server (not under my control) returns an authentication string in a cookie named AUTH. The cookie's value is an encrypted, base64 encoded string. Unfortunately, when I examine $_COOKIE['AUTH'], it is clear that all of the '+' characters have been replaced with a ' ' character in the base64 string. Why is this? Obviously, this corrupts the data and makes it impossible to base64-decode the string correctly. I believe this is a php issue and not, say, an apache issue because a perl program can correctly authenticate the same cookie based on perl's $ENV'HTTP_COOKIE'. i.e., the perl cookie contains the original '+'. Does anyone know how to make php (v5.1.5) do the right thing with base64 encoded cookies? This problem seems to be ~http://bugs.php.net/bug.php?id=35523 where it was dismissed as Bogus without any explanation why. It seems that '+' characters are intentionally converted to spaces in all cookies. This makes no sense to me. Can someone explain it? Thanks, Fletcher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Could it have something to do with url encoding? For example: http://example.com/page.php?foo=ABC+123 echo $_GET['foo']; // should produce: ABC 123 http://example.com/page.php?foo=ABC%2B123 echo $_GET['foo']; // should produce: ABC+123 HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting issue
I have been trying to figure out how to get this to work for a couple of days. I need to sort the results of a DB query based on the hierarchy of positions within an organization. Since they are not necessarily alphabetical, the best I can come up with is to assign a numerical value in a separate table to each position, and reference that to sort it. Is this the best way to do this? Or is there some other trick someone can clue me in on? My code now runs the query, and with a while ($row = mysql_fetch_assoc($result)) { *put results into an array* } statement I put each entry into an array then I sort it like so. array_multisort($array); $count = 0; while (isset ($array[$count])) { *display results in a table* $count++; } Thanks, Don
Re: [PHP] Sorting issue
Well, kind of ugly but you can do something like this: SELECT Position, CASE Position WHEN 'CEO' THEN 1 WHEN 'COO' THEN 2 WHEN 'CFO' THEN 3 WHEN 'HR' THEN 4 ELSE 99 END AS PositionSort FROM SomeTable ORDER BY PositionSort That way you're not creating a whole new table to store the sorting values. You can also just put the CASE sequence in your ORDER BY (I believe) so it doesn't get returned as a value. Didn't test that, but it's a little thing either way. -TG = = = Original message = = = I have been trying to figure out how to get this to work for a couple of days. I need to sort the results of a DB query based on the hierarchy of positions within an organization. Since they are not necessarily alphabetical, the best I can come up with is to assign a numerical value in a separate table to each position, and reference that to sort it. Is this the best way to do this? Or is there some other trick someone can clue me in on? My code now runs the query, and with a while ($row = mysql_fetch_assoc($result)) *put results into an array* statement I put each entry into an array then I sort it like so. array_multisort($array); $count = 0; while (isset ($array[$count])) *display results in a table* $count++; Thanks, Don ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Javascript and $_POST
I have a form that uses Javascript to validate form field entries, and if they are incorrect it returns an error to the user. After the Javascript processing is complete, it submits the form to my save page. However it seems that once the processing is complete and it passes to the save page, none of my $_POST variables are being passed. Is this normal, or is there a work around for it? My Javascript has multiple checks. Below is a very condensed version: script language=JavaScript function checkForm() { if (inputForm.cc_phone_number.value == ) { alert( Please enter a phone number. ); inputForm.cc_phone_number.focus(); return; } document.Submit.submit(); } /script And this is my Save option at the bottom of my page form name=Submit action=save.php method=post enctype=multipart/form-data table align=center border=0 cellpadding=0 cellspacing=0 width=680 tr td width=64 align=lefta href=javascript:checkForm() title=SaveSave/a/td /tr /table /form When I click on save, it does go thru all the checks correctly and prompts to enter info if anything is left out. It then passes me to the save.phppage as it should, but all of my $_POST('X') values come in blank.
RE: [PHP] Javascript and $_POST
-Original Message- From: Dan Shirah [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 4:35 PM To: php-general Subject: [PHP] Javascript and $_POST I have a form that uses Javascript to validate form field entries, and if they are incorrect it returns an error to the user. After the Javascript processing is complete, it submits the form to my save page. However it seems that once the processing is complete and it passes to the save page, none of my $_POST variables are being passed. Is this normal, or is there a work around for it? My Javascript has multiple checks. Below is a very condensed version: script language=JavaScript function checkForm() { if (inputForm.cc_phone_number.value == ) { alert( Please enter a phone number. ); inputForm.cc_phone_number.focus(); return; } document.Submit.submit(); } /script And this is my Save option at the bottom of my page form name=Submit action=save.php method=post enctype=multipart/form-data table align=center border=0 cellpadding=0 cellspacing=0 width=680 tr td width=64 align=lefta href=javascript:checkForm() title=SaveSave/a/td /tr /table /form When I click on save, it does go thru all the checks correctly and prompts to enter info if anything is left out. It then passes me to the save.phppage as it should, but all of my $_POST('X') values come in blank. From the looks of it, you have two forms - one called Submit and one called inputForm. You need to submit the inputForm for the values to be passed to the processing page. document.inputForm.submit(); HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript and $_POST
Dan Shirah wrote: And this is my Save option at the bottom of my page form name=Submit action=save.php method=post enctype=multipart/form-data table align=center border=0 cellpadding=0 cellspacing=0 width=680 tr td width=64 align=lefta href=javascript:checkForm() title=SaveSave/a/td /tr /table /form ErWhy aren't there any input elements within the form tag? Maybe you just condensed-out the inputs, but if your inputs aren't within the form, they won't be submitted. E.g. if you have: form id=dataForm input ... / input ... / /form form id=submitForm ... /form If you submit submitForm, nothing will get posted. You want to post dataForm in the above example. (Or whatever inputForm happens to be in your example.) jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting issue
= = = Original message = = = I need to sort the results of a DB query based on the hierarchy of positions within an organization. Since they are not necessarily alphabetical, the best I can come up with is to assign a numerical value in a separate table to each position, and reference that to sort it. At 2/7/2007 01:10 PM, [EMAIL PROTECTED] wrote: Well, kind of ugly but you can do something like this: SELECT Position, CASE Position WHEN 'CEO' THEN 1 WHEN 'COO' THEN 2 WHEN 'CFO' THEN 3 WHEN 'HR' THEN 4 ELSE 99 END AS PositionSort FROM SomeTable ORDER BY PositionSort That way you're not creating a whole new table to store the sorting values. If I might offer alternative advice, I *would* create a separate table of positions sort sequence values, so that all the data can be edited in one mode (e.g., phpMyAdmin). If some of your data is in MySQL and some of it's embedded in a query in a PHP script, it will be a little bit more of a hassle to maintain and a little more cryptic for the next developer who has to figure out what you've done after you abruptly run off to Tahiti. SELECT Positions.Sort, Employees.Position, Employees.LastName, etc FROM Employees, Positions WHERE Employees.Position = Positions.Position ORDER BY Positions.Sort, Employees.LastName (Assuming more than one employee per position, I figure you'd want a secondary sort criterion.) Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript and $_POST
At 2/7/2007 01:34 PM, Dan Shirah wrote: I have a form that uses Javascript to validate form field entries, and if they are incorrect it returns an error to the user. After the Javascript processing is complete, it submits the form to my save page. However it seems that once the processing is complete and it passes to the save page, none of my $_POST variables are being passed. Of course, all of your form fields need to be inside the same form/form tags as your submit button. The sample HTML you posted did not indicate that you'd done this. Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with matching numbers 0-100
Richard Lynch wrote: On Sat, February 3, 2007 10:55 am, Chilling Lounge Admin wrote: I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? look at pron for half an hour and all of a sudden your code will rewrite itself. or alternatively learn to write regular expressions - for which me recommend RTFM - I assume they still advise actually reading at school? Deja Vu! ?php if (!preg_match('/^[0-9]+$/', $input)){ die(invalid input\n); } $input = (int) $input; switch (true){ case $input 0: die(invalid input\n); break; case $input = 15: echo image 1 to 15\n; break; case $input = 30: echo image 16 to 30\n; break; default: die(invalid input\n); break; } ? If this is homework, you'd better go hire a tutor NOW, because it ain't gonna get any easier than this... especially when your doing it for him ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with matching numbers 0-100
frank wrote: better make a switch statement: with case such as switch($x): that should be : switch (true) { // bla } otherwise you would be testing the boolean cast of the value of $x against the result of the expression given in the case statement ... in practice it would probably do what you want but not for the reason you think. case ($x = 16 $x = 30): break; case set* Chilling Lounge Admin [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi. I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] All-in-one PHP Classes
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-02-07 09:59:15 +1100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-02-06 12:47:47 +0100: Have been reading posts daily for two months now on the list, and am very pleased at how informative these can be. I have noticed, many examples where one is pointed to using classes downloadable on the internet. This is when i realized how often these classes that do everything are very BIG. Big classes and long methods are signs of bad code, no matter if it's downloadable for free or costs money. Pfft. Depends on the code. A developer api is going to have long methods / functions, simply because of error checking. Could you give me an example? Anything based on PEAR. I was going to point to http://pear.php.net/package/MDB2/docs/2.3.0/__filesource/fsource_MDB2__MDB2-2.3.0MDB2.php.html which has 4,000 lines of code in one file, but then I realised it has multiple classes in the same file (which is usually a no-no as well). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Find midpoint between two points
I found a nice javascript function that takes two points of latitude and longitude and returns a midpoint. I'm now trying to rewrite in PHP, but having some problems. Here's the original javascript function, taken from http://www.movable-type.co.uk/scripts/ LatLong.html : LatLong.midPoint = function(p1, p2) { var dLon = p2.lon - p1.lon; var Bx = Math.cos(p2.lat) * Math.cos(dLon); var By = Math.cos(p2.lat) * Math.sin(dLon); lat3 = Math.atan2(Math.sin(p1.lat)+Math.sin(p2.lat), Math.sqrt((Math.cos(p1.lat)+Bx)*(Math.cos(p1.lat) +Bx) + By*By ) ); lon3 = p1.lon + Math.atan2(By, Math.cos(p1.lat) + Bx); if (isNaN(lat3) || isNaN(lon3)) return null; return new LatLong(lat3*180/Math.PI, lon3*180/Math.PI); } And here's my PHP variant, which isn't working: function midpoint ($lat1, $lng1, $lat2, $lng2) { $dlng = $lng2 - $lng1; $Bx = cos($lat2) * cos($dlng); $By = cos($lat2) * sin($dlng); $lat3 = atan2( sin($lat1)+sin($lat2), sqrt((cos($lat1)+$Bx)*(cos ($lat1)+$Bx) + $By*$By )); $lng3 = $lng1 + atan2($By, (cos($lat1) + $Bx)); $pi = pi(); return ($lat3*180)/$pi .' '. ($lng3*180)/$pi; } Any ideas why it's returning wrong values? ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] All-in-one PHP Classes
# [EMAIL PROTECTED] / 2007-02-08 11:27:13 +1100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-02-07 09:59:15 +1100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-02-06 12:47:47 +0100: Have been reading posts daily for two months now on the list, and am very pleased at how informative these can be. I have noticed, many examples where one is pointed to using classes downloadable on the internet. This is when i realized how often these classes that do everything are very BIG. Big classes and long methods are signs of bad code, no matter if it's downloadable for free or costs money. Pfft. Depends on the code. A developer api is going to have long methods / functions, simply because of error checking. Could you give me an example? Anything based on PEAR. I was going to point to http://pear.php.net/package/MDB2/docs/2.3.0/__filesource/fsource_MDB2__MDB2-2.3.0MDB2.php.html which has 4,000 lines of code in one file, but then I realised it has multiple classes in the same file (which is usually a no-no as well). I had a quick glance at the file to see what the code looks like, and immediately spotted this: 290function setOptions($db, $options) 291{ 292if (is_array($options)) { 293foreach ($options as $option = $value) { 294$test = $db-setOption($option, $value); 295if (PEAR::isError($test)) { 296return $test; 297} 298} 299} 300return MDB2_OK; 301} The code is careful to not provoke a warning, but returns MDB2_OK if you screw up and give it a wrong type of value. It's long and has a bug. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] All-in-one PHP Classes
# [EMAIL PROTECTED] / 2007-02-08 01:14:43 +0100: 290function setOptions($db, $options) 291{ 292if (is_array($options)) { 293foreach ($options as $option = $value) { 294$test = $db-setOption($option, $value); 295if (PEAR::isError($test)) { 296return $test; 297} 298} 299} 300return MDB2_OK; 301} The code is careful to not provoke a warning, but returns MDB2_OK if you screw up and give it a wrong type of value. It's long and has a bug. Actually, that method being a static method of MDB2 is a bug in itself. Static methods produce hard-wired dependencies. The functionality is useful, but belongs to MDB2_driver_common. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text Editor for Windows?
I am finding that notepad is lacking when correcting syntax errors in my php code. No line numbers. What can people recommend for use under Windows? Thanks Stephen
Re: [PHP] Text Editor for Windows?
# [EMAIL PROTECTED] / 2007-02-07 20:49:13 -0500: I am finding that notepad is lacking when correcting syntax errors in my php code. No line numbers. What can people recommend for use under Windows? gvim.exe -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Text Editor for Windows?
I've Been using htmlkit for quite a few years now. I don't like it correcting my text on the fly (interrupts my train of thought), but it will highlight in color what type of text it thinks it is. For example when I start typing in a function name, it will change the color when what I have typed matches a standard function. This feature also works pretty well for letting me know when I'm inside a string value and forgot to escape an imbedded quote, the color is wrong. And the price is right. Try; http://www.chami.com/html-kit/download/ good luck, Warren Vail -Original Message- From: Stephen [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 5:49 PM To: php-general@lists.php.net Subject: [PHP] Text Editor for Windows? I am finding that notepad is lacking when correcting syntax errors in my php code. No line numbers. What can people recommend for use under Windows? Thanks Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Editor for Windows?
Stephen wrote: I am finding that notepad is lacking when correcting syntax errors in my php code. No line numbers. What can people recommend for use under Windows? Thanks Stephen I like UltraEdit. Has everything i need and then some. syntax Highlighting, code folding, variable completion and FTP support. http://www.ultraedit.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Find midpoint between two points
M5 wrote: I found a nice javascript function that takes two points of latitude and longitude and returns a midpoint. I'm now trying to rewrite in PHP, but having some problems. Here's the original javascript function, taken from http://www.movable-type.co.uk/scripts/LatLong.html : LatLong.midPoint = function(p1, p2) { var dLon = p2.lon - p1.lon; var Bx = Math.cos(p2.lat) * Math.cos(dLon); var By = Math.cos(p2.lat) * Math.sin(dLon); lat3 = Math.atan2(Math.sin(p1.lat)+Math.sin(p2.lat), Math.sqrt((Math.cos(p1.lat)+Bx)*(Math.cos(p1.lat)+Bx) + By*By ) ); lon3 = p1.lon + Math.atan2(By, Math.cos(p1.lat) + Bx); if (isNaN(lat3) || isNaN(lon3)) return null; return new LatLong(lat3*180/Math.PI, lon3*180/Math.PI); } And here's my PHP variant, which isn't working: function midpoint ($lat1, $lng1, $lat2, $lng2) { $dlng = $lng2 - $lng1; $Bx = cos($lat2) * cos($dlng); $By = cos($lat2) * sin($dlng); $lat3 = atan2(sin($lat1)+sin($lat2), sqrt((cos($lat1)+$Bx)*(cos($lat1)+$Bx) + $By*$By )); $lng3 = $lng1 + atan2($By, (cos($lat1) + $Bx)); $pi = pi(); return ($lat3*180)/$pi .' '. ($lng3*180)/$pi; } Any ideas why it's returning wrong values? Are you converting from degrees to radians? With identical input, the javascript function is identical to the PHP function (I tested to verify) I got this by reading at the bottom of the page: * Notes: trig functions take arguments in radians, so latitude, longitude, and bearings in degrees (either decimal or degrees/minutes/seconds) need to be converted to radians, rad = π.deg/180. When converting radians back to degrees (deg = 180.rad/π), West is negative if using signed decimal degrees. For bearings, values in the range -π to +π (-180° to +180°) need to be converted to 0 to +2π (0°–360°); this can be done by (brng+2.π)%2.π where % is the modulo operator. View page source to see JavaScript functions to handle these conversions. * The atan2() function widely used here takes two arguments, atan2(y, x), and computes the arc tangent of the ratio y/x. It is more flexible than atan(y/x), since it handles x=0, and it also returns values in all 4 quadrants -π to +π (the atan function returns values in the range -π/2 to +π/2). * If you implement any formula involving atan2 in Microsoft Excel, you will need to reverse the arguments, as Excel has them the opposite way around from JavaScript – conventional order is atan2(y, x), but Excel uses atan2(x, y) * For miles, divide km by 1.609344 * For nautical miles, divide km by 1.852 * Thanks to Ed Williams’ Aviation Formulary for many of the formulae Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Editor for Windows?
if you want a very lightweight use notepad2[1] i use php eclipse though :) [1] http://www.flos-freeware.ch/notepad2.html On 2/8/07, Ryan Fielding [EMAIL PROTECTED] wrote: Stephen wrote: I am finding that notepad is lacking when correcting syntax errors in my php code. No line numbers. What can people recommend for use under Windows? Thanks Stephen I like UltraEdit. Has everything i need and then some. syntax Highlighting, code folding, variable completion and FTP support. http://www.ultraedit.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- GMail Rocks!!!
[PHP] crazy time with str_replace()
Hello; I really am trying to use this as a last resort but sometimes the solution refuses to present itself just by swearing and staring and poking around with comments and print statements. line 197: $rdata = str_replace(// \$routes[] = '';\n, \$routes['$usr'] = '../$path/in';\n// \$routes[] = '';\n, $rdata); // this is not working line 223: $rrdata = str_replace(// \$routes[] = '';\n, \$routes['$user_long'] = '../$r/in';\n// \$routes[] = '';\n, $rrdata); // this is working These two lines are in a function I wrote. I add the line numbers to indicate that they are separated by some code. But they perform identical tasks on two different files with the identical names in two separate directories. As far as I can tell the target strings are identical in both of the files; initially, one file is a copy of the other, but change as array items are added. Or are supposed to. The string // $routes[] = '';\n is used as a template for adding new array items. (in the str_replace code, the $ is escaped with \ so it will be interpreted literally) The problem is the str_replace operation works on the $rrdata variable and not the $rdata variable. When testing the $rdata variable with a print statement, there is no change to the target string; I.E. // \$routes[] = '';\n is not replaced with \$routes['$usr'] = '../$path/in';\n// \$routes[] = '';\n. The file is a php file that i am trying to write to. There is no read errors on fopen nor fread on the file in the first line. The file that the first str_replace() is supposed to modify is in the same directory as the script that has this function. The function is included in another script file in the same directory. The second file that str_replace is working on is from a file opened in another directory. I have checked read and write permissions on both files and directories and found nothing i could point at as the cause of the failure and in fact I would expect the fopen function to fail if there was a permissions problem. It is obviously opening and reading the file successfully, as using print before the str_replace operation show that the file has been properly read into the $rdata variable. In case it is not clear, the two marks after the = sign in each line indicate an empty string surrounded by single quotes, that makes it appear to be one double quotation mark when it is not. Can anyone see what I am not seeing, or tell me something that I should be aware of that I may not be. thanks for your time; JK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unable to load Dynamic Link Library
Hi I have installed Apache2Triad Apache2Triadversion 1.5.4 Apache version 2.2.0 MySQL version 5.0.18 PostgreSQL version 8.1.2 Openssl version 0.9.8a Slimftpdversion 3.18 Xmail version 1.22 The php.ini file has the extension=php_curl.dll line enabled (uncommented) and the file is available in the windows installation directory. When starting PHP from command-line with PHP.exe, I get the following error. Please help, as I'm a PHP newbie. Regards, Viquar R. Shaikh ( Phone: +91 22 6695 3770 |) GDP: 695 3770 |) Mob: +91 9867611123 | + [EMAIL PROTECTED] - This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.
Re: [PHP] Unable to load Dynamic Link Library
[EMAIL PROTECTED] wrote: Hi I have installed Apache2Triad Apache2Triad version 1.5.4 Apache version 2.2.0 MySQL version 5.0.18 PostgreSQL version 8.1.2 Openssl version 0.9.8a Slimftpd version 3.18 Xmail version 1.22 The php.ini file has the *extension=php_curl.dll *line enabled (uncommented) and the file is available in the windows installation directory. When starting PHP from command-line with PHP.exe, I get the following error. Don't send screenshots. Copy/paste the errors. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to load Dynamic Link Library
Hi I have installed Apache2Triad Apache2Triadversion 1.5.4 Apache version 2.2.0 MySQL version 5.0.18 PostgreSQL version 8.1.2 Openssl version 0.9.8a Slimftpdversion 3.18 Xmail version 1.22 The php.ini file has the extension=php_curl.dll line enabled (uncommented) and the file is available in the windows installation directory. When starting PHP from command-line with PHP.exe, I get the following error. The first ScreenShot Runtime Error Program: C:\apache2triad\php\bin\php.exe R6034 An application has attempted to load the C runtime library incorrectly. Please contact the application's support team for more information The Second Screenshot PHP Startup : Unable to load dynamic link library 'C:\Apache2Triad\php\extensions\php_curl.dll' - A dynamic link library (DLL) initialization routine failed. Please help, as I'm a PHP newbie. Regards, Viquar R. Shaikh ( Phone: +91 22 6695 3770 |) GDP: 695 3770 |) Mob: +91 9867611123 | + [EMAIL PROTECTED] - This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.
RE: [PHP] what do i need to disable
I asked this question awhile ago and never really visited the issue till now. The response I got showed me how to disable everything, but I want to allow basic html tags. ~My original question~ My next task is disable harmful tags/scripts in a full text field. I want to store a bio type field and I am considering allowing html (to allow a MySpace type of customization to the page), but I am really new to this so I really don't know what kind of trouble I am asking for. I'm sure that I need to block JavaScript, but are there other things (tags, scripting, etc.) that can be input into my DB that will cause problems either being stored as such or when accessed? I'm thinking along the lines outlined below, I just need to complete the list and would like some assistance form the seasoned vets here. $bio = strtr($bio, script, ); $bio = strtr($bio, ?php, ); $bio = strtr($bio, ?, ); Again, thanks for the advice in advance. Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/MySQL Create DB user
There seems to be no PHP function to create a DB user. I am trying to automate setting up virtual domains in a shared environment. Am I missing something obvious? Thanks Stephen
Re: [PHP] PHP/MySQL Create DB user
Stephen wrote: There seems to be no PHP function to create a DB user. It doesn't have one to create a database either... php can't do everything for you ;) I am trying to automate setting up virtual domains in a shared environment. Am I missing something obvious? http://dev.mysql.com/doc/refman/4.1/en/user-account-management.html or if you're using mysql 5+, http://dev.mysql.com/doc/refman/5.0/en/create-user.html -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php