if($_SERVER["HTTP_REFERER"]=="" || strpos($_SERVER["HTTP_REFERER"],‘你的域名’)===false)
{exit;
}

解决方案 »

  1.   

    HTTP_REFERER
    SERVER_NAME
    取得上面两样。
    截取一定HTTP_REFERER一定的长度(你域名的长度)与SERVER_NAME比较,不相等,出现警告或退出。
      

  2.   

    本地提交页面加一个:
    <input name="host" type="hidden" value="$_SERVER["HTTP_HOST"]">验证页
    if (substr_count($_POST['host'],'本站域名') > 0){
    }
      

  3.   

    <input name="host" type="hidden" value="<? echo $_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"].$_SERVER["QUERY_STRING"]; ?>">
      

  4.   

    同意。还有我的^_^if not instr(1,Request.ServerVariables("http_Referer"),Request.ServerVariables ("SERVER_NAME"),1)=8 then
    response.write "<b>请不要从非本服务器的页面提交信息</b>"
    response.redirect "error.asp?error=001"
    end if
      

  5.   

    $pos = strpos($_SERVER["HTTP_REFERER"], '域名');
    if($_SERVER["HTTP_REFERER"]=="" || $pos === false)
    {
    echo 错误";
    }else
    echo"fdsf";