Method 1:
You can write the code that handles submitted data into a separate file, such as form.php.
if (defined(’INSIDE’)) {//Determine whether the INSIDE constant is defined
//Process the form
} else else {
exit('error');
}
?>
Then, first define the constant INSIDE on the page where the form is submitted. The value of the constant does not matter.
define(’INSIDE’, ’TRUE’);
Next, determine whether there is submission, if submitted, then
include ’form.php’;
================================================== ===================================== Method 2:
if(PHP_VERSION<’4.1.0’){$_SERVER = $HTTP_SERVER_VARS;}
if(isset($_SERVER["HTTP_REFERER"])){
//Some browsers may not have HTTP_REFERER, so make this judgment
$servername=$_SERVER[’SERVER_NAME’];
$sub_from=$_SERVER["HTTP_REFERER"];
$sub_len=strlen($servername);
$checkfrom=substr($sub_from,7,$sub_len);
If($checkfrom!=$servername)
{
echo "