v2.0.31-20230720

This commit is contained in:
MI15\Win
2023-07-20 14:03:00 +08:00
parent 3646cfba93
commit 0038e27493
24 changed files with 425 additions and 59 deletions

View File

@@ -739,4 +739,22 @@ function send_email($config){
msg(-1,'发送失败');
}
}
}
}
//统计访问ip数
function count_ip(){
$ip = Get_IP(); //取访客IP
$k = date('Ymd'); $t = 'ip_list';
$ip_list = get_db('user_count','v',['uid'=>UID,'k'=>$k,'t'=>$t]); //取列表
$ip_list = empty($ip_list) ? [] : unserialize($ip_list); //反序列化
//判断IP是否存在列表中
if(!in_array($ip, $ip_list)){
$ip_list[] = $ip; //加入列表
if(!has_db('user_count',['uid'=>UID,'t'=>$t,'k'=>$k])){
insert_db("user_count", ['uid'=>UID,"k"=>$k,"v"=>$ip_list,'t'=>$t]);
}else{
update_db("user_count", ["v"=>$ip_list],['uid'=>UID,'t'=>$t,'k'=>$k]);
}
write_user_count($k,'ip_count');//访问ip数+1
}
}