当前位置:网站首页>PHP common authentication / third-party methods
PHP common authentication / third-party methods
2022-06-30 14:10:00 【Zhiqiu·】
1. Mobile number verification
function checkMobile(tel) {
var reg = /(^1[3|4|5|6|7|8|9][0-9]{9}$)/;
if (reg.test(tel)) {
return true;
}else{
return false;
};
}
2. ID card verification
function isCardNo(card) {
// The ID number is 15 Bits or 18 position ,15 It's all numbers ,18 Pre position 17 Bits are numbers , The last bit is the check bit , May be a number or character X
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(card) === false) {
alert(" Illegal ID card input ");
return false;
}
}
3. obtain IP Address
// Using Baidu API according to IP Search address
function get_city($ip=''){
$url = 'http://api.map.baidu.com/location/ip?ak=940td2x3uADVUx3vdH7aajHC&ip='.$ip.'&coor=bd09ll';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
$output = curl_exec($ch);
curl_close($ch);
$info = json_decode($output,true);
if($info['status']==0){// success
return array('code'=>200,'msg'=>' The request is successful ','data'=>$info);
}else{// Failure
return array('code'=>201,'msg'=>$info['message'],'data'=>$info);
}
}
边栏推荐
- 【系统分析师之路】第五章 复盘软件工程(敏捷开发)
- 数据库表为什么写不进数据了
- There is no utf8 option for creating tables in Navicat database.
- Lucky hash quiz system development (source code deployment) fun investment hash game play development (case requirements)
- 优思学院:六西格玛不只是统计!
- Pit used by go language array type
- Problems in QT creator (additional unknown and error lines are listed in the debug output window)
- [observation] as the intelligent industry accelerates, why should AI computing power take the lead?
- Observable, seulement fiable: première bombe de salon de la série cloudops d'exploitation et d'entretien automatisés dans le nuage
- Introduction to the renewal of substrate source code: the pallet alliance is incorporated into the main line,
猜你喜欢

There is no utf8 option for creating tables in Navicat database.

IM即时通讯应用开发中无法解决的“顽疾”

Shell programming overview

Problems in QT creator (additional unknown and error lines are listed in the debug output window)
![【科研数据处理】[实践]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)](/img/5a/eaa845f4332f0b8ee8b6409d6a79e8.png)
【科研数据处理】[实践]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)

Geoffreyhinton: my 50 years of in-depth study and Research on mental skills

Waving flags and shouting for basic language

MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video

Unity Animator 参数

Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source!
随机推荐
Deep understanding Net (2) kernel mode 4 Summary of kernel pattern constructs
Begin End use the pit encountered
Impersonate server and client using message queuing
How does MySQL merge columns?
visualstudio 和sql
Go language mutex lock
优思学院:六西格玛不只是统计!
Complete TCP forwarding server (kernel linked list + mutex)
@ResponseBody的作用
[Title brushing] coco, who likes bananas
表格储存中sql查询的时候,查询结果增加主键报错,查询结果超过10w行。需要对主键增加上多元索引吗?
navicat数据库建表是没有utf8选项。
Je suis à Foshan, où puis - je ouvrir un compte? L'ouverture d'un compte par téléphone mobile est - elle sécurisée?
LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
Yousi College: Six Sigma is not just statistics!
Unity Animator 参数
Observable, seulement fiable: première bombe de salon de la série cloudops d'exploitation et d'entretien automatisés dans le nuage
可观测,才可靠:云上自动化运维CloudOps系列沙龙 第一弹
智慧运维:基于 BIM 技术的可视化管理系统
Getting started with shell Basics