⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 手机归属地查询(php+文本) PHP源码
💻 PHP
字号:
<?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<$num;$i++){
			$row = explode(" ",$note[$i]);
			if($m >= $row[0] && $m <= $row[1]){
				$_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();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>www.r51.net -- 认证用户</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td,body {
	line-height: 27px;
	text-decoration: none;
	font-size: 12px;
}
input {
	font-size: 12px;
	background-color: #FF9900;
}
-->
</style>
</head>

<body>


<?php
if($_POST['a'] == 'search'){
	$d = get_data1();
	echo '-------------------------------------------<br>';
	if(is_array($d)){
		echo '查询号码为:'.$_POST['m'].'<br>';
		echo ' 所属省份:'.$d['2'].'<br>';
		echo '  城市为:'.$d['3'].'<br>';
		echo '  区号为:'.$d['4'].'<br>';
		echo '卡原始类型:'.$d['5'].'<br>';
	}else{
		echo '未知地区卡号! SORRY!<br>';
	}
	echo '-------------------------------------------<br>';
}
?>

<table border="0" cellspacing="0" cellpadding="0">
  <form name="form1" method="post" action="">
  <tr> 
      <td align="right">手机号码:</td>
      <td>
<input name="m" type="text" id="m" size="15" value=''>
<input type="submit" name="Submit" value="查询">
<input name="a" type="hidden" id="a" value="search">
</td>
  </tr>
</form>  
</table>
<?php
echo '<br>程式运行时间为: ';
echo $Debug->endTimer();
?>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -