Home > Backend Development > PHP Tutorial > Code to limit the number of people registered with the same IP_PHP tutorial

Code to limit the number of people registered with the same IP_PHP tutorial

WBOY
Release: 2016-07-13 17:07:12
Original
756 people have browsed it

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','');
}

In this way, you can do the process of voting to restrict IPs. Haha, please indicate www.111cn.cn/phper/php.html for original reprints on this site

http://www.bkjia.com/PHPjc/630432.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630432.htmlTechArticleToday we will take a look at the code to limit the number of people registered with the same IP. Note that the datediff function is used, it is very Simple. $ex_sql =mysql_query(Select * from wk_member where m_ip='$ip' and datedi...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template