Home > Backend Development > PHP Tutorial > Mobile phone number location query code_PHP tutorial

Mobile phone number location query code_PHP tutorial

WBOY
Release: 2016-07-13 10:58:30
Original
1339 people have browsed it

This mobile phone number ownership query code is a PHP open source mobile phone ownership query system. This system does not rely on large databases such as mysql, but relies on text, because generally a mobile phone number is determined in the query system The function is the first 7 digits

Mobile phone number location query code
/*
This mobile phone number ownership query code is a PHP tutorial open source mobile phone ownership query system. This system does not rely on large database tutorials such as mysql tutorials, but relies on text, because generally a mobile phone number is determined in the query system The effect is the first 7
*/

if( $_post )
{
$phone=(isset($_post["phone"]))?$_post["phone"]:die ("Please return");
echo "You are querying: $phone, data: ".getphone($phone);


function getphone($phone){
$dbpath="datas/";
$len=strlen($phone);
if ( $len !=11 ){
return "Mobile phone number only supports 11 digits";
}
$par="[0-9]";
for ($i=0;$i<$len;$i++){
if(!ereg($par,substr($phone,$i,1) ) ){
return "Mobile phone number can only be digits";
}
}
$sunum=scandir($dbpath); //Supported mobile phone number prefix
array_splice($sunum,0,1); //Cancel the current directory
array_splice($sunum,0,1); //Remove the upper level directory
$sub=substr($phone,0,3); //Get the first three digits of the number
if (in_array($sub,$sunum) ){
$num=substr($phone,3,4);
$search=file($dbpath.$sub);
$result=str_replace($num."=","",$search[$num]); //Process data
return (strlen($result)>1)?$result:"0";

}else{
return "$sub is not supported yet";

}

}
}
?>




Mobile phone number location inquiry




Please enter your mobile phone number:





www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631991.htmlTechArticleThis mobile phone number ownership query code is a PHP open source mobile phone ownership query system. This system does not rely on mysql. A large database of classes, but relies on text, because generally a mobile phone number...
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