tags:

views:

70

answers:

2

Is it possible in PHP to edit another users session other than the current user? If so how?

+1  A: 

It is possible to edit another users session in php through couple of ways:

1) 1st way is to you have to get SessionID of the user for which you want to edit session; session_id($SessionID);

// and then enter code your logic to change session data here;

2) If you are storing your session data in database then it would be even easier to manipulate data directly in database which would update user session when application will request data again.

Remember you can play with user session up to any level the only thing required is SESSION_ID. If you got that you won the game;

DiGiTSS
Is it even possible to access somebody else's session using `session_id()`? I thought that function is just used to change the session ID of the current session for a particular user.
BoltClock
Yes it is possible to do that but the only thing is revert back session_id() to your current users actual session_id() else it would be a big mess.So you need to code in following way:- backup your current users session_id - initialize session with session_id of user for which you want to change data.- logic to change data- reset session_id to actual users session id from the backup you have taken.I guess this should work :)
DiGiTSS
A: 

Not sure why you'd want to do such a thing, but if you really want to, managing session data in a database and running UPDATE or INSERT queries to modify specific sessions is trivial. Like DiGiTSS says, though, you'll need to know the ID of the session which your application is going to edit.

BoltClock