收藏文章 楼主

小绿叶通讯录站点源代码-php

版块:php   类型:普通   作者:小绿叶技术博客   查看:1530   回复:0   获赞:2   时间:2020-07-19 00:57:40

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>小绿叶通讯录</title>

<style>

*{margin:0;padding:0;color:#444}

body{font-size:14px;font-family:"宋体"}

.main{width:600px;margin:10% auto;}

.title{background: #20a53a;color: #fff;font-size: 16px;height: 40px;line-height: 40px;padding-left: 20px;}

.content{background-color:#f3f7f9; height:500px;border:1px dashed #c6d9b6;padding:20px}

.t1{border-bottom: 1px dashed #c6d9b6;color: #ff4000;font-weight: bold; margin: 0 0 20px; padding-bottom: 18px;}

.t2{margin-bottom:8px; font-weight:bold}

ol{margin:0 0 20px 22px;padding:0;}

ol li{line-height:30px}

</style>

</head>


<body>

<div class="main">

<div class="title">小绿叶技术博客通讯录站点</div>

<div class="content">

<p class="t1">ic.eisc.cn</p>

<p class="t2">提示:</p>

<ol>

<li>Hello, Please enter your colleague's nickname to inquire the address book information!</li>

<br />

</ol>

<form action="http://ic.eisc.cn" method="post">

<input name="inputname" type="text" placeholder="请输入姓名" required/>

<input name="inputWh" type="text" placeholder="请输入外号" required/>

<textarea placeholder="留下您的名字"></textarea>

<input name="提交" type="submit" value="提交数据库查询"action=""/>

</form>





<?php 

// -------------  时间函数  ----------------------

function get_time($server){ 

    date_default_timezone_set('Asia/Shanghai');//解决差8小时问题 

    $data  = "HEAD / HTTP/1.1\r\n";   

    $data .= "Host: $server\r\n";   

    $data .= "Connection: Close\r\n\r\n";   

    $fp = fsockopen($server, 80);   

    fputs($fp, $data);   

    $resp = '';   

    while ($fp && !feof($fp))   

        $resp .= fread($fp, 1024);   

    preg_match('/^Date: (.*)$/mi',$resp,$matches);   

    return strtotime($matches[1]);   

}   

echo date('Y-m-d H:i:s',get_time("www.tudou.com"));   

echo "<br /><br />";

//  -------------------------------------------------













echo "<table style='border: solid 1px black;'>";

echo "<tr><th>Id</th><th>姓名</th><th>外号</th><th>电话</th></tr>";

 

class TableRows extends RecursiveIteratorIterator {

    function __construct($it) { 

        parent::__construct($it, self::LEAVES_ONLY); 

    }

 

    function current() {

        return "<td style='width:150px;border:1px solid black;'>" . parent::current(). "</td>";

    }

 

    function beginChildren() { 

        echo "<tr>"; 

    } 

 

    function endChildren() { 

        echo "</tr>" . "\n";

    } 

 

 

$servername = "127.0.0.1";

$username = "rrrr";

$password = "fffff";

$dbname = "fffff";


$cwh=$_REQUEST['inputWh'];

$cname=$_REQUEST['inputname'];


echo "输入正确1个,即可查询;您输入的信息为:$cwh  $cname";

// $_REQUEST[] 获取输入框名字的值

//用于页面输入的参数,查询数据库

try {

    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);

    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $stmt = $conn->prepare("SELECT id, name, wh, ted FROM eisc 

    where name='$cname'

    or wh='$cwh'"); 

    $stmt->execute();

 

    // 设置结果集为关联数组

    $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); 

    foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) { 

        echo $v;

    }

}

catch(PDOException $e) {

    echo "Error: " . $e->getMessage();

}

$conn = null;

echo "</table>";

?>



<br /><br /><br />

<p class="t2">为您展示以下分机:</p>

<ol>

<li><a href="http://www.eisc.cn">www.eisc.cn</a></li>

              <li><a href="http://work.eisc.cn">work.eisc.cn</a></li>

              <li><a href="http://work.eisc.cn/ruanjian">软件</a></li>

              <li><a href="http://sou.eisc.cn">sou.eisc.cn</a></li>

</ol>

</div>

</div>

</body>

</html>


提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:小绿叶通讯录站点源代码-php

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息