php determines an example of normal and external access

  • 2020-12-26 05:35:59
  • OfStack

php determines normal and external access
 
<?php 
session_start(); 
if(isset($_POST['check'])&&!empty($_POST['name'])){ 
if($_POST['check'] == $_SESSION['check']){ 
echo " Normal access "; 
}else{ 
echo " External access "; 
} 
} 
$token = md5(uniqid(rand(),true)); 
$_SESSION['check'] = $token; 
?> 
<form method="post" action=""> 
<input type="text" name="name"/> 
<input type="text" name="check" value="<?=$token;?>"> 
<input type="submit"> 

Related articles: