当前位置:网站首页>Php get IP Limits submissions in minutes for verification code Getting too frequently
Php get IP Limits submissions in minutes for verification code Getting too frequently
2022-04-22 10:29:00 【QQ 27878777】
php AccèsIPLimiter le nombre de présentations en minutes,S'applique à l'acquisition trop fréquente de codes de vérification
//Nombre de restrictions
public function limitSendTimes()
{
header('Content-Type:text/html;charset=UTF-8');
session_start();
$limit = 2;
//Nombre de restrictions
$ip = $this->getip();
$time = date('Y-m-d H:i');
if (isset($_SESSION[$time])) {
$ipnum = $this->renum($_SESSION[$time], $ip);
} else {
$ipnum = 0;
}
// if ($ipnum >= $limit * 2) {
// exit("Seules les présentations sont autorisées dans une minute{$limit}Une fois");
// }
if ($ipnum >= $limit) {
exit("Obtenir le Code de vérification dans une minute{
$limit}Oui.,Demandes trop fréquentes,");
}
if (isset($_REQUEST['url'])) {
$url = $_REQUEST['url'];
} else {
$url = 0;
}
$_SESSION[$time][] = $ip;
exit("Soumis avec succès");
// return true;
}
//Accèsip
private function getip()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
//Nombre de réinitialisations
private function renum($array, $get)
{
$n = 0;
foreach ($array as $val) {
if ($val == $get) {
$n++;
}
}
return $n;
}

版权声明
本文为[QQ 27878777]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221027302559.html
边栏推荐
猜你喜欢
随机推荐
How to implement acid at the bottom of MySQL?
JWT source code analysis (four layer package with schematic diagram)
树形dp——P1122 最大子树和
Use of navigationview
Google Earth Engine(GEE)——聚合网格化人口数据
High quality notes on how MySQL works: understanding MySQL from the root
Addition, deletion, modification and query of advanced MySQL data (DML)
三分钟快速了解互动涂鸦
关于tpshop开源商城6.0版本图片库不显示图片问题
.pm format perl
《MySQL 是怎样运行的:从根儿上理解 MySQL 》优质笔记
The computer cleans the C disk (system disk) and the disk compression (disk partition) and expansion (disk expansion).
Here comes the article ~ share compressed and decompressed files [online website]
MySql5.7.26安装
来文章啦~分享压缩和解压文件【在线网站】
TIANTI 22 analog l3-2 puzzle a punch in reward (30 points)
numpy库的基础知识介绍与基本使用
C语言进阶篇1-----------》数据的存储(原码反码补码+大小端判断+整型提升+浮点数的存储)
Golang time strings common methods
Oracle account is locked. Unlocking method







![[SV] assign force difference](/img/ae/921388a3d551de0cfd92a5e64050a8.png)
