473,509 Members | 10,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

globals & session

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
4 1577
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4565
by: Manu J | last post by:
Hi, i have a login script which makes use of sessions. Login script *********** session_start() ..... ..... ....
3
1712
by: Phil Powell | last post by:
// CLIENT GLOBAL FUNCTION TO PARSE $_SESSION IF 'tempIDArray' IS SET function parseTempIDArraySession() { $tempIDArray = $_SESSION; $_GET = $_SESSION]; // RESET $_GET WITH SESSION ARRAY...
5
2822
by: Frostillicus | last post by:
I'm trying to use array_multisort to sort by one of the dimensions of an array stored in $GLOBALS like this: array_multisort($GLOBALS, SORT_STRING, SORT_DESC); Each "row" in $GLOBALS contains...
7
1747
by: Jon Grieve | last post by:
Having come to PHP from another CGI, there's one thing I really miss... The previous tool used was Witango, which had one major difference: the interpreter ran as a service/daemon. One benefit...
0
2091
by: SeanGallavan | last post by:
Our Environment: Two network load balanced (using Microsoft NLB software) webservers with session maintained in a SQL Server database. NLB is configured with no affinity settings and two...
17
1258
by: meridian | last post by:
I thought I had 'got' globals but this one seems strange. I want my example function 'doIt' to use and optionally modify a module variable 'gname', so I declare 'global gname' in the function, but...
2
5164
by: Jeff | last post by:
ASP.NET 2.0 In the business logic layer I've got the code (see CODE) below, this code gives a compile error (see ERROR) CODE: List<Messagemessages = null; messages =...
0
7165
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along...
2
1711
by: sheldonlg | last post by:
I did some coding on a site where register_globals is set to on. The problem I encountered was that the session variable changed without my changing it explicitly. I knew that in register globals...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.