473,659 Members | 2,929 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 1589
Do you mean register_global s? Can't you turn it off with an .htaccess file?

If register_global s 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*********@ya hoo.com> wrote in message
news:10******** *************** ***@posting.goo gle.com...
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_global s is on

so that means if register_global s 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.de mon.co.uk> wrote in message news:<cj******* ************@ne ws.demon.co.uk> ...
Do you mean register_global s? Can't you turn it off with an .htaccess file?

If register_global s 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_global s is on

so that means if register_global s 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_global s 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_global s = 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******* **********@news 7.onvoy.net>...

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

php_flag register_global s 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_global s = 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
4573
by: Manu J | last post by:
Hi, i have a login script which makes use of sessions. Login script *********** session_start() ..... ..... ....
3
1725
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 get_to_post(); // $_POST = $_GET foreach ($tempIDArray as $tempID) unset($_SESSION); print_r("POST: "); print_r($_POST); print_r("<P>"); extract($_POST, EXTR_SKIP); foreach ($_POST as $key => $val) $GLOBALS = $val; unset($_SESSION);
5
2833
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 a value for 'href', 'desc', and 'info' but when I try to pass one of these "columns" to array_multisort() it whinges about it not being an array or a sort value :-( Can PHP not understand arrays stored in $GLOBALS or something?
7
1758
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 of this was, you could have variables scoped at a number of different levels above the once-only variables in PHP (i.e. sessions). Specifically, it was possible to create variables at a system-wide and site-wide level. I could set a value and...
0
2106
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 network cards in each machine. Machine keys are identical on both webservers. There is no anti-virus software installed. SQL Server database is storing session information as specified by Microsoft guidelines.
17
1273
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 when modified it doesn't stay modified. gname = 'Sue' def doIt(name = gname): global gname gname = name print 'doIt name', name, 'gname', gname
2
5173
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 = HttpContext.Current.Session; ERROR:
0
7183
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 the way. First, deep linking is not something that a completely AJAX web site should be able to do by it's very nature of everything being on one page basically. So how can a person deep link to something that is on one page? This question...
2
1720
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 being on, that all the variables were global variables. What I didn't realize was that it set up an equivalence such that the variable is an alias for the session variable with the key name of that variable. That is, $_SESSION is the same as...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.