php-general Digest 25 Nov 2005 08:25:45 -0000 Issue 3814
php-general Digest 25 Nov 2005 08:25:45 - Issue 3814 Topics (messages 226417 through 226420): Re: Can't execute external program 226417 by: Sandy Keathley 226420 by: n.g. Re: Regexp trouble 226418 by: Frank Armitage session cookies, domain (host:port) issues 226419 by: anirudh dutt 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: php-general@lists.php.net -- ---BeginMessage--- Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? From the command line it runs perfectly A PHP script runs with the permissions of the user that Apache runs as, usually nobody. When run from the command line, it inherits a different set of permissions (i.e., root). One option would be to put a copy of the executable in another directory, but OUTSIDE of your DOCROOT, and give it the same ownership and perms as nobody (or whatever Apache runs as). Of course, this makes your script 100% non-portable, if that matters. It is also possible that the executable may not run, if it depends on compiled libraries elsewhere on the server. WebDesigns Internet Consulting E-commerce Solutions Application Development Sandy Keathley Zend Certified Engineer [EMAIL PROTECTED] 972-569-8464 http://www.KeathleyWebs.com/ ---End Message--- ---BeginMessage--- sorry , i have made mistake. `option +exec' is not required, and there is no such apache option. maybe you're running php in safe_mode ? On 11/24/05, n.g. [EMAIL PROTECTED] wrote: put the executable into another directory rather than DOC_ROOT, maybe you have reached apache security settings. or try add `option +exec' to your apache conf, but be aware this maybe a security problem to your site to do so. On 11/24/05, Henry Castillo [EMAIL PROTECTED] wrote: Hi Still desperate DOCUMENT_ROOT is /var/www/html Check all settings at http://provi.voicenetworx.net:8080/t.php From the command line it runs perfectly: [EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new (no output, it just creates the file .new) Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? On 11/22/05, n.g. [EMAIL PROTECTED] wrote: is /var/www/html your web root dir ? maybe its the plobrem. On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote: That was on of the first things I checked: safe mode is set to off Any ideas... Henry Voip tech said the following on 11/20/2005 10:31 PM: Hello, I cannot get exec(), system() or passthru() to run an extenal program. From the command line it runs perfectly: snip I'm getting frustrated, Any help will be deeply appreciated Henry The answer is probably in your php.ini. Look into whether you are running in safe mode or not, and if you are whether you have your program in the safe_mode_exec_dir or not. Also check disable_functions to see if any of the ones you are having trouble with are listed. - Ben -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) ---End Message--- ---BeginMessage--- Andy Pieters wrote: Err.. why NOT use character classes? What is easier [0-9] or \d or maybe [a-zA-Z] or [\w], ... ? Well, first of all the square brackets in [\w] aren't needed, \w already means 'any word character'. Secondly, [a-zA-Z] is not the same as \w: A word character is any letter or digit or the underscore character, that is, any character which can be part of a Perl word. The definition of letters and digits is controlled by PCRE's character tables, and may vary if locale-specific matching is taking place (see Locale support above). For example, in the fr (French) locale, some character codes greater than 128 are used for accented letters, and these are matched by \w. [http://www.php.net/manual/en/reference.pcre.pattern.syntax.php] Anyway I'm not really a great RegExp expert, a good starting point for understanding regexp and PHP is, as usual, the manual: http://www.php.net/manual/en/reference.pcre.pattern.syntax.php Bye! -- tradeOver | http://www.tradeover.net ...ready to become the King of the World? ---End Message--- ---BeginMessage--- hi some thoughts on session cookies... when setting the domain for the cookie, u could use $_SERVER['HTTP_HOST'] which would be 'example.com' or 'www.example.com' i.e. session_set_cookie_params(30*60, '/', $_SERVER['HTTP_HOST'],
[PHP] Re: Can't execute external program
sorry , i have made mistake. `option +exec' is not required, and there is no such apache option. maybe you're running php in safe_mode ? On 11/24/05, n.g. [EMAIL PROTECTED] wrote: put the executable into another directory rather than DOC_ROOT, maybe you have reached apache security settings. or try add `option +exec' to your apache conf, but be aware this maybe a security problem to your site to do so. On 11/24/05, Henry Castillo [EMAIL PROTECTED] wrote: Hi Still desperate DOCUMENT_ROOT is /var/www/html Check all settings at http://provi.voicenetworx.net:8080/t.php From the command line it runs perfectly: [EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new (no output, it just creates the file .new) Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? On 11/22/05, n.g. [EMAIL PROTECTED] wrote: is /var/www/html your web root dir ? maybe its the plobrem. On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote: That was on of the first things I checked: safe mode is set to off Any ideas... Henry Voip tech said the following on 11/20/2005 10:31 PM: Hello, I cannot get exec(), system() or passthru() to run an extenal program. From the command line it runs perfectly: snip I'm getting frustrated, Any help will be deeply appreciated Henry The answer is probably in your php.ini. Look into whether you are running in safe mode or not, and if you are whether you have your program in the safe_mode_exec_dir or not. Also check disable_functions to see if any of the ones you are having trouble with are listed. - Ben -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can't execute external program
or `sample1.new' was created in some other directory, for exampe, the cwd of apache server process. do a search to find it , or use full path in your commandh line. On 11/25/05, n.g. [EMAIL PROTECTED] wrote: sorry , i have made mistake. `option +exec' is not required, and there is no such apache option. maybe you're running php in safe_mode ? On 11/24/05, n.g. [EMAIL PROTECTED] wrote: put the executable into another directory rather than DOC_ROOT, maybe you have reached apache security settings. or try add `option +exec' to your apache conf, but be aware this maybe a security problem to your site to do so. On 11/24/05, Henry Castillo [EMAIL PROTECTED] wrote: Hi Still desperate DOCUMENT_ROOT is /var/www/html Check all settings at http://provi.voicenetworx.net:8080/t.php From the command line it runs perfectly: [EMAIL PROTECTED] html]# /var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new (no output, it just creates the file .new) Here is the php I've created, fairly simple: ?php exec(/var/www/html/myprog -E 123456789098.dat sample1.txt sample1.new); phpinfo(); ? On 11/22/05, n.g. [EMAIL PROTECTED] wrote: is /var/www/html your web root dir ? maybe its the plobrem. On 11/23/05, Henry Castillo [EMAIL PROTECTED] wrote: That was on of the first things I checked: safe mode is set to off Any ideas... Henry Voip tech said the following on 11/20/2005 10:31 PM: Hello, I cannot get exec(), system() or passthru() to run an extenal program. From the command line it runs perfectly: snip I'm getting frustrated, Any help will be deeply appreciated Henry The answer is probably in your php.ini. Look into whether you are running in safe mode or not, and if you are whether you have your program in the safe_mode_exec_dir or not. Also check disable_functions to see if any of the ones you are having trouble with are listed. - Ben -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- Tomorrow will be a good day :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is ?=
I have some scripts that I downloaded and am trying to make compliant with my server. They have ?= placed throughout and I am not sure what they are and how to fix them at this point. Stupid question, I know, but... Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is ?=
Robert, ?= is short for ?php echo Cheers, David Grant Wolf wrote: I have some scripts that I downloaded and am trying to make compliant with my server. They have ?= placed throughout and I am not sure what they are and how to fix them at this point. Stupid question, I know, but... Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is ?=
Its same as ? echo ? or ?php echo ... ? Wolf wrote: I have some scripts that I downloaded and am trying to make compliant with my server. They have ?= placed throughout and I am not sure what they are and how to fix them at this point. Stupid question, I know, but... Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is ?=
Wolf wrote: I have some scripts that I downloaded and am trying to make compliant with my server. They have ?= placed throughout and I am not sure what they are and how to fix them at this point. Stupid question, I know, but... not stupid, although a 'google' might have helped, regardless you have already had the answer. I find it funny that you say 'fix them' - one of the things [some of] the core developers are looking to get rid of is this shorthand syntax (according to posts on internals@lists.php.net) ... something to do with XML compatibility ... for now its valid php syntax though :-). Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is ?=
? is how XML specifies a processing instruction for the XML parser, for example: ?xml version=1.0? Tells the parser that the XML it is parsing is version 1. Jochem Maas wrote: Wolf wrote: I have some scripts that I downloaded and am trying to make compliant with my server. They have ?= placed throughout and I am not sure what they are and how to fix them at this point. Stupid question, I know, but... not stupid, although a 'google' might have helped, regardless you have already had the answer. I find it funny that you say 'fix them' - one of the things [some of] the core developers are looking to get rid of is this shorthand syntax (according to posts on internals@lists.php.net) ... something to do with XML compatibility ... for now its valid php syntax though :-). Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php scripts that communicated with Windows Media Server
Does anyone know if there are any repositories of php scripts that communicate with Windows Media Server... I am looking for stuff like getting the number of connected users, and etc I have seen perl scripts that do this...but not php anyone know ? g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing objects between pages
What is the best way to pass an object between pages? Currently I am first serializing, then doing a base64_encode, this doesn't seem entirely efficient. (Especially the encode). I am however using the encode because I have the serialized object as the value of a hidden form element. I can only have alphanumerics here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Any performance experiences to offer?
Are there any benchmarks that people are aware of comparing PHP4|PHP5|PHP5.1 as far as performance is concerned? I mean, it's easy to say that performance is improved... but what's the baseline? Was PHP5 faster than PHP4 for identical code? Thus making PHP5.1 even faster? Or was it a case of PHP5 being a bit more bulky than PHP4, thus PHP5.1 bringing it more inline with the old performance. I'm looking to upgrade of PHP 4.4.1 installs, but I'm holding off on PHP5.1 until eaccelerator (open source PHP accelerator) becomes compatible. As it is, PHP5.0.5 is the last supported version. But if 5.0.5 is slower than 4.4.1, I'll hold off. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array woes
Hello all, I have some array code driving me nuts. I am pulling from a db: select id, vehicle, has_quotes from cars where active=1 I then loop through these and build an array that contains the id's and cars. while($res){ $cars[$res[id]]=$res[vehicle]; //here is the problem, when has_quotes is 1, I call another function to grab the quotes if ($res[has_quotes]1){ $cars[$res[id]]=grabQuotes($res[id]); } } The grabQuotes function returns an array and works fine. THe problem is when I go to display these, I cycle through the car array printing id and vehicle name. I do a check so if vehicle name is an array, I print out the quotes from the inner array, problem is I have lost the vehicle name! How can I fix this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] swaping numerical index for keys
Hi, I've an array : $ls_statfields=array( rfile =0, file =1, dev =2, ino =3, mode =4, nlink =5, uid =6, gid =7, rdev =8, size =9, atime =10, mtime =11, ctime =12, blksize =13, blocks =14 ); Which is the correspondance between the numerical and keys for stat before PHP 4.0.6 : http://uk.php.net/manual/en/function.stat.php What would be the fastest solution to transform the result from stat to the one with the keys (before 4.0.6 :-) ? (i.e. Exchanging numerical indexing the for hash keys in the ls_statfields ?) -- Pooly Webzine Rock : http://www.w-fenec.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array woes
Within grabQuotes(); if you do a var_dump($arg); (where $arg is $res[id]) is your vehicle name displayed? If it is, and you're using it correctly, make sure you're returning the value you'd like correctly. It might help to post your grabQuotes function as well as the code that displays $cars[]. Matt blackwater dev [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I have some array code driving me nuts. I am pulling from a db: select id, vehicle, has_quotes from cars where active=1 I then loop through these and build an array that contains the id's and cars. while($res){ $cars[$res[id]]=$res[vehicle]; //here is the problem, when has_quotes is 1, I call another function to grab the quotes if ($res[has_quotes]1){ $cars[$res[id]]=grabQuotes($res[id]); } } The grabQuotes function returns an array and works fine. THe problem is when I go to display these, I cycle through the car array printing id and vehicle name. I do a check so if vehicle name is an array, I print out the quotes from the inner array, problem is I have lost the vehicle name! How can I fix this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: swaping numerical index for keys
function addAssoc($ary_stat) { $ls_statfields = array(.); while ($assoc = each($ls_statfields)) { $ary_stat[$assoc['key']] = $ary_stat[$assoc['value']]; } return $ary_stat; } This should do what you want. I'm not sure if you want to remove the numeric keys entirely, but after this function they still exist. Matt Pooly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I've an array : $ls_statfields=array( rfile =0, file =1, dev =2, ino =3, mode =4, nlink =5, uid =6, gid =7, rdev =8, size =9, atime =10, mtime =11, ctime =12, blksize =13, blocks =14 ); Which is the correspondance between the numerical and keys for stat before PHP 4.0.6 : http://uk.php.net/manual/en/function.stat.php What would be the fastest solution to transform the result from stat to the one with the keys (before 4.0.6 :-) ? (i.e. Exchanging numerical indexing the for hash keys in the ls_statfields ?) -- Pooly Webzine Rock : http://www.w-fenec.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_GET and $_POST arrays not working
Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: ** *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* Is this a problem with configuration or is there a bug in PHP, thanks in advance
Re: [PHP] Passing objects between pages
Do you mean passing the class statement or the vars? couldn't you format the vars into mysql and pull them? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: What is the best way to pass an object between pages? Currently I am first serializing, then doing a base64_encode, this doesn't seem entirely efficient. (Especially the encode). I am however using the encode because I have the serialized object as the value of a hidden form element. I can only have alphanumerics here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and $_POST arrays not working
Hi, Friday, November 25, 2005, 10:22:46 PM, you wrote: Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: Is this a problem with configuration or is there a bug in PHP, thanks in advance If it was a PHP bug I think a few more people may notice it ;) Try dumping out the values of the arrays, see what they say: print_r($_GET); print_r($_POST); etc Cheers, Rich -- Zend Certified Engineer PHP Development Services http://www.corephp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and $_POST arrays not working
Well it returned all values with print_r(); but i can't access them... this is what the page returns: Array ( [Username] = SFF [Password] = dSF [EMail] = sfdf ) Array ( ) *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *6* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *7* On 11/25/05, Richard Davey [EMAIL PROTECTED] wrote: Hi, Friday, November 25, 2005, 10:22:46 PM, you wrote: Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: Is this a problem with configuration or is there a bug in PHP, thanks in advance If it was a PHP bug I think a few more people may notice it ;) Try dumping out the values of the arrays, see what they say: print_r($_GET); print_r($_POST); etc Cheers, Rich -- Zend Certified Engineer PHP Development Services http://www.corephp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_GET and $_POST arrays not working
In php.ini (most likely located in your windows directory) look for the globals section and turn register_globals = on Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: ** *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* Is this a problem with configuration or is there a bug in PHP, thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing objects between pages
I mean the object itself, not the class (the file containing the class definition is included on all necessary pages with require_once(file.inc.php); I want to create an object on one page ($obj = new MyClass();) and have it on other pages, all members and functions intact. Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Do you mean passing the class statement or the vars? couldn't you format the vars into mysql and pull them? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: What is the best way to pass an object between pages? Currently I am first serializing, then doing a base64_encode, this doesn't seem entirely efficient. (Especially the encode). I am however using the encode because I have the serialized object as the value of a hidden form element. I can only have alphanumerics here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_GET and $_POST arrays not working
Doesn't that cause security problems? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: In php.ini (most likely located in your windows directory) look for the globals section and turn register_globals = on Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: ** *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* Is this a problem with configuration or is there a bug in PHP, thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] $_GET and $_POST arrays not working
Hi Unknown, Friday, November 25, 2005, 10:38:02 PM, you wrote: Well it returned all values with print_r(); but i can't access them... this is what the page returns: Post your code, there's an error in it if the $_POST etc arrays are populated, but you can't access them. Cheers, Rich -- Zend Certified Engineer PHP Development Services http://www.corephp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing objects between pages
Well the functions won't need to be copied, but can't you put the properties into a MySQL or other database? Then on a page that you need the properties you pull them from the table? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: I mean the object itself, not the class (the file containing the class definition is included on all necessary pages with require_once(file.inc.php); I want to create an object on one page ($obj = new MyClass();) and have it on other pages, all members and functions intact. Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Do you mean passing the class statement or the vars? couldn't you format the vars into mysql and pull them? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: What is the best way to pass an object between pages? Currently I am first serializing, then doing a base64_encode, this doesn't seem entirely efficient. (Especially the encode). I am however using the encode because I have the serialized object as the value of a hidden form element. I can only have alphanumerics here. -- 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] $_GET and $_POST arrays not working
You would access them by declaring them as regular variables and then using the regular variables in your code. ?php $username = $_POST['Username']; $password = $_POST['Password']; $email = $_POST['Email']; ? As a side note - please do NOT turn global variables on in your php.ini file. There is a good reason for why it is shut off and good php does not need to have it turned on. Hope that helps . ?php /* Stephen Johnson c | eh The Lone Coder http://www.ouradoptionblog.com Join our journey of adoption http://www.thelonecoder.com [EMAIL PROTECTED] continuing the struggle against bad code */ ? From: Unknown Unknown [EMAIL PROTECTED] Date: Fri, 25 Nov 2005 17:38:02 -0500 To: Richard Davey [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] $_GET and $_POST arrays not working -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and $_POST arrays not working
I refer to them as: $Username=$_POST['Username']; $Password=$_POST['Password']; $EMail=$_POST['EMail']; and on the form i have method=post so I don't know why this is not working On 11/25/05, Stephen Johnson [EMAIL PROTECTED] wrote: You would access them by declaring them as regular variables and then using the regular variables in your code. ?php $username = $_POST['Username']; $password = $_POST['Password']; $email = $_POST['Email']; ? As a side note - please do NOT turn global variables on in your php.ini file. There is a good reason for why it is shut off and good php does not need to have it turned on. Hope that helps . ?php /* Stephen Johnson c | eh The Lone Coder http://www.ouradoptionblog.com Join our journey of adoption http://www.thelonecoder.com [EMAIL PROTECTED] continuing the struggle against bad code */ ? From: Unknown Unknown [EMAIL PROTECTED] Date: Fri, 25 Nov 2005 17:38:02 -0500 To: Richard Davey [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] $_GET and $_POST arrays not working
Re: [PHP] Any performance experiences to offer?
PHP5 code is faster generally, and OOP is also accelerated a lot On 11/25/05, Tim Meader [EMAIL PROTECTED] wrote: Are there any benchmarks that people are aware of comparing PHP4|PHP5|PHP5.1 as far as performance is concerned? I mean, it's easy to say that performance is improved... but what's the baseline? Was PHP5 faster than PHP4 for identical code? Thus making PHP5.1 even faster? Or was it a case of PHP5 being a bit more bulky than PHP4, thus PHP5.1 bringing it more inline with the old performance. I'm looking to upgrade of PHP 4.4.1 installs, but I'm holding off on PHP5.1 until eaccelerator (open source PHP accelerator) becomes compatible. As it is, PHP5.0.5 is the last supported version. But if 5.0.5 is slower than 4.4.1, I'll hold off. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Re: $_GET and $_POST arrays not working
Hi, Friday, November 25, 2005, 10:43:20 PM, you wrote: Doesn't that cause security problems? Yes. Post your *whole* code, not just snippets of it. Cheers, Rich -- Zend Certified Engineer PHP Development Services http://www.corephp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Re: $_GET and $_POST arrays not working
Wow somehow I fixed the error, I don't really know how... oh well
Re: [PHP] Re: $_GET and $_POST arrays not working
Somewhat, but its what you need to do for the post and get arrays to work. What you need to do is make sure check the values in the global variables before you use them. For example if on one page you have a form for a user signup and input type=text name='userName' on the next page $_POST['userName'] should be checked for things like quotes and other characters that will alter your SQL statement before you actually INSERT that value into your table. Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Doesn't that cause security problems? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: In php.ini (most likely located in your windows directory) look for the globals section and turn register_globals = on Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: ** *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* Is this a problem with configuration or is there a bug in PHP, thanks in advance -- 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] Passing objects between pages
I know the functions don't need to be copied. I would like to easily transport the objects (not the class) between pages using a form. I'm pretty sure the serialize() function can't be avoided (otherwise all that will be passed is a string with a value like Object ID: #55) but how can I get around the base64_encode() so the serialized object can be the value of a checkbox? $obj = new MyClass(); $obj = serialize($obj); $obj = base64_encode($obj); //I would like to eliminate this line input type=checkbox name='fieldName' value='$obj' So on the next page I have to decode and deserialize $obj = $_POST['fieldName']; $obj = base64_decode($obj); $obj = unserialize($obj); echo $obj-member; $obj-function(); Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well the functions won't need to be copied, but can't you put the properties into a MySQL or other database? Then on a page that you need the properties you pull them from the table? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: I mean the object itself, not the class (the file containing the class definition is included on all necessary pages with require_once(file.inc.php); I want to create an object on one page ($obj = new MyClass();) and have it on other pages, all members and functions intact. Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Do you mean passing the class statement or the vars? couldn't you format the vars into mysql and pull them? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: What is the best way to pass an object between pages? Currently I am first serializing, then doing a base64_encode, this doesn't seem entirely efficient. (Especially the encode). I am however using the encode because I have the serialized object as the value of a hidden form element. I can only have alphanumerics here. -- 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] Re: $_GET and $_POST arrays not working
could you give us all source lines, just cut and paste ? hy ag. 2005/11/26, Matt Monaco [EMAIL PROTECTED]: Somewhat, but its what you need to do for the post and get arrays to work. What you need to do is make sure check the values in the global variables before you use them. For example if on one page you have a form for a user signup and input type=text name='userName' on the next page $_POST['userName'] should be checked for things like quotes and other characters that will alter your SQL statement before you actually INSERT that value into your table. Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Doesn't that cause security problems? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: In php.ini (most likely located in your windows directory) look for the globals section and turn register_globals = on Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: ** *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* Is this a problem with configuration or is there a bug in PHP, thanks in advance -- 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] Re: $_GET and $_POST arrays not working
I used SQLyog and it's formated corectly though when i release it i will do that Also i have a login script, same same problem i'l see what will work On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: Somewhat, but its what you need to do for the post and get arrays to work. What you need to do is make sure check the values in the global variables before you use them. For example if on one page you have a form for a user signup and input type=text name='userName' on the next page $_POST['userName'] should be checked for things like quotes and other characters that will alter your SQL statement before you actually INSERT that value into your table. Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Doesn't that cause security problems? On 11/25/05, Matt Monaco [EMAIL PROTECTED] wrote: In php.ini (most likely located in your windows directory) look for the globals section and turn register_globals = on Matt Unknown Unknown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, i am running PHP 5 on Windows XP Pro SP2, my $_GET and $_POST arrays do not seem to be working, I am Sure I am spelling them right, but i keep getting the errors: ** *Notice*: Undefined index: Username in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *3* *Notice*: Undefined index: Password in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *4* *Notice*: Undefined index: EMail in * D:\Apache\Apache(re)\Apache2\htdocs\RegisterP.php* on line *5* Is this a problem with configuration or is there a bug in PHP, thanks in advance -- 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: http protocols defining what gets sent between web server and browser
On 2005-11-24, bruce [EMAIL PROTECTED] wrote: I'm working on a project, and need to know if there's anyone who's a guru with Web Server/Client interactions. Basically, I'm trying to get a much better/deeper understanding of the HTTP protocols defining the information that is sent/transfered between the web server/client browser apps. There is an article about HTTP on Wikipedia.org and from there you find a link to RFC2616. So, if you have the skills/expertise in this area, and you're willing to talk to me for a few minutes, I'd appreciate it. As stated, the underlying reason for the questions is to get a better understanding of 'man in the middle attacks' as this applies to web server apps. In that case you might want to look at tcp/ip and http over ssl too. -- Met vriendelijke groeten, Tim Van Wassenhove http://timvw.madoka.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_GET and $_POST arrays not working
Matt Monaco wrote: Somewhat, but its what you need to do for the post and get arrays to work. snip No. Things like $_POST and $_GET are global arrays and work regardless of the register_globals setting. The information you're handing out above is wrong and dangerous. /snip What you need to do is make sure check the values in the global variables before you use them. For example if on one page you have a form for a user signup and input type=text name='userName' on the next page $_POST['userName'] should be checked for things like quotes and other characters that will alter your SQL statement before you actually INSERT that value into your table. ie they should be sanitized. Things like mysql_real_escape_string() or adding slashes (depending on your magic_quotes setting) should be done prior to inserting any data. Also, you should check to ensure that it's the data you expect; if you only allow usernames to contain alpha-numeric characters, then you should check for that. Toss is out if it contains something else. Best rule of thumb: Never trust user input, regardless of the register_globals setting. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_GET and $_POST arrays not working
I apologize, but I've never been able to access $_POST and $_GET in any context whatsoever without first turning on the register globals. John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Monaco wrote: Somewhat, but its what you need to do for the post and get arrays to work. snip No. Things like $_POST and $_GET are global arrays and work regardless of the register_globals setting. The information you're handing out above is wrong and dangerous. /snip What you need to do is make sure check the values in the global variables before you use them. For example if on one page you have a form for a user signup and input type=text name='userName' on the next page $_POST['userName'] should be checked for things like quotes and other characters that will alter your SQL statement before you actually INSERT that value into your table. ie they should be sanitized. Things like mysql_real_escape_string() or adding slashes (depending on your magic_quotes setting) should be done prior to inserting any data. Also, you should check to ensure that it's the data you expect; if you only allow usernames to contain alpha-numeric characters, then you should check for that. Toss is out if it contains something else. Best rule of thumb: Never trust user input, regardless of the register_globals setting. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Re: $_GET and $_POST arrays not working
Hi Matt, Saturday, November 26, 2005, 12:42:16 AM, you wrote: I apologize, but I've never been able to access $_POST and $_GET in any context whatsoever without first turning on the register globals. You have a seriously foobared installation of PHP then! :) Cheers, Rich -- Zend Certified Engineer PHP Development Services http://www.corephp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_GET and $_POST arrays not working
Matt Monaco wrote: I apologize, but I've never been able to access $_POST and $_GET in any context whatsoever without first turning on the register globals. If you have a form like this one one page... form action=page2.php method=post input type=hidden name=foo value=bar / input type=submit / /form And this on page2.php... ?php echo ( $_POST['foo'] ); ? And the output on page2.php is not 'bar' when you submit the form, something is very wrong with your install. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli unclonable object
On Wed, Nov 23, 2005 at 11:43:56PM -0500, Matt Monaco wrote: I get string(1) , should that be taken just the same as 0? In addition phpinfo() indicates php 5.0.4 - does the upgrade to .5 involve remove .4 first? I'm not sure how you are getting 'string(1) ' with php5.0.x you should have either: string(1) 1 string(0) The upgrade from .4 to .5 depends on how you installed it originally, if you installed it from source then you can re-configure .5 with the same options as you did with .4, you can get your configure command with something like: php -i | grep 'Configure Command' Curt. btw, as I'm new to the mailing list thing, why do some names appear in quotes and others do not? I'm not sure what you mean by this. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_GET and $_POST arrays not working
Well, I turned them off and it worked as it apparently should. It was just a setting I read I had to make for globals to work the first time I install PHP. I've made that change ever since. I've always wondered why these variables - which I consider really important, need to be turned on. Matt John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Monaco wrote: I apologize, but I've never been able to access $_POST and $_GET in any context whatsoever without first turning on the register globals. If you have a form like this one one page... form action=page2.php method=post input type=hidden name=foo value=bar / input type=submit / /form And this on page2.php... ?php echo ( $_POST['foo'] ); ? And the output on page2.php is not 'bar' when you submit the form, something is very wrong with your install. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli unclonable object
In outlook express by default the headers are displayed as some icons and then subject, from, sent, size. For some people From is displayed in double quotes, and others not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Any performance experiences to offer?
Tim Meader schrieb: Was PHP5 faster than PHP4 for identical code? Thus making PHP5.1 even faster? Or was it a case of PHP5 being a bit more bulky than PHP4, thus PHP5.1 bringing it more inline with the old performance. I'm looking to upgrade of PHP 4.4.1 installs, but I'm holding off on PHP5.1 until eaccelerator (open source PHP accelerator) becomes compatible. As it is, PHP5.0.5 is the last supported version. But if 5.0.5 is slower than 4.4.1, I'll hold off. That depends... For typical PHP4 applications (little to no class stuff) I've heard of benchmarks showing PHP5 to be slower than PHP4. These issues should be fixed with the 5.1 release. If you intend to make use of OOP features then PHP5 is not only faster but a lot of them simply aren't available with PHP4. OLLi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php