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