473,776 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting $_SESSION when not used?

Hi!

// get user to edit
if( ($_POST["reply"]=="btn_selusr") ||($_POST["btn_selusr "]!="") )
{
echo "x:".$_SESS ION['username'];
$username=strip slashes($_POST["userlist"]);
echo "y:".$_SESS ION['username'];
}

on line "x" it is correct, while line "y" I have the session var
changed too????
$username is a local var for the user being edited, while $_session...
is the user logged (in this case some kind of admin)

Why the h... does the variable affect the session var?

My system has been transferred from an unknown server to an apache
server - PHP version was 5.2.6, now it is 5.2.0 - that should not do
anything?
I also have the other problem mentioned below, that the $_SESSION
stays even when the browser is closed.

WBR
Sonnich
Sep 2 '08 #1
4 1441
..oO(jodleren)
// get user to edit
if( ($_POST["reply"]=="btn_selusr") ||($_POST["btn_selusr "]!="") )
{
echo "x:".$_SESS ION['username'];
$username=strip slashes($_POST["userlist"]);
echo "y:".$_SESS ION['username'];
}

on line "x" it is correct, while line "y" I have the session var
changed too????
$username is a local var for the user being edited, while $_session...
is the user logged (in this case some kind of admin)

Why the h... does the variable affect the session var?
register_global s is enabled on that machine - it should be turned off in
the php.ini.

Micha
Sep 2 '08 #2
On Sep 2, 9:33*pm, Michael Fesser <neti...@gmx.de wrote:
.oO(jodleren)
*// get user to edit
*if( ($_POST["reply"]=="btn_selusr") ||($_POST["btn_selusr "]!="") )
*{
echo "x:".$_SESS ION['username'];
* *$username=stri pslashes($_POST["userlist"]);
echo "y:".$_SESS ION['username'];
}
on line "x" it is correct, while line "y" I have the session var
changed too????
$username is a local var for the user being edited, while $_session...
is the user logged (in this case some kind of admin)
Why the h... does the variable affect the session var?

register_global s is enabled on that machine - it should be turned off in
the php.ini.
That has no effect at all. The problem remains...
Sep 4 '08 #3
jodleren wrote:
On Sep 2, 9:33 pm, Michael Fesser <neti...@gmx.de wrote:
>.oO(jodleren )
>> // get user to edit
if( ($_POST["reply"]=="btn_selusr") ||($_POST["btn_selusr "]!="") )
{
echo "x:".$_SESS ION['username'];
$username=strip slashes($_POST["userlist"]);
echo "y:".$_SESS ION['username'];
}
on line "x" it is correct, while line "y" I have the session var
changed too????
$username is a local var for the user being edited, while $_session...
is the user logged (in this case some kind of admin)
Why the h... does the variable affect the session var?
register_globa ls is enabled on that machine - it should be turned off in
the php.ini.

That has no effect at all. The problem remains...
That is your problem. It looks like you might be changing the wrong
php.ini file - or you're not stopping/restarting the web server after
making changes.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 4 '08 #4
..oO(jodleren)
>On Sep 2, 9:33*pm, Michael Fesser <neti...@gmx.de wrote:
>.oO(jodleren )
*// get user to edit
*if( ($_POST["reply"]=="btn_selusr") ||($_POST["btn_selusr "]!="") )
*{
echo "x:".$_SESS ION['username'];
* *$username=stri pslashes($_POST["userlist"]);
echo "y:".$_SESS ION['username'];
}
>on line "x" it is correct, while line "y" I have the session var
changed too????
$username is a local var for the user being edited, while $_session...
is the user logged (in this case some kind of admin)
>Why the h... does the variable affect the session var?

register_globa ls is enabled on that machine - it should be turned off in
the php.ini.

That has no effect at all. The problem remains...
Check phpinfo() or ini_get() to see that it is really turned off.
$_SESSION['username'] and $username are completely different and
independent variables, they only interfere if register_global s is on.

Micha
Sep 4 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1856
by: sumdumgaitu | last post by:
I'm using the following code for a login page in PHP. Everything works OK until someone else logs in from the same browser. As best I can tell $mail, $password, and $user_id are not getting updated in the session. I tried doing session_start(); session_destroy();
2
1561
by: skeeterbug | last post by:
i have a program that will display a number of diffferent results depending on the situation. one example of the code looks like <?php if(isset($_SESSION)) { print 'You entered: ' . $_SESSION . NL . NL; } else {
2
1389
by: Connor T | last post by:
Hi, I used to have code like this: $itemCode = $id ; where itemCode and basketCount were both session variables. Now it seems i have to use _SESSION if register globals are turned off. So how should
5
2634
by: PaowZ | last post by:
Hello There! I'm trying to handle sessions using php5, but having some troubles to design it.. Ok, I have to use "session_set_save_handler()" to override session management but I don't really understand callback functions arguments. According to doc (http://fr3.php.net/manual/fr/function.session-set- save-handler.php french version), open(), close() take not arg, read() takes $id, write() takes $id, $sess_data and so on...
2
2034
by: gm04030276 | last post by:
hey, i'm basically trying to use php sessions and a bit of javascript to make tabbed browsing within a web page using sessions to store the data of the different opened pages. Problem: when i unset the first 0 index in the array (ie close the default page) it seems to wipe the other one (can't get it to add more that one anymore) from the array also the information is held in sub array $_SESSION each page has its own array of infomation...
8
3369
by: SpiritBreaker | last post by:
I am having problems getting the $_SESSION to set, the $_SESSION will work fine when its first gets the value, however, when I go to another page, the $_SESSION then loses its value. So if any one can take a look at my code and see if there is any problems, that would be good. Thanks Here is my code <?php if (!isset($_SESSION)) session_start();
4
2137
by: Daz | last post by:
Hi everyone. I'm just wondering if it's considered bad practice to have a class read from and write to the $_SESSION super global. I was just learning a little about object serialization, and I've come to the conclusion that storing potentially large serialized objects in a database is perhaps a bad idea. The data could also be stored in a file, but in that case, I may as well use $_SESSION. If I'm going to go down that road, why not store...
2
1685
by: raaman rai | last post by:
i have 3 drop dropdown box which is used for searching my database. Either one of them can be selected to perform the search but if none of them is selected it will give an error. Well in reference to this i want the sql query to be based on the values selected by the users. A user might select value from one dropdown box and leave the others or a user can also select values from all three dropdown box. So in this case the query parameters for...
6
11970
hgeithus
by: hgeithus | last post by:
Hi. I have a session variable stored within a cookie, and I want this to change when pressing a hyperlink. i.e. I have this variable $_SESSION = 'en_US'; This is set initially if it hasn't been set before using an if statement:
0
9628
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
10292
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10061
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
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
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
6722
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
5368
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...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.