function showLinklist($categoryID, $type) { $conn = new DBOperation(); $html = ""; $sql = "SELECT * FROM categorys WHERE ID=" . $categoryID; $result = $conn->query($sql); if ($row = $result->fetch_array()) { $categoryName = $row['categoryName']; } else { $categoryName = ""; } if (isset($categoryID)) { $sql = "SELECT * FROM links WHERE categoryID=" . $categoryID . " order by `order`"; } else { $sql = "SELECT * FROM links"; } $result = $conn->query($sql); if (isset($type) && $type == 's') { $html .= "<form name='form' id='form'>"; $html .= "<select name='jumpMenu' id='jumpMenu'>\n"; $html .= "<option selected='selected'>{$categoryName}</option>"; while ($row = $result->fetch_array()) { $address = $row['linkAddress']; if (strstr($address, "http://") == "" && substr_count($address, "./") == 0) { $address = "http://" . $address; } $html .= "<option value='" . $address . "'>"; $html .= $row['linkName']; $html .= "</option>"; } $html .= "</select>\n"; $html .= "</form>\n"; } else { $html = "<ul>\n"; while ($row = $result->fetch_array()) { $address = $row['linkAddress']; if (strstr($address, "http://") == "" && substr_count($address, "./") == 0) { $address = "http://" . $address; } $html .= "<li><a href='" . $address . "' target='_blank' title='" . $row['comment'] . "'>"; if ($categoryID == 13) { $img = $row['logo']; $img = str_ireplace("<p>", "", $img); $img = str_ireplace("</p>", "", $img); $html .= $img; } else { $html .= $row['linkName']; } $html .= "</a></li>\n"; } $html .= "</ul>\n"; } return $html; }
function showVLink() { $conn = new DBOperation(); $html = ""; $sql = "SELECT * FROM links WHERE categoryID=11 order by `order` ASC,`addTime` DESC LIMIT 1"; $result = $conn->query($sql); if ($row = $result->fetch_array()) { $address = $row['linkAddress']; if (strstr($address, "http://") == "" && substr_count($address, "./") == 0) { $address = "http://" . $address; } $html .= "<a href='" . $address . "' target='_blank' title='" . $row['comment'] . "' title='" . $row['comment'] . "'>\n"; $html .= " <br /> \t"; $html .= "</a>\n"; } return $html; }
public function changePWD($oldPWD, $newPWD, $reNewPWD) { if ($this->isLogin != true) { return "尚未登入,无法修改密码!"; } if ($newPWD != $reNewPWD) { return "修改密码失败,两次输入的新密码不一致!"; } $oldPWD = md5($oldPWD); $newPWD = md5($newPWD); $reNewPWD = md5($reNewPWD); if ($oldPWD == $this->userPWD) { $conn = new DBOperation(); $sql = "UPDATE administrations SET password='******' WHERE adminName='{$this->userName}'"; $conn->query($sql); return "修改成功!"; } }
function showAnnounceList($s, $n) { $conn = new DBOperation(); $sql = "SELECT * FROM announcements ORDER BY annouceTime DESC LIMIT " . $s . "," . ($n + 1); $result = $conn->query($sql); echo "<ul>"; $i = 0; while (($row = $result->fetch_array()) && $i < $n) { $id = $row['ID']; echo "<li><a href='../showannounce.php?id={$id}&action=content' title='" . $row['comment'] . "' target='_blank'>" . $row["title"] . "</a></li>\n"; $i++; } echo "</ul>"; if (!($row = $result->fetch_array())) { return 0; } else { return 1; } }
<?php include_once "islogin.php"; if (!isset($_GET["id"])) { $html = "错误!"; } else { $id = $_GET["id"]; include_once "class.db.php"; $conn = new DBOperation(); $sql = "DELETE FROM links WHERE ID={$id}"; $conn->query($sql); $html = "删除成功!"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/admin.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>删除链接</title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="css.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="menu"> [ <a href="../index.php">返回首页</a> ][ <a href="announcements.php">公告管理</a> | <a href="announce.php">发布公告</a> ] [ <a href="categorys.php">板块管理</a><!-- | <a href="addCategory.php">添加板块</a>--> ] [ <a href="links.php">链接管理</a> | <a href="addlink.php">添加链接</a> | <a href="verify.php">用户提交查看</a> ] [ <a href="logout.php">退出</a> ] </div>
<!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="css.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="menu"> [ <a href="../index.php">返回首页</a> ][ <a href="announcements.php">公告管理</a> | <a href="announce.php">发布公告</a> ] [ <a href="categorys.php">板块管理</a><!-- | <a href="addCategory.php">添加板块</a>--> ] [ <a href="links.php">链接管理</a> | <a href="addlink.php">添加链接</a> | <a href="verify.php">用户提交查看</a> ] [ <a href="logout.php">退出</a> ] </div> <div id="content"> <!-- InstanceBeginEditable name="content" --> <?php echo $html; include_once "class.db.php"; $conn = new DBOperation(); $sql = "SELECT * FROM announcements WHERE announcements.ID=" . $_GET['aid']; $result = $conn->query($sql); if ($row = $result->fetch_array()) { $title = $row['title']; $content = $row['content']; } ?> <form id="form1" name="form1" method="post" action="editannouncement.php?action=edit&aid=<?php echo $_GET['aid']; ?> "> <p>标题: <label> <input type="text" name="title" id="title" value="<?php