Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit another users session in PHP

Tags:

php

session

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

like image 580
Jigs Avatar asked May 23 '10 16:05

Jigs


People also ask

Can user edit PHP session?

A user cannot modify PHP sessions on the server. They can only forge a legitimate cookie and masquerade as a logged-in user - but that will require them to steal a valid cookie in the first place.

Can users edit session variables?

Modifying Published Session Variables Session variables on the client are read-only. They cannot be modified.

Why session_start () is used in PHP?

session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie. When session_start() is called or when a session auto starts, PHP will call the open and read session save handlers.

Can session be hacked PHP?

No. Session data is stored on the server. The session ID is the only thing transferred back and forward between the client and the server. Therefore, unless the server is hacked or has a server-side bug, the client cannot change the session data directly.


2 Answers

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;

like image 89
deej Avatar answered Sep 22 '22 07:09

deej


It depends on method which server use to store the session data. I think there maybe a few ways to store like database, files on server, memcache server. so you have to use a proper way.

anyway I've done web programming just for 5 months. so I'm not sure what I said.

like image 32
Yongnam Jeong Avatar answered Sep 24 '22 07:09

Yongnam Jeong