Jump to content

Protecting action pages


ballouta

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.