{"id":662,"date":"2012-05-20T13:54:57","date_gmt":"2012-05-20T05:54:57","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=662"},"modified":"2012-05-20T14:14:47","modified_gmt":"2012-05-20T06:14:47","slug":"%e5%88%86%e4%ba%ab%e4%b8%80%e4%b8%aa%e7%ae%80%e5%8d%95%e7%9a%84phpmysql%e7%95%99%e8%a8%80%e6%9d%bf%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/662","title":{"rendered":"\u5206\u4eab\u4e00\u4e2a\u7b80\u5355\u7684PHP&MYSQL\u7559\u8a00\u677f\u7a0b\u5e8f"},"content":{"rendered":"

\u5b9e\u73b0\u5730\u5740\u5982\uff1ahttp:\/\/www.nbqq.net\/liuyanban\/<\/a><\/p>\n

\u6570\u636e\u5e93\u7ed3\u6784<\/strong>\uff1a(\u5e93\u540d\uff1alyb)<\/p>\n

\u8868\u4e00: admin
\n\u5b57\u6bb5: id(int11)\u00a0\u00a0 name(varchvr)\u00a0\u00a0 password(varchvr)<\/p>\n

\u8868\u4e8c: lo
\n\u5b57\u6bb5: id(int11)\u00a0\u00a0 username(varchvr)\u00a0 sex(varchvr)\u00a0 qq(varchvr)\u00a0 email(varchvr)\u00a0 info(text)\u00a0 ip(varchvr)\u00a0 submit_time(datetime)<\/p>\n

1\u3001conn.php(\u8fde\u63a5\u6570\u636e\u5e93\u6587\u4ef6)<\/strong><\/p>\n

<?php
\nmysql_connect(“localhost”,”root”,””);\/\/\u8fde\u63a5\u6570\u636e\u5e93
\nmysql_select_db(“lyb”);\/\/\u9009\u62e9\u6570\u636e\u5e93
\n?><\/p>\n

2\u3001header.php(\u516c\u7528\u5934\u90e8\u6587\u4ef6)<\/strong><\/p>\n

<!DOCTYPE html PUBLIC “-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN” “http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd<\/a>“>
\n<html xmlns=”
http:\/\/www.w3.org\/1999\/xhtml<\/a>“>
\n<head>
\n<meta http-equiv=”Content-Type” content=”text\/html; charset=utf-8″ \/>
\n<title>\u94f6\u5b50\u7559\u8a00\u677f Version 1.0<\/title>
\n<\/head>
\n<link href=”css.css” rel=”stylesheet” type=”text\/css” \/>
\n<body>
\n<div id=”head”>
\n\u00a0\u00a0\u00a0 <div id=”head_l”>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <ul>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <li><a href="”joefy.qiq”&hu;\v5076\v8981\v770c\v7559\v8b00μ\/b&hu;μ\/mj&hu;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <li><a href="”qptu.qiq”&hu;\v5076\v8981\v53e1\v8868μ\/b&hu;μ\/mj&hu;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <?php
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 session_start();
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if($_SESSION[“key”]==1){\/\/\u5982\u679c\u83b7\u53d6\u7684SESSION\u4e3a1\u5219\u663e\u793a\u7ba1\u7406\u9879
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <li><a href="”benjofyju.qiq”&hu;\v9000\v51gb\v7cb1\v7406μ\/b&hu;μ\/mj&hu;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <?
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <li><a href="”benjo.qiq”&hu;\v5076\v8981\v7cb1\v7406μ\/b&hu;μ\/mj&hu;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <?}?>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/ul>
\n\u00a0\u00a0\u00a0 <\/div>
\n\u00a0\u00a0\u00a0 <div id=”head_r”>\u94f6\u5b50\u7559\u8a00\u677f Version 1.0<\/div>
\n<\/div><\/p>\n

3\u3001footer.php(\u516c\u7528\u5e95\u90e8\u6587\u4ef6)<\/strong><\/p>\n

 <\/p>\n

<?php
\n$counterFile=”conter.xml”;
\nfunction displayCounter($counterFile){
\n$fp\u00a0 =\u00a0 fopen($counterFile,”rw”);
\n$num =\u00a0 fgets($fp,5);
\n$num += 1;
\nprint “<div id=\\”footer\\”>\u94f6\u5b50\u7559\u8a00\u677f Version 1.0&nbsp;&nbsp;&nbsp;\u60a8\u662f\u7b2c&nbsp;”.”$num”.”&nbsp;\u4f4d\u65e0\u804a\u7684\u94f6<\/div>”;
\nexec(“rm -rf $counterFile”);
\nexec(“echo $num > $counterFile”);
\n}
\nif(!file_exists($counterFile)){
\nexec(“echo 0 > $counterFile”);
\n}
\ndisplayCounter($counterFile);
\n?><\/p>\n

<\/body>
\n<\/html><\/p>\n

4\u3001index.php(\u9996\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nrequire_once(“conn.php”);
\nrequire_once(“header.php”);
\nsession_start();<\/p>\n

\/\/\u5206\u9875\u4ee3\u7801\u5f00\u59cb
\n$pagesize = 10;\/\/\u8bbe\u7f6e\u6bcf\u9875\u663e\u793a\u6761\u6570
\n$rs = mysql_query(“select count(*) from lo”);\/\/\u53d6\u5f97\u8bb0\u5f55\u603b\u6570\uff0c\u8ba1\u7b97\u603b\u9875\u6570\u7528
\n$myrow = mysql_fetch_array($rs);
\n$numrows = $myrow[0];\/\/\u8ba1\u7b97\u603b\u8bb0\u5f55<\/p>\n

$pages = intval($numrows\/$pagesize);
\nif($numrows%$pagesize)$pages++;\/\/\u8bbe\u7f6e\u9875\u6570
\nif(isset($_GET[‘page’]))
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $page = intval($_GET[‘page’]);
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 else
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $page = 1;\/\/\u8bbe\u4e3a\u7b2c\u4e00\u9875
\n\u00a0\u00a0\u00a0 }
\n$offset = $pagesize*($page-1);\/\/\u8ba1\u7b97\u8bb0\u5f55\u504f\u79fb\u91cf
\n\/\/\u5206\u9875\u4ee3\u7801\u7ed3\u675f
\n$sql = “select id,username,sex,qq,email,info,ip,DATE_FORMAT(submit_time, ‘%Y\u5e74%m\u6708%d\u65e5 %T’ ) from lo order by id desc limit $offset,$pagesize”;\/\/\u7528\u5230\u4e86DATE-FORMAT\u683c\u5f0f\u5316\u65e5\u671f\u683c\u5f0f
\n$result = mysql_query($sql);
\n$num = mysql_num_rows($result);<\/p>\n

if($num>0){
\n\u00a0\u00a0\u00a0 while($row = mysql_fetch_array($result))
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0 \/\/echo print_r($row);
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if($row[2]==”\u7537”)\/\/\u8fd9\u4e2a\u4f7f\u6027\u522b\u6539\u6210\u4f60\u60f3\u8981\u7684\u540d\u79f0^_^
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $sex = “\u5e05\u9505”;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $sex = “\u7f8e\u5973”;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n?><\/p>\n

<div id=”show”>
\n\u00a0\u00a0\u00a0 <p>\u7b2c [<?= $row[0] ?>] \u6761\u7559\u8a00<p>
\n\u00a0\u00a0\u00a0 <p>\u7559\u8a00\u4eba:<span><?= $row[1]?><\/span>&nbsp;&nbsp;\u6027\u522b:<?= $sex ?>&nbsp;&nbsp;\u7559\u8a00\u65f6\u95f4\uff1a<?= $row[7] ?>&nbsp;<? if($row[3]) {?>&nbsp;<a href="”iuuq:\/\/xqb.rr.dpn\/nthse?W=1&bnq;Vjo=μ?=" $row[3] ?>&Site=http:\/\/www.loai.cn&Menu=yes”><img src=”img\/qq.gif” alt=”<?= $row[3]?>” \/><\/a><? } ?><? if($row[4]){ ?>&nbsp;<a href="”nbjmup:μ?=" $row[4] ?>”><img src=”img\/email.gif” alt=”<?= $row[4]?>” \/><\/a>&nbsp;<? }?><? if($_SESSION[“key”]==1){ ?>&nbsp;IP:<?= $row[6] ?>&nbsp;&nbsp;<a href="”vqebuf.qiq?xvmfzjoh&bnq;je=μ?=" $row[0]?>”>\u66f4\u6539<\/a>&nbsp;<a href="”efmfuf.qiq?xvmfzjoh&bnq;je=μ?=" $row[0]?>”>\u5220\u9664<\/a><?}?><\/a><\/p>
\n\u00a0\u00a0\u00a0 <p>\u7559\u8a00\u5185\u5bb9:<\/p>
\n\u00a0\u00a0\u00a0 <div id=”show_info”><?= nl2br(htmlspecialchars($row[5])) ?><\/div>
\n<\/div>
\n<?php
\n\u00a0\u00a0\u00a0 }
\n}
\nelse
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo “<div id=\\”show\\”>\u65e0\u6570\u636e……<\/div>”;
\n\u00a0\u00a0\u00a0 }
\n?><\/p>\n

<div id=”show_page”>
\n<p>
\n<?php
\n$first=1;
\n$prev=$page-1;
\n$next=$page+1;
\n$last=$pages;
\nif($page==1&&$pages>1)
\n{
\n\u00a0\u00a0\u00a0 echo “\u9996\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u4e0a\u4e00\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$next.”\\”>\u4e0b\u4e00\u9875<\/a>&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$last.”\\”>\u5c3e\u9875<\/a>&nbsp;|&nbsp;”;
\n}
\nelseif($page>=1&&$page!=$pages&&$num>0)
\n{
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$first.”\\”>\u9996\u9875<\/a>&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$prev.”\\”>\u4e0a\u4e00\u9875<\/a>&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$next.”\\”>\u4e0b\u4e00\u9875<\/a>&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$last.”\\”>\u5c3e\u9875<\/a>&nbsp;|&nbsp;”;
\n}
\nelseif($page==$pages&&$page!=1)
\n{
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$first.”\\”>\u9996\u9875<\/a>&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “<a href="\"\”index.php?page=”.$prev.”\\”>\u4e0a\u4e00\u9875<\/a>&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u4e0b\u4e00\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u5c3e\u9875&nbsp;|&nbsp;”;
\n}
\nelseif($page==$pages)
\n{
\n\u00a0\u00a0\u00a0 echo “\u9996\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u4e0a\u4e00\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u4e0b\u4e00\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u5c3e\u9875&nbsp;|&nbsp;”;\u00a0\u00a0\u00a0
\n}
\nelse
\n{
\n\u00a0\u00a0\u00a0 echo “\u9996\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u4e0a\u4e00\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u4e0b\u4e00\u9875&nbsp;|&nbsp;”;
\n\u00a0\u00a0\u00a0 echo “\u5c3e\u9875&nbsp;|&nbsp;”;
\n}
\n?>
\n\u5171&nbsp;<span><?= $pages ?><\/span>&nbsp;\u9875&nbsp;|&nbsp;\u5f53\u524d\u7b2c&nbsp;<span><?= $page ?><\/span>&nbsp;\u9875&nbsp;|&nbsp;\u5171&nbsp;<span><?=$numrows ?><\/span>&nbsp\u6761\u7559\u8a00<\/p>
\n<\/div>
\n<?php
\nmysql_close();
\n?><\/p>\n

<?php
\nrequire_once(“footer.php”);
\n?><\/p>\n

 <\/p>\n

5\u3001post.php(\u63d0\u4ea4\u7559\u8a00\u9875\u9762)<\/strong><\/p>\n

<?
\nrequire_once(“header.php”);
\n?>
\n<div id=”input”>
\n<form method=”post” action=”input.php” name=”form1″>
\n\u00a0\u00a0\u00a0 <h1>\u63d0\u4ea4\u7559\u8a00<\/h1>
\n\u00a0\u00a0\u00a0 <p>\u59d3\u540d \uff1a<input type=”text” name=”name” size=”20″ \/>&nbsp;<\/p>
\n\u00a0\u00a0\u00a0 <p>\u6027\u522b \uff1a<input name=”sex” type=”radio” value=”\u7537” checked\/>&nbsp;\u5e05\u9505&nbsp;<input type=”radio” name=”sex” value=”\u5973”\/>&nbsp;\u7f8e\u5973<\/p>
\n\u00a0\u00a0\u00a0 <p>Q Q\u3000\uff1a<input type=”text” name=”qq” \/>&nbsp;(\u53ef\u9009\u586b)<\/p>
\n\u00a0\u00a0\u00a0 <p>Email\uff1a<input type=”text” name=”email” \/>&nbsp;(\u53ef\u9009\u586b)<\/p>
\n\u00a0\u00a0\u00a0 <p>\u7559\u8a00\u5185\u5bb9\uff1a<\/p>
\n\u00a0\u00a0\u00a0 <p><textarea name=”info” rows=”5″ cols=”40″><\/textarea><\/p>
\n\u00a0\u00a0\u00a0 <p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <input type=”submit” value=”\u5076\u586b\u597d\u4e86” \/>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <input type=”reset” value=”\u5076\u8981\u91cd\u5199”>
\n\u00a0\u00a0\u00a0 <\/p>
\n\u00a0\u00a0\u00a0 <p>\u94f6\u5b50\u7559\u8a00\u677f Version 1.0<\/p>
\n<\/form>
\n<\/div>
\n<\/body>
\n<\/html><\/p>\n

6\u3001input.php(\u63d2\u5165\u7559\u8a00)<\/strong><\/p>\n

 <\/p>\n

<?php
\nrequire_once(“conn.php”);
\n$username = $_POST[‘name’];
\n$sex = $_POST[‘sex’];
\n$qq = $_POST[‘qq’];
\n$email = $_POST[’email’];
\n$info = $_POST[‘info’];<\/p>\n

if (strrpos($username,”<“)!==false || strrpos($username,”>”)!==false||strrpos($username,”@”)!==false||strrpos($username,”\\””)!==false||strrpos($username,”‘”)!==false||strrpos($username,”_”)!==false)
\n{
\n\u00a0\u00a0\u00a0 echo “<script>alert(‘\u540d\u79f0\u4e0d\u80fd\u6709\u7279\u6b8a\u5b57\u7b26\uff01’);location.href="’qptu.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0 exit();
\n}<\/p>\n

if (!ereg(“^[0-9]{0,}$”,$qq))\/\/\u7528\u6b63\u5219\u68c0\u67e5QQ\u683c\u5f0f
\n{
\n\u00a0\u00a0\u00a0 echo “<script>alert(‘OICQ\u4fe1\u606f\u6709\u9519\u8bef\uff01\u5fc5\u987b\u662f\u6570\u5b57\uff01’);location.href="’qptu.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0 exit();
\n}<\/p>\n

if($email)
\n{\/\/\u5982\u679c\u586b\u5199\u4e86\u90ae\u7bb1\u5c31\u7528\u6b63\u5219\u68c0\u67e5\u90ae\u7bb1\u683c\u5f0f
\n\u00a0\u00a0\u00a0 if (!ereg(“^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9\\-]+\\.[a-zA-Z0-9\\-\\.]+$”,$email))
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo “<script>alert(’email\u683c\u5f0f\u4e0d\u6b63\u786e\uff01’);location.href="’qptu.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 exit();
\n\u00a0\u00a0\u00a0 }
\n}<\/p>\n

if(!$username)
\n{
\n\u00a0\u00a0\u00a0 echo “<script>alert(‘\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u54e6\uff01’);location.href="’qptu.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0 exit();
\n}
\nelseif(!$info)
\n{
\n\u00a0\u00a0\u00a0 echo “<script>alert(‘\u7559\u8a00\u4e0d\u80fd\u4e3a\u7a7a\u54e6\uff01’);location.href="’qptu.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0 exit();
\n}
\nelse
\n{
\n\u00a0\u00a0\u00a0 $ip = getenv(‘REMOTE_ADDR’);\/\/\u83b7\u53d6\u5ba2\u6237\u7aefIP\u5730\u5740<\/p>\n

\u00a0\u00a0\u00a0 $sql = “insert into lo (username,sex,qq,email,info,ip,submit_time) values (‘$username’,’$sex’,’$qq’,’$email’,’$info’,’$ip’,NOW())”;<\/p>\n

\u00a0\u00a0\u00a0 $result = mysql_query($sql);<\/p>\n

\u00a0\u00a0\u00a0 mysql_close();<\/p>\n

\u00a0\u00a0\u00a0 echo “<script>alert(‘\u63d0\u4ea4\u6210\u529f\uff01\u8fd4\u56de\u9996\u9875’);location.href="’joefy.qiq’;μ\/tdsjqu&hu;”;\n}
\n?><\/p>\n

7\u3001update.php(\u4fee\u6539\u7559\u8a00\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nsession_start();
\nrequire_once(‘conn.php’);
\nrequire_once(‘header.php’);
\nif($_SESSION[“key”]==1)
\n{
\n$id = $_GET[‘id’];
\n$sql = “select * from lo where id= “.$id;
\n$result = mysql_query($sql);
\n$row = mysql_fetch_array($result);<\/p>\n

?><\/p>\n

<div id=”update”>
\n\u00a0\u00a0\u00a0 <form action=”updatepost.php?wuleying&id=<?= $row[0] ?>” method=”post”>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <h1>\u4fee\u6539\u7559\u8a00<\/h1>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p>\u59d3\u540d\uff1a<input type=”text” value=”<?= $row[1]?>” name=”name”><\/input><\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p>\u7559\u8a00\uff1a<\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p><textarea\u00a0 name=”info” rows=”5″ cols=”35″><?= $row[5] ?><\/textarea><\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p><input type=”submit” value=”\u5076\u8981\u4fee\u6539” \/><\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p>\u94f6\u5b50\u7559\u8a00\u677f Version 1.0<\/p>
\n\u00a0\u00a0\u00a0 <\/form><\/p>\n

<div>
\n<?php
\n}
\nelse
\n{
\nheader(‘location:index.php’);
\n}
\n?><\/p>\n

8\u3001updatepost(\u4fee\u6539\u63d0\u4ea4\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nrequire_once(‘conn.php’);<\/p>\n

$username = $_POST[‘name’];
\n$info = $_POST[‘info’];
\n$id = $_GET[‘id’];
\n\/\/echo $id;<\/p>\n

$sql = “update lo set username= ‘”.$username.”‘,info='”.$info.”‘ where id=”.$id;
\nmysql_query($sql);<\/p>\n

echo “<script>alert(‘\u4fee\u6539\u6210\u529f\uff01’);location.href="’joefy.qiq’;μ\/tdsjqu&hu;”;\n?><\/p>\n

9\u3001delete.php(\u5220\u9664\u7559\u8a00\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nsession_start();
\nrequire_once(‘conn.php’);<\/p>\n

$id=$_GET[‘id’];<\/p>\n

if($_SESSION[“key”]==1)
\n{
\n$sql = “delete from lo where id=”.$id;
\nmysql_query($sql);
\necho “<script>location.href="’joefy.qiq"'<\/script>”;
\n}
\nelse
\n{
\nheader(‘location:index.php’);
\n}
\n?><\/p>\n

10\u3001admin.php(\u7ba1\u7406\u767b\u5f55\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nrequire_once(‘conn.php’);
\nrequire_once(‘header.php’);
\n?><\/p>\n

<div id=”admin”>
\n\u00a0\u00a0\u00a0 <form method=”post” action=”adminpost.php”>
\n\u00a0\u00a0\u00a0 <h1>\u7ba1\u7406\u5458\u767b\u5f55<\/h1>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p>\u59d3\u540d : <input type=”text” name=”name” size=”20″ \/>&nbsp;<\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p>\u5bc6\u7801 : <input type=”password” name=”password” size=”20″ \/>&nbsp;<\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p><input type=”submit” value=”\u7ba1\u7406\u5458\u767b\u5f55” \/><\/p>
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <p>\u94f6\u5b50\u7559\u8a00\u677f Version 1.0<\/p>
\n\u00a0\u00a0\u00a0 <\/form>
\n<\/div><\/p>\n

11\u3001adminpost.php(\u7ba1\u7406\u9a8c\u8bc1\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nsession_start();
\nrequire_once(‘conn.php’);<\/p>\n

$name = $_POST[‘name’];
\n$password = $_POST[‘password’];<\/p>\n

$sql = “select * from admin where name='”.$name.”‘”;
\n$result = mysql_query($sql);
\n$num = mysql_num_rows($result);<\/p>\n

if (strrpos($name,”<“)!==false || strrpos($name,”>”)!==false||strrpos($name,”@”)!==false||strrpos($name,”\\””)!==false||strrpos($name,”‘”)!==false||strrpos($name,”_”)!==false)
\n{
\n\u00a0\u00a0\u00a0 echo “<script>alert(‘\u4e0d\u80fd\u6709\u7279\u6b8a\u5b57\u7b26\uff01’);location.href="’benjo.qiq’;μ\/tdsjqu&hu;”;\n}<\/p>\n

if($num)
\n{\/\/\u5982\u679c\u7528\u6237\u5b58\u5728\uff0c\u5c31\u68c0\u67e5\u5bc6\u7801\u662f\u5426\u6b63\u786e
\n\u00a0\u00a0\u00a0 $rs = mysql_fetch_array($result);
\n\u00a0\u00a0\u00a0 if($rs[2]!=$password)
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo “<script>alert(‘\u5bc6\u7801\u4e0d\u6b63\u786e\uff0c\u8bf7\u786e\u8ba4\u540e\u8f93\u5165\uff01’);location.href="’benjo.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 else
\n\u00a0\u00a0\u00a0 {\/\/\u7528\u6237\u540d\uff0c\u5bc6\u7801\u90fd\u6b63\u786e\uff0c\u6ce8\u518cSESSION\u53d8\u91cf\uff0c\u7136\u540e\u8df3\u8f6c\u5230\u9996\u9875
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $_SESSION[“key”]=1;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo “<script>alert(‘\u767b\u5f55\u6210\u529f\uff01’);location.href="’joefy.qiq’;μ\/tdsjqu&hu;”;\n\u00a0\u00a0\u00a0 }
\n}
\nelse
\n{\/\/\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u7528\u6237
\n\u00a0\u00a0\u00a0 echo “<script>alert(‘\u6ca1\u6709\u8fd9\u4e2a\u7528\u6237\uff0c\u8bf7\u786e\u8ba4\u540e\u8f93\u5165\uff01’);location.href="’benjo.qiq’;μ\/tdsjqu&hu;”;\n}
\n?><\/p>\n

12\u3001adminexit.php(\u9000\u51fa\u7ba1\u7406\u9875)<\/strong><\/p>\n

 <\/p>\n

<?php
\nsession_start();
\n$_SESSION[“key”] = 0;\/\/\u4f7fSESSION\u4e0d\u4e3a1\uff0c0\u4e3a\u6e38\u5ba2\uff0c1\u4e3a\u7ba1\u7406\u5458<\/p>\n

header(‘location:index.php’);
\n?><\/p>\n

\u53ea\u662f\u4e9b\u57fa\u672c\u7684\u4e1c\u4e1c\uff0c\u50cfMD5\u52a0\u5bc6\uff0cUBB\uff0c\u8868\u60c5\u56fe\u7247,\u6dfb\u52a0\u7ba1\u7406\u5458\u8d26\u53f7\uff0c\u56de\u590d\u7559\u8a00(-_!!)\u7b49\u6211\u90fd\u6ca1\u52a0\u4e0a\u53bb\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u5b8c\u5584\u4e0b\uff0c\u4e0d\u8db3\u7684\u5730\u65b9\u8bf7\u6307\u51fa^_^<\/p>\n

————————————————————–<\/p>\n

\u539f\u6587\u662f\u6ca1\u6709\u5efa\u8868\u6587\u4ef6\u7684\u3002\u4e0b\u9762\u6211\u8d34\u51fa\u6765\u6211\u5199\u7684\uff1a<\/p>\n

<?php
\n\u00a0$link=mysql_connect(‘localhost’,”,”);\/\/\u5982\u5b9e\u586b\u5199\u81ea\u5df1\u7684
\n\u00a0mysql_select_db(“***”,);
\n\u00a0mysql_query(“set names utf-8”);<\/p>\n

$sql_cre_lo=mysql_query(“CREATE TABLE IF NOT EXISTS `lo` (
\n\u00a0`id` int(11) NOT NULL auto_increment,
\n\u00a0\u00a0`username` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`sex` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`qq` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`email` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`info` text(400)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`ip` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`submit_time` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0 PRIMARY KEY\u00a0 (`id`)
\n)”);
\n$sql_cre_admin=mysql_query(“CREATE TABLE IF NOT EXISTS `admin` (
\n\u00a0`id` int(11) NOT NULL auto_increment,
\n\u00a0\u00a0`name` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,
\n\u00a0\u00a0`password` varchar(20)\u00a0 CHARACTER SET utf-8 COLLATE utf-8_chinese_ci NOT NULL,<\/p>\n

)”);<\/p>\n

mysql_query(“INSERT INTO `admin` (`id`, `name`, `password`) VALUES
\n(1, ‘www.youthtribe.com’, ‘youthtribe’)”);
\n?><\/p>\n

\u8fd9\u6837\u7684\u8bdd\uff0c\u767b\u540d\u548c\u5bc6\u7801\u4e3a\uff1awww.youthtribe.com<\/a>\u548cyouthtribe\u4e86\u3002<\/p>\n

\u8d76\u7d27\u81ea\u5df1\u8bd5\u8bd5\u5427\uff01\uff01\uff01<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5b9e\u73b0\u5730\u5740\u5982\uff1ahttp:\/\/www.nbqq.net\/liuyanban\/ \u6570\u636e\u5e93\u7ed3\u6784\uff1a(\u5e93\u540d\uff1alyb) \u8868\u4e00: admin \u5b57\u6bb5: id(int11)\u00a0\u00a0 name(varchvr)\u00a0\u00a0 password(varchvr) \u8868\u4e8c: lo \u5b57\u6bb5: id(int11)\u00a0\u00a0 username(varchvr)\u00a0 sex(varchvr)\u00a0 qq(varchvr)\u00a0 email(varchvr)\u00a0 info(text)\u00a0 ip(varchvr)\u00a0 submit_time(datetime) 1\u3001conn.php(\u8fde\u63a5\u6570\u636e\u5e93\u6587\u4ef6)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,9],"tags":[104],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/662"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=662"}],"version-history":[{"count":5,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/662\/revisions"}],"predecessor-version":[{"id":665,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/662\/revisions\/665"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}