forumnz Posted May 12, 2007 Share Posted May 12, 2007 This isn't a problem - just a question. Say I have a page named secret.php and I want only logged in users to access it, how can I stop others from briefly viewing it (my script refreshes the page when it sees the user isn't logged in, so they see it for a split second). Thanks a lot. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 12, 2007 Share Posted May 12, 2007 set a session on the login ie <?php session_start(); $_session['access'] = true; ?> on the start of the secret.php have secret.php <?php session_start(); if( isset($_session['access']) && ($_session['access'] === true) ) { echo "welcome"; }else{ die("FAILED"); } ?> Quote Link to comment Share on other sites More sharing options...
Broniukas Posted May 12, 2007 Share Posted May 12, 2007 or u can use cookies Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 12, 2007 Share Posted May 12, 2007 or u can use cookies Yeah if don't want it secure!! Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 13, 2007 Share Posted May 13, 2007 qnother thign you miught want to add is stuff like when they logged in and out. you could do this in a database, i do it on my site, and so i can see if they are regulars, or only on ocaisionally, and how long theyve been on forin total. i beleive thats what counts how long youve been in in this forum.... Quote Link to comment Share on other sites More sharing options...
john010117 Posted May 13, 2007 Share Posted May 13, 2007 Here are some useful links for you: Sessions set_cookie Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.