Php代码
<?php
header('Content-Type: text/html; charset=utf-8');
define("WEBSITE", "http://onestopweb.iteye.com");
if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['fdata'])){
sourceJudgment();
echo $_POST["website"];
exit;
}
//来源判断
function sourceJudgment(){
if (strpos($_SERVER['HTTP_REFERER'], WEBSITE)===false) {
header('Location:'.WEBSITE.'/index.php?f='.$_SERVER['HTTP_REFERER']);
exit;
}
}
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>PHP 判断请求来源</title>
</head>
<body>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<input type="text" name="website" value="" placeholder="请输入网址">
<input type="submit" name="fdata" value="提交">
</form>
</body>
效果图:
文章源自爱尚资源教程网-https://www.23jcw.net/1172.html
文章源自爱尚资源教程网-https://www.23jcw.net/1172.html
相关文章
版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
