网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的范文:

 

标题 帝国cms分类信息电话号码查询
范文
    [fwxx]归属地[/fwxx]
    fwxx段名
    <?php
    /**
    sooden
    2007-10-2
    **/
    header("Content-type: text/html;charset=gbk");
    /*
    构建函数
    */
    //读取电话号码文件
    function readfiletext ($file, $id)
    {
    $myaddress='';
    $fp = @file("$file");
    //循环比对
    for ($i=0; $i<count($fp); $i++)
    {
    $readfile=explode('||',$fp[$i]);
    $file1=$readfile['0'];
    $file2=$readfile['1'];
    $id==$file1?$myaddress=$file2:'';
    }
    return $myaddress;
    }
    //写文件
    function writefiletext ($file, $string)
    {
    $string = stripslashes ($string);
    $fp = @fopen ($file, 'a+');
    @fwrite ($fp, $string);
    @fclose ($fp);
    }
    //匹配函数
    function Cut($FileStr,$StartStr,$EndStr,$Type)
    {
    if(ereg($StartStr,$FileStr)&&ereg($EndStr,$FileStr))
    {
    if($Type==0){
    $GetContent = substr($FileStr,0-(strlen($FileStr)-(strpos($FileStr,$StartStr)+strlen($StartStr))));
    $GetContent = substr($GetContent,0,strpos($GetContent,$EndStr));
    return $GetContent;
    }else{
    $GetContent = substr($FileStr,0-(strlen($FileStr)-(strpos($FileStr,$StartStr))));
    $GetContent = substr($GetContent,0,strpos($GetContent,$EndStr)+strlen($EndStr));
    return $GetContent;
    }
    }else{
    return "";
    }
    }
    /*
    函数构建结束
    */
    $id=$_GET['id']; //ID
    $file = 'phone.txt'; //设定电话文件地址
    //如果ID为空退出
    if(empty($id))
    {
    exit();
    }
    else
    {
    //查询文件内是否有地址
    $myaddress=readfiletext($file,$id);
    if ($myaddress) { $showadd=$myaddress; }
    else {
    //获得号码地址页面
    $show=file_get_contents("http://www.123cha.com/ip/?q=$id"); //手机号码段
    //写入文件
    @$dh=Cut($show,'您的查询:&nbsp;',"n</li><li>",0);
    if(!$dh) {
    @$dh=Cut($show,'您的查询:&nbsp;','&nbsp;</li><li>',0); }
    $dh = trim(ereg_replace("rn","",$dh));
    $dh =nl2br(preg_replace('/[ ]+/',' ',$dh));
    $showadd=$dh;
    $dh=$id.'||'.$dh.'||'."rn";
    writefiletext ($file,$dh); }
    }
    ?>
    <span><a href="#clos" onclick="ShowTel();" />X关闭</a></span>&nbsp;&nbsp;<font color=red>查询结果</font>
    <div id=cresult>
    <ul>
    <?php
    if ($showadd) {
    print_r(str_replace("查询太频繁,暂时禁用", "无", "$showadd")); //$showadd);
    }
    else {
    echo "<li>服务器忙,请稍后再试……"; }
    ?>
    </li>
    </ul>
    </div>
随便看

 

在线学习网范文大全提供好词好句、学习总结、工作总结、演讲稿等写作素材及范文模板,是学习及工作的有利工具。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/24 0:52:57