php - Prevent users from accessing member pages by entering cached url -
i have website members have login noticed after logging out can enter page url in browser , go in without using login form, how prevent this.
what mean believe there way me check if session valid on pages. non users can put url in browsers , enter without logging in.
use session variable in php.
session_start(); $_session['login'] = true;
this creates session variable called 'login' can used verify whether user logged in. now, have check variable :
if($_session['login'] == true){ /*goto user page*/ }else{ /*redirect somewhere else */ }
to create logout button, ensure users can't copy-paste url again , enter,
session_destroy();
will work fine.
Comments
Post a Comment