By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

globals & session

P: n/a
Ike
if you are programming a php-page and you use the following, what will
be the result?

<form action=test.php method=post>
name: <input type=text name=naam><br>
id: <input type=text name=userid><br>
</form>

in the page test.php:

$userid = $_SESSION['userid'];

this session var was set previously

will $userid be written with the 5 from the post or will it be written
with the $_SESSION['userid']

is it still secure to use this variable more than once?

on the server i use the globals can't be turned of

thx on advance Ike
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Do you mean register_globals? Can't you turn it off with an .htaccess file?

If register_globals is ON then the contents of the GET/POST arrays will be
available to your script the minute it fires up and before you execute the
first line of code. If you then change a variable then that variable is
changed.

You can use a variable more than once, but it will only contain the last
value written to it.

--
Tony Marston

http://www.tonymarston.net

"Ike" <de*********@yahoo.com> wrote in message
news:10**************************@posting.google.c om...
if you are programming a php-page and you use the following, what will
be the result?

<form action=test.php method=post>
name: <input type=text name=naam><br>
id: <input type=text name=userid><br>
</form>

in the page test.php:

$userid = $_SESSION['userid'];

this session var was set previously

will $userid be written with the 5 from the post or will it be written
with the $_SESSION['userid']

is it still secure to use this variable more than once?

on the server i use the globals can't be turned of

thx on advance Ike

Jul 17 '05 #2

P: n/a
Ike
yes indeed it is register_globals is on

so that means if register_globals is on that i better do not use the
same variable twice.

i don't know how to use the .htaccess file

and can you change settings with a config file from apache in you php
settings?

"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message news:<cj*******************@news.demon.co.uk>...
Do you mean register_globals? Can't you turn it off with an .htaccess file?

If register_globals is ON then the contents of the GET/POST arrays will be
available to your script the minute it fires up and before you execute the
first line of code. If you then change a variable then that variable is
changed.

You can use a variable more than once, but it will only contain the last
value written to it.

--
Tony Marston

http://www.tonymarston.net

Jul 17 '05 #3

P: n/a
Ike wrote:
yes indeed it is register_globals is on

so that means if register_globals is on that i better do not use the
same variable twice.

i don't know how to use the .htaccess file
create a file in your document root named ".htaccess" with the following:

php_flag register_globals 0

Then do a phpinfo() call and see what it says for the "local" value.
and can you change settings with a config file from apache in you php
settings?


http://us2.php.net/manual/en/configu...changes.apache

Whenever I am dealing with a server that has register_globals = On, I
simply avoid using variable names that match up with GET or POST var
names...

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #4

P: n/a
Ike
Thx to you people, it was a real good help for me

my problems are solved

Justin Koivisto <sp**@koivi.com> wrote in message news:<xK*****************@news7.onvoy.net>...

create a file in your document root named ".htaccess" with the following:

php_flag register_globals 0

Then do a phpinfo() call and see what it says for the "local" value.
and can you change settings with a config file from apache in you php
settings?


http://us2.php.net/manual/en/configu...changes.apache

Whenever I am dealing with a server that has register_globals = On, I
simply avoid using variable names that match up with GET or POST var
names...

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.