Home > Article > Backend Development > Code to limit the number of people registered with the same IP_PHP tutorial
Today we will take a look at the code to limit the number of people registered with the same IP. Note that we need to use the datediff function, it is very simple.
$ex_sql =mysql_query("Select * from wk_member where m_ip='$ip' and datediff(m_dtime,'$dtime')=0");
If(mysql_num_rows($ex_sql)<5){
$sql;
If(mysql_query($sql)){
$_SESSION['uid']=array(mysql_insert_id(),$uid,$mo);
exit("<script>location='registerok.php';</script>");
}else{
alert('Registration failed!','');
}
}else{
alert('Sorry, only 5 users can be registered with the same IP per day','');
}