marukochan Posted December 28, 2006 Share Posted December 28, 2006 How do I make a registration page accessible only after the user has enter the verification code? Meaning that if a user directly type www.xxx.org.my/registration.php, he won't be able to open it. He will be directed to verification.php instead. Quote Link to comment https://forums.phpfreaks.com/topic/32022-access-to-page-after-verification/ Share on other sites More sharing options...
bljepp69 Posted December 28, 2006 Share Posted December 28, 2006 Basically, you set a session variable after the user logs in. Something like $_SESSION['logged_in']=1, or you could user their username in a session variable. In any case, you set the session variable after a successful log in and then you check for the existance of it on the top of the restricted pages. Like so:[code]<?php session_start();//required at the top of every page using sessions if (!$_SESSION['logged_in']) { header("newlocation.html"); //redirects to a new page exit; //good practice after a header redirect }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32022-access-to-page-after-verification/#findComment-148642 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.