ballouta Posted May 20, 2009 Share Posted May 20, 2009 Hello I have a registration a normal registration form: <form action="register.php" method="get" name="Registration"> How do I protect the register.php page. e.g. if someone opens it without submitting the previous form Thank you Link to comment https://forums.phpfreaks.com/topic/158886-protecting-action-pages/ Share on other sites More sharing options...
GingerRobot Posted May 20, 2009 Share Posted May 20, 2009 So you have chained forms? I'd recommend using sessions to work out where each user is and what information they should be filling in. If you're new to sessions, you might like to check out this tutorial: http://www.phpfreaks.com/tutorial/sessions-and-cookies-adding-state-to-a-stateless-protocol Link to comment https://forums.phpfreaks.com/topic/158886-protecting-action-pages/#findComment-837999 Share on other sites More sharing options...
cunoodle2 Posted May 20, 2009 Share Posted May 20, 2009 You can also do something like this at the top of all of your action pages. Its not 100% secure (hardly anything is ;-) ) but it does the trick for the basic guy manually typing it in the address bar.. <?php if ($_SERVER['PHP_SELF'] == "/register.php") { echo "<meta http-equiv=\"REFRESH\" content= \"0;url=http://www.YourHomePage.com\">"; die(); } ?> OR you could just put the processing portion of "register.php" in a different directory and include it in parts of the processing.. <?php require_once "/home/yourDirectory/includes/register.php"; ?> Then you could have the code in a different directory (outside of your web space) to prevent anyone from ever directly accessing the code. Link to comment https://forums.phpfreaks.com/topic/158886-protecting-action-pages/#findComment-838347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.