tyuret
asked on
php session variables
Can I change the value of a session variable (eg: $_SESSION['test']) of a specific user when another user runs a php page (eg:trigger.php)?
ASKER
I should not be a Session variable. It will ok if I can change any global variable triggered by other user.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
With the below code I read the session id of the target user from DB, change a session variable of the target user then change back the session id to original? Seems working
What do you think, any problem you see or any improvement?
Thank you.
$session_id_old=session_id ();
$sql = "SELECT SESSION_ID FROM LOGIN_HISTORY WHERE LOGIN_ID=$Touser ";
$res=selectsql($sql);
$sesuserid=$res["SESSION_I D"];
session_write_close();
session_id($sesuserid);
session_start();
$_SESSION['alertses']=1;
session_write_close();
session_id($session_id_old );
session_start();
What do you think, any problem you see or any improvement?
Thank you.
$session_id_old=session_id
$sql = "SELECT SESSION_ID FROM LOGIN_HISTORY WHERE LOGIN_ID=$Touser ";
$res=selectsql($sql);
$sesuserid=$res["SESSION_I
session_write_close();
session_id($sesuserid);
session_start();
$_SESSION['alertses']=1;
session_write_close();
session_id($session_id_old
session_start();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ray thank you for your assist.
But still I am curious if there seems a problem with the code
But still I am curious if there seems a problem with the code
We can't tell if there is a problem with the code. We do not have your data base, nor do we have the rest of your code. You might be able to use var_dump() to enable you to look at the data. If your data looks like what you expect at each point in the process, that's a good thing.
Cd&