I'm new to php coding, and basically I'm creating a user panel where users login and from there they access their dashboard which lets them do things.
I'm using php sessions to do this, and basically at the top of the dashboard I put:
session_start();
if(!session_is_registered(myusername)){
header("location:index.php");
This makes it so users who aren't logged in are re-directed to index.php.
The problem is that there is certain commands users can do from dashboard, like this: /dashboard.php?reset=true
And doing these commands does not require active session for some reason. Anyone can just go to /dashboard.php?reset=true and reset everything, without an active session!
Does anybody know how to fix this security flaw which allows people to do this?
Thanks
/dashboard.php?reset=truerather than PHP. A session, by definition, requires the client to present a token with each request (either by cookie or query string). That does not mean you have to look for it before taking action. Could you post that bit of code (doing the reset) and the rest of your security checks? The problem may lie there.exit;. And pretty sure that's not howsession_is_registeredwas to be used (note the past tense).