I'm currently working on a PHP browser based game. I have most of the script done but I'm worried that someone could easily 'hack' the session.
When a user log in and the password is correct, $_SESSION['logged']
will become '1'. The user will be redirected to profile.php .
If $_SESSION['logged']
is equal to '1', the profile will be displayed. However, if $_SESSION['logged']
doesn't exist, the user will be redirected back to index.php.
I'm afraid that the user will be able to hack $_SESSION['logged']
.
Also, there is $_SESSION['username']
. Most of the time I use $_SESSION['username']
to fetch information from database. If $_SESSION['username']
were changed/hacked, the 'hacker' will than be able to 'become' another 'person'.
I heard about session_regenerate_id and session_id() . However, I'm not sure where to place them.
Thanks,