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

Setting $_SESSION when not used?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
..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

P: n/a
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

P: n/a
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

P: n/a
..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 discussion thread is closed

Replies have been disabled for this discussion.