Re: [PHP] global variable does not exist anymore?
Thank you very much. === On Fri, 27 Jul 2007 00:26:24 -0500 (CDT) "Richard Lynch" <[EMAIL PROTECTED]> wrote: > It's register_globals, and you should fix this ancient script to not > rely on register_globals being "on" > > On Wed, July 25, 2007 5:30 pm, Patrik Hasibuan wrote: > > Dear my friends... > > > > I create a very simple script in html and php as a first step. I use > > suse, apache2, mysql and php. > > > > I wonder why this script does not work: > > > > > > > > > >> http-equiv="content-type"> > > Guru - Virtual bookstore who understands you for those want > > to be a GURU > > > > > > > > > > > > Help us for statistic data collection for increasing our service by > > 'filling our guestbook'. > > > > > > Name: > name="tfnama"> > > Location: > type="text" name="tflokasi"> > > E-Mail: > name="tfemail"> > > URL: > name="tfurl"> > > Comments: > type="text" name="tfkomentar"> > > > align="left"> > > > > > > > > > > > > > > The value of "tfnama" is empty. > > cgi/cgibukutamu.php > > > > > > > > Name > ?> > > > > > > > > I had a look the into the "/etc/apache2" but I didn't find any > > "global_variable" switch as I used to find in httpd.conf > > " > > suseonthelap:/etc/apache2 # grep -n -r "global_variable" ./* > > suseonthelap:/etc/apache2 # > > " > > > > I got used to find "global_variable=on" line in the httpd.conf. > > > > What should I do now? Please tell me. > > -- > > Patrik Hasibuan <[EMAIL PROTECTED]> > > Junior Programmer > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some indie artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? > > > -- Patrik Hasibuan <[EMAIL PROTECTED]> Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable does not exist anymore?
OK, Thanks Richards. === On Wed, 25 Jul 2007 23:54:37 +0100 Richard Davey <[EMAIL PROTECTED]> wrote: > Hi Patrik, > > Wednesday, July 25, 2007, 11:30:56 PM, you wrote: > > > Dear my friends... > > > I create a very simple script in html and php as a first step. I use suse, > > apache2, mysql and php. > > > I wonder why this script does not work: > > > > > > > > > > > Guru - Virtual bookstore who understands you for those want to be > > a GURU > > > > > > > > > Help us for statistic data collection for increasing our service by > > 'filling our guestbook'. > > > > > > Name: > type="text" name="tfnama"> > > Location: > type="text" name="tflokasi"> > > E-Mail: > type="text" name="tfemail"> > > URL: > name="tfurl"> > > Comments: > type="text" name="tfkomentar"> > > > align="left"> > > > > > > > > > > > > The value of "tfnama" is empty. > > cgi/cgibukutamu.php > > > > > > > > Name > ?> > > > > > > > I had a look the into the "/etc/apache2" but I didn't find any > > "global_variable" switch as I used to find in httpd.conf > > " > > suseonthelap:/etc/apache2 # grep -n -r "global_variable" ./* > > suseonthelap:/etc/apache2 # > > " > > > I got used to find "global_variable=on" line in the httpd.conf. > > Try looking in php.ini > > Then leave it disabled, and code your script properly so it checks the > user input and validates it before using it. > > Cheers, > > Rich > -- > Zend Certified Engineer > http://www.corephp.co.uk > > "Never trust a computer you can't throw out of a window" > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Patrik Hasibuan <[EMAIL PROTECTED]> Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable does not exist anymore?
It's register_globals, and you should fix this ancient script to not rely on register_globals being "on" On Wed, July 25, 2007 5:30 pm, Patrik Hasibuan wrote: > Dear my friends... > > I create a very simple script in html and php as a first step. I use > suse, apache2, mysql and php. > > I wonder why this script does not work: > > > > >http-equiv="content-type"> > Guru - Virtual bookstore who understands you for those want > to be a GURU > > > > > > Help us for statistic data collection for increasing our service by > 'filling our guestbook'. > > > Name: name="tfnama"> > Location: type="text" name="tflokasi"> > E-Mail: name="tfemail"> > URL: name="tfurl"> > Comments: type="text" name="tfkomentar"> > align="left"> > > > > > > > The value of "tfnama" is empty. > cgi/cgibukutamu.php > > > > Name ?> > > > > I had a look the into the "/etc/apache2" but I didn't find any > "global_variable" switch as I used to find in httpd.conf > " > suseonthelap:/etc/apache2 # grep -n -r "global_variable" ./* > suseonthelap:/etc/apache2 # > " > > I got used to find "global_variable=on" line in the httpd.conf. > > What should I do now? Please tell me. > -- > Patrik Hasibuan <[EMAIL PROTECTED]> > Junior Programmer > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable does not exist anymore?
Hi Richard, You solved my problem. Thank you very...very much. === On Wed, 25 Jul 2007 23:54:37 +0100 Richard Davey <[EMAIL PROTECTED]> wrote: > Hi Patrik, > > Wednesday, July 25, 2007, 11:30:56 PM, you wrote: > > > Dear my friends... > > > I create a very simple script in html and php as a first step. I use suse, > > apache2, mysql and php. > > > I wonder why this script does not work: > > > > > > > > > > > Guru - Virtual bookstore who understands you for those want to be > > a GURU > > > > > > > > > Help us for statistic data collection for increasing our service by > > 'filling our guestbook'. > > > > > > Name: > type="text" name="tfnama"> > > Location: > type="text" name="tflokasi"> > > E-Mail: > type="text" name="tfemail"> > > URL: > name="tfurl"> > > Comments: > type="text" name="tfkomentar"> > > > align="left"> > > > > > > > > > > > > The value of "tfnama" is empty. > > cgi/cgibukutamu.php > > > > > > > > Name > ?> > > > > > > > I had a look the into the "/etc/apache2" but I didn't find any > > "global_variable" switch as I used to find in httpd.conf > > " > > suseonthelap:/etc/apache2 # grep -n -r "global_variable" ./* > > suseonthelap:/etc/apache2 # > > " > > > I got used to find "global_variable=on" line in the httpd.conf. > > Try looking in php.ini > > Then leave it disabled, and code your script properly so it checks the > user input and validates it before using it. > > Cheers, > > Rich > -- > Zend Certified Engineer > http://www.corephp.co.uk > > "Never trust a computer you can't throw out of a window" > > > -- Patrik Hasibuan <[EMAIL PROTECTED]> Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable does not exist anymore?
Hi Patrik, Wednesday, July 25, 2007, 11:30:56 PM, you wrote: > Dear my friends... > I create a very simple script in html and php as a first step. I use suse, > apache2, mysql and php. > I wonder why this script does not work: > > > > > Guru - Virtual bookstore who understands you for those want to be a > GURU > > > Help us for statistic data collection for increasing our service by 'filling > our guestbook'. > > > Name: type="text" name="tfnama"> > Location: type="text" name="tflokasi"> > E-Mail: type="text" name="tfemail"> > URL: name="tfurl"> > Comments: type="text" name="tfkomentar"> > align="left"> > > > > > The value of "tfnama" is empty. > cgi/cgibukutamu.php > > > > Name ?> > > > I had a look the into the "/etc/apache2" but I didn't find any > "global_variable" switch as I used to find in httpd.conf > " > suseonthelap:/etc/apache2 # grep -n -r "global_variable" ./* > suseonthelap:/etc/apache2 # > " > I got used to find "global_variable=on" line in the httpd.conf. Try looking in php.ini Then leave it disabled, and code your script properly so it checks the user input and validates it before using it. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] global variable does not exist anymore?
Dear my friends... I create a very simple script in html and php as a first step. I use suse, apache2, mysql and php. I wonder why this script does not work: Guru - Virtual bookstore who understands you for those want to be a GURU Help us for statistic data collection for increasing our service by 'filling our guestbook'. Name: Location: E-Mail: URL: Comments: The value of "tfnama" is empty. cgi/cgibukutamu.php Name I had a look the into the "/etc/apache2" but I didn't find any "global_variable" switch as I used to find in httpd.conf " suseonthelap:/etc/apache2 # grep -n -r "global_variable" ./* suseonthelap:/etc/apache2 # " I got used to find "global_variable=on" line in the httpd.conf. What should I do now? Please tell me. -- Patrik Hasibuan <[EMAIL PROTECTED]> Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable declaration
At 10:46 AM 2/8/2006, suresh kumar wrote: hai, this is my sample code: i am having user table with SponsorID as one field in mysql database,this is my query; for($j=0;$j<5;$j++): $result=mysql_query("select * from user where SponsorID='$id[$j]' "); endfor; in above code when i print mysql_num_rows($result) inside for loop its output is 5.when i print outside the for loop its o/p is 0.I searched weberdev.com website and declared $result as global.but same output 0.i want $result variable to be available outsibe the forloop and all other part of my code.i am looking forward suggestions from ur side. A.suresh Did you read up on global vars and use of the "global" key word in functions? Also check mysql_query() in the docs and what it returns. It's more of a handle than anything else. Finally, given you example you will have to use $result inside your loop. Regards - Miles Thompson -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.15.2/253 - Release Date: 2/7/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] global variable declaration
[snip] for($j=0;$j<5;$j++): $result=mysql_query("select * from user where SponsorID='$id[$j]' "); endfor; in above code when i print mysql_num_rows($result) inside for loop its output is 5.when i print outside the for loop its o/p is 0.I searched weberdev.com website and declared $result as global.but same output 0.i want $result variable to be available outsibe the forloop and all other part of my code.i am looking forward suggestions from ur side. [/snip] You are running the query 5 times, to the mysql_num_rows($result) value will be different each time through the for loop. Try this and you'll see for($j=0;$j<5;$j++): $result=mysql_query("select * from user where SponsorID='$id[$j]' "); echo $j . " " . mysql_num_rows($result) . "\n"; endfor; The output will be 0 some number of rows 1 some number of rows 2 some number of rows 3 some number of rows 4 some number of rows My bet is that the last row will have 0 rows -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable declaration
On 8 Feb 2006, at 14:46, suresh kumar wrote: this is my sample code: i am having user table with SponsorID as one field in mysql database,this is my query; for($j=0;$j<5;$j++): $result=mysql_query("select * from user where SponsorID='$id [$j]' "); endfor; in above code when i print mysql_num_rows($result) inside for loop its output is 5.when i print outside the for loop its o/ p is 0.I searched weberdev.com website and declared $result as global.but same output 0.i want $result variable to be available outsibe the forloop and all other part of my code.i am looking forward suggestions from ur side. $result is being over-written each time it goes through the for loop. So it will only ever contain the value of SponsorID=$id[4], which if empty will mean the number of rows inside $result will be zero. Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] global variable declaration
hai, this is my sample code: i am having user table with SponsorID as one field in mysql database,this is my query; for($j=0;$j<5;$j++): $result=mysql_query("select * from user where SponsorID='$id[$j]' "); endfor; in above code when i print mysql_num_rows($result) inside for loop its output is 5.when i print outside the for loop its o/p is 0.I searched weberdev.com website and declared $result as global.but same output 0.i want $result variable to be available outsibe the forloop and all other part of my code.i am looking forward suggestions from ur side. A.suresh - Jiyo cricket on Yahoo! India cricket Yahoo! Messenger Mobile Stay in touch with your buddies all the time.
Re: [PHP] Global variable question question
* Thus wrote Jason Giangrande ([EMAIL PROTECTED]): > When registered globals is set to off this does not effect the $PHP_SELF > variable right? In other words I should be able to call $PHP_SELF with > out having to do this $_SERVER['PHP_SELF'], right? > register_globals has nothing to do with $PHP_SELF, and no it can't be used with out either global or using $_SERVER Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global variable question question
Actually, I am running PHP 4.3.2 on a Gentoo Linux box with registered_globals set to Off and $PHP_SELF does work. The production box running Red Hat and PHP 4.3.0, with register_globals also set to Off, doesn't work using $PHP_SELF (as apparently it should), and this is why I was asking. Jason On Wed, 2003-07-23 at 16:13, Lars Torben Wilson wrote: > On Wed, 2003-07-23 at 12:19, Jason Giangrande wrote: > > When registered globals is set to off this does not effect the $PHP_SELF > > variable right? In other words I should be able to call $PHP_SELF with > > out having to do this $_SERVER['PHP_SELF'], right? > > > > Thanks, > > Jason Giangrande > > Without going into why you didn't read the manual or just try it, the > answer is 'wrong'. ;) If register_globals is off, $_SERVER['PHP_SELF'] > is what you will need. > > > Good luck, > > Torben > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global variable question question
On Wed, 2003-07-23 at 12:19, Jason Giangrande wrote: > When registered globals is set to off this does not effect the $PHP_SELF > variable right? In other words I should be able to call $PHP_SELF with > out having to do this $_SERVER['PHP_SELF'], right? > > Thanks, > Jason Giangrande Without going into why you didn't read the manual or just try it, the answer is 'wrong'. ;) If register_globals is off, $_SERVER['PHP_SELF'] is what you will need. Good luck, Torben -- Torben Wilson <[EMAIL PROTECTED]>+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global variable question question
> When registered globals is set to off this does not effect the $PHP_SELF > variable right? In other words I should be able to call $PHP_SELF with > out having to do this $_SERVER['PHP_SELF'], right? No. With register_globals OFF, $PHP_SELF is not set. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Global variable question question
When registered globals is set to off this does not effect the $PHP_SELF variable right? In other words I should be able to call $PHP_SELF with out having to do this $_SERVER['PHP_SELF'], right? Thanks, Jason Giangrande -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] global variable preference for self
Anybody have reason for using $_SERVER['PHP_SELF'] -v- $_SERVER['URL'] ? They both seem to always be the same in every instance I have seen so curious is their is a preferance for one or the other and if there is a case where PHP_SELF!=URL Cheers, -Peter ## Peter Thoenen - Systems Programmer Commercial Communications Camp Bondsteel, Kosovo ## "Stumbled Upon"...heh (Score:5, Funny) /. by $carab on 23:00 23 August 2002 (#4131637) "ForensicTec officials said they stumbled upon the military networks about two months ago, while checking on network security for a private-sector client." Someone new to a Dvorak probably tried to type in "lynx http://www.google.com"; but instead got "nmap -v -p 1-1024 -sS -P0 army.mil -T paranoid". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Global variable
The best way for this is to use sessions. What you do is you check the identity and if it's valid you create a session with name 'validuser' or whatever the name you want. Then any secure operations/actions along the script you'll check for this session name if it exists. I can demonstrate how I did this on my application. Vlad -Original Message- From: Erich Kolb [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 4:07 PM To: [EMAIL PROTECTED] Subject: [PHP] Global variable I have developed a simple login script. Right now it will check a submitted username and password and verify it against a database. This part works fairly well, however I want to know how to assign a variable that will pass through to the next page(s) to do something like: if verified == 1 then {display the page} else {display error message} My apoligies on the syntax of the above, but hopefully you will get the idea. -- 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] Global variable
I have developed a simple login script. Right now it will check a submitted username and password and verify it against a database. This part works fairly well, however I want to know how to assign a variable that will pass through to the next page(s) to do something like: if verified == 1 then {display the page} else {display error message} My apoligies on the syntax of the above, but hopefully you will get the idea. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Global Variable Change
Hi folks, small problem with globals: I would like to set a variable global called "Language". This seems to be not a really problem, but it is. Index.php: But all other pages do not have really access to this variable without calling "start_session()" from within the other pages(). If I call, it works. Now the real problem. I would like to set $Language by an Hyperlink with image hyperlinks, but it doesnt change anything. Within the hyperlink I call "setlanguage.php?lang=1033" "1031") and ($lang <> "1033") ) { $lang= "1031"; } $Language = $lang; if (session_is_registered('Language')) { session_unregister('Language'); } session_register('Language'); } ?> But it doesnt change ANYTHING Please Help Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variable for all scripts
On Saturday 10 November 2001 01:29 pm, you wrote: > if i like to move my scripts to /www/my_newdir i habe to change the > include() function in every script A few options: 1. Don't use absolute paths -- use relative paths. Then you don't have to worry about it as long as the overall structure of your site stays the same. 2. set a variable or named constant to the value of your path and then use that throughout your site. For example: DEFINE("MY_PATH","/www/my_newdir"); include(MY_PATH); This works well when you have one file that contains all your named constants and other stuff that needs to be accessible on a global basis. You then include that one file (using relative paths) at the top of every php page. If you need to change a value, you change it once in your global file and be done with it. 3. It's fairly trivial to do an automated search and replace across multiple files. Just do this and let the computer replace all occurances of include("/www/my_olddir") to include("/www/my_newdir") hth --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] global variable for all scripts
hi ppl, id like to set something like a global variable or constant. i need this, to set the path of my document root. all scripts should then use this path. e.g. my apache document root is: /www all my skriptfiles are in /www/my_subdir i include a special php script in all script files with: /* */ if i like to move my scripts to /www/my_newdir i habe to change the include() function in every script any workaround here? thanks a lot in advance sascha -- --- Sascha Biber Hegenloh Reisen GmbH t: 0 71 61-67 34-68 f: 0 71 61-67 34-64 m: 0177-589 14 96 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] global variable again?
Look in the manual: language.variables.scope.html 'global' is meant to use inside a function for accessing vars that are not in a function (the main part). > I use global in this form: > > global $a; > $a=strtotime('now'); > . > . > . > echo $a; but in this line dont echo $a Using global this way does not make sense. Or you are not telling us about functions on this page. Chris H. -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] global variable again?
hi. I use global in this form: http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] global variable.
hi. I want to use glabal variable. but it doesnot work?? thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Global Variable Variables...
I have a class that contains a form, when the form is submitted it posts back to the class. The class is included inside of another file, so all of the form variables need to be declared as global in order to access their values. On the form are several check boxes (number undetermined until the script is run) and the only way I know to access these values is using the "variable variables" feature of PHP, as follows: $A = "chkContact".$I; $B = $$A; This would work just fine if $chkContact## was not a global variable (ie..not wrapped inside of a class). How can I use variable variables on a global variable? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]