473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Setting $_SESSION when not used?

Hi!

// get user to edit
if( ($_POST["reply"]=="btn_selusr")||($_POST["btn_selusr"]!="") )
{
echo "x:".$_SESSION['username'];
$username=stripslashes($_POST["userlist"]);
echo "y:".$_SESSION['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 1424
..oO(jodleren)
// get user to edit
if( ($_POST["reply"]=="btn_selusr")||($_POST["btn_selusr"]!="") )
{
echo "x:".$_SESSION['username'];
$username=stripslashes($_POST["userlist"]);
echo "y:".$_SESSION['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_globals 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.dewrote:
.oO(jodleren)
*// get user to edit
*if( ($_POST["reply"]=="btn_selusr")||($_POST["btn_selusr"]!="") )
*{
echo "x:".$_SESSION['username'];
* *$username=stripslashes($_POST["userlist"]);
echo "y:".$_SESSION['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_globals 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.dewrote:
>.oO(jodleren)
>> // get user to edit
if( ($_POST["reply"]=="btn_selusr")||($_POST["btn_selusr"]!="") )
{
echo "x:".$_SESSION['username'];
$username=stripslashes($_POST["userlist"]);
echo "y:".$_SESSION['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_globals 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*******@attglobal.net
==================

Sep 4 '08 #4
..oO(jodleren)
>On Sep 2, 9:33*pm, Michael Fesser <neti...@gmx.dewrote:
>.oO(jodleren)
*// get user to edit
*if( ($_POST["reply"]=="btn_selusr")||($_POST["btn_selusr"]!="") )
*{
echo "x:".$_SESSION['username'];
* *$username=stripslashes($_POST["userlist"]);
echo "y:".$_SESSION['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_globals 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_globals 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
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...
2
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: ' ....
2
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....
5
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...
2
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...
8
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...
4
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...
2
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...
6
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.