手机归属地查询(php+文本)
PHP源码
源代码在线查看: index.php
/*
+--------------------------------------------------------------------------
| 手机号码归属地查询
| ========================================
| by WhatUrl
| (c) 2001 - 2003 http://www.r51.net
| ========================================
| 主页: http://www.r51.net
| E-mail: whaturl@hotmail.com
+---------------------------------------------------------------------------
|
| > 修改日期: 2003年06月20日
|
+--------------------------------------------------------------------------
*/
class Debug {
function startTimer() {
global $starttime;
$mtime = microtime ();
$mtime = explode (' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
}
function endTimer() {
global $starttime;
$mtime = microtime ();
$mtime = explode (' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = round (($endtime - $starttime), 5);
return $totaltime;
}
}
function get_data1(){
// hand input
$m = trim($_POST['m']);
if(ereg('[0-9]{7,11}',$m)){
$m = substr($m,'0','7');
if(!$fp = @fopen('./Mobile.php','r')){
echo 'File err!';
exit();
}
flock($fp,LOCK_SH);
$note = fread($fp,filesize('./Mobile.php'));
fclose($fp);
$note = explode("\n",$note);
array_pop($note);
array_pop($note);
array_shift($note);
$num = count($note);
$_data = '';
for($i=0;$i $row = explode(" ",$note[$i]);
if($m >= $row[0] && $m $_data = $row;
break;
}
}
if($_data != ''){
foreach($row as $v){
if($v != ""){
$data1[] = $v;
}
}
return $data1;
}else{
return false;
}
}else{
echo '输入的手机号码错误!';
exit();
}
}
$Debug = new Debug;
$Debug->startTimer();
?>
www.r51.net -- 认证用户
td,body {
line-height: 27px;
text-decoration: none;
font-size: 12px;
}
input {
font-size: 12px;
background-color: #FF9900;
}
-->
if($_POST['a'] == 'search'){
$d = get_data1();
echo '-------------------------------------------';
if(is_array($d)){
echo '查询号码为:'.$_POST['m'].'';
echo ' 所属省份:'.$d['2'].'';
echo ' 城市为:'.$d['3'].'';
echo ' 区号为:'.$d['4'].'';
echo '卡原始类型:'.$d['5'].'';
}else{
echo '未知地区卡号! SORRY!';
}
echo '-------------------------------------------';
}
?>
手机号码:
echo '程式运行时间为: ';
echo $Debug->endTimer();
?>