一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

PHP+ACCESS 文章管理程序代碼

復(fù)制代碼 代碼如下:
<?php
session_start();
//==========================
//作者:biyuan
//時(shí)間:2006.07
//聯(lián)系:QQ6010707
//==========================
?>
<html>
<head>
<title>碧原網(wǎng)絡(luò)php+ACCESS文章管理系統(tǒng)</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<style type="text/css">
body {
margin:0px;
text-align:center;
font-size:12px;
font-family:verdana;
}
td {
font-size:12px;
height:28px;
padding:4px;
font-family:verdana;
}
A:link,
A:visited,
A:active {
color: #005a17; text-decoration: none;
}
A:hover {
color: #ff5a00; text-decoration: underline;
}
</style>
</head>
<body>
<?php
//==================================
//連接數(shù)據(jù)庫(kù)
//==================================
@$conn = new com("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("article.mdb"));
//==================================
//文章導(dǎo)航
//==================================
function article_menu(){
global $conn;
@$sql = "Select * From List";
@$rs = $conn->Execute($sql);
while(!$rs->Eof){
echo "| <a href=/"?classid=" . $rs->Fields[2]->value . "/">" . $rs->Fields[1]->value . "</a> ";
$rs->MoveNext();
}
echo "| <a href=/"?admin=login/">后臺(tái)管理</a>/r/n";
$rs->Close();
if(@$_SESSION["ARTICLEADMIN"] == "BY_php_ARTICLE"){
echo "<br />管理選項(xiàng)-> | <a href=/"?admin=class/">分類管理</a> | <a href=/"?admin=insert/">發(fā)表文章</a> | <a href=/"?admin=list/">文章列表</a> | <a href=/"?admin=logout/">退出登陸</a>";
}
}
//==================================
//文章列表:article_list(文章分類ID)
//==================================
function article_list($str){
global $conn;
@$sql = "Select id,by_title,by_name,by_time,by_count From Article Where by_class = " . $str . " Order By id desc";
@$rs = $conn->Execute($sql);
if(!$rs->Eof){
echo "<table border=/"0/" cellspacing=/"1/" cellpadding=/"0/" bgcolor=/"#cccccc/">/r/n"
. " <tr bgcolor=/"#F3F3F3/" align=/"center/">/r/n"
. " <td>文章標(biāo)題</td><td>文章作者</td><td>發(fā)表時(shí)間</td><td>瀏覽次數(shù)</td>/r/n"
. " </tr>/r/n";
while(!$rs->Eof){
echo " <tr bgcolor=/"#FFFFFF/">/r/n"
. " <td><a href=/"?artid=" . $rs->Fields[0]->value . "/">" . $rs->Fields[1]->value . "</a></td><td>" . $rs->Fields[2]->value . "</td><td>" . date("Y-m-d H:i:s",$rs->Fields[3]->value) . "</td><td>" . $rs->Fields[4]->value . "</td>/r/n"
. " </tr>/r/n";
$rs->MoveNext();
}
echo "</table>/r/n";
}
else {
echo "<br />該分類不存在或暫時(shí)沒(méi)有任何文章!";
}
$rs->Close();
}
//==================================
//文章詳細(xì):article_look(文章ID)
//==================================
function article_look($str){
global $conn;
@$sql = "Select * From Article Where id = " . $str;
@$rs = $conn->Execute($sql);
@$usql= "Update Article Set by_count = (by_count + 1) Where id = " . $str;
$conn->Execute($usql);
if(!$rs->Eof){
@$body = $rs->Fields[5]->value;
$body = str_replace("[url=file://%22,%22%22,$body/]//","",$body[/url]);
echo "<table border=/"0/" width=/"60%/" cellspacing=/"1/" cellpadding=/"0/" bgcolor=/"#cccccc/">/r/n"
. " <tr bgcolor=/"#F3F3F3/" align=/"center/">/r/n"
. " <td style=/"font-size:14px;font-weight:bold/">" . $rs->Fields[1]->value . "</td>/r/n"
. " </tr>/r/n"
. " <tr bgcolor=/"#F3F3F3/" align=/"center/">/r/n"
. " <td>文章作者:" . $rs->Fields[2]->value . " | 發(fā)表時(shí)間:" . date("Y-m-d H:i:s",$rs->Fields[3]->value) . " | 瀏覽次數(shù):" . $rs->Fields[4]->value . "</td>/r/n"
. " </tr>/r/n"
. " <tr bgcolor=/"#FFFFFF/">/r/n"
. " <td>" . $body . "</td>/r/n"
. " </tr>/r/n"
. " <tr bgcolor=/"#F3F3F3/">/r/n"
. " <td align=/"right/">【 <a href=/"Javascript:history.back();/">返 回</a> 】  【 <a href=/"Javascript:print();/">打 印</a> 】  【 <a href=/"Javascript:close();/">關(guān) 閉</a> 】</td>/r/n"
. " </tr>/r/n"
. " </table>/r/n"
. " <script language=/"JavaScript/">document.title += /"--" . $rs->Fields[1]->value . "/";</script>/r/n";
}
else {
echo "<br />該文章不存在或已被管理員刪除!";
}
$rs->Close();
}
//==================================
//后臺(tái):分類管理
//==================================
function admin_class(){
global $conn;
@$sql = "Select * From List";
@$rs = $conn->Execute($sql);
echo "<form action=/"/" method=/"post/" name=/"frm/">/r/n";
while(!$rs->Eof){
echo "類別:<input type=/"text/" value=/"" . $rs->Fields[1]->value . "/" name=/"class_" . $rs->Fields[0]->value . "/" /> 編號(hào):<input type=/"text/" value=/"" . $rs->Fields[2]->value . "/" name=/"class_cid_" . $rs->Fields[0]->value . "/" /> <input type=/"button/" value=/"修改/" onclick=/"frm.action='?admin=class&class=edit&id=" . $rs->Fields[0]->value . "';submit();/" /> <input type=/"button/" value=/"刪除/" onclick=/"frm.action='?admin=class&class=del&id=" . $rs->Fields[0]->value . "';submit();/" /><br />/r/n";
$rs->MoveNext();
}
echo "類別:<input type=/"text/" name=/"class_name/" /> 編號(hào):<input type=/"text/" name=/"class_cid/" /> <input type=/"button/" value=/"增加/" onclick=/"frm.action='?admin=class&class=add';submit();/" /> <input type=/"button/" value=/"閑置/" disabled />/r/n"
. "</form>/r/n";
//增加一個(gè)類別
if(@$_GET["class"] == "add"){
if(@$_POST["class_name"] == "" || @$_POST["class_cid"] == ""){
echo "<br />填寫不完整!";
echo "<script language=/"JavaScript/">setTimeout(/"history.back();/", 2000);</script>";
exit();
}
else {
@$sql = "Insert into List(by_list,by_cid) Values('" . $_POST["class_name"] . "' , '" . $_POST["class_cid"] . "')";
$conn->Execute($sql);
echo "<br />添加成功!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=class';/", 2000);</script>";
}
}
//修改一個(gè)類別
if(@$_GET["class"] == "edit"){
if(@$_POST["class_" . $_GET["id"]] == "" || @$_POST["class_cid_" . $_GET["id"]] == ""){
echo "<br />填寫不完整!";
echo "<script language=/"JavaScript/">setTimeout(/"history.back();/", 2000);</script>";
exit();
}
else {
@$sql = "Update List Set by_list = '" . $_POST["class_" . $_GET["id"]] . "' , by_cid = '" . $_POST["class_cid_" . $_GET["id"]] . "' Where id = " . $_GET["id"];
$conn->Execute($sql);
echo "<br />修改成功!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=class';/", 2000);</script>";
}
}
//刪除一個(gè)類別
if(@$_GET["class"] == "del"){
@$sql = "Delete From List Where id = " . $_GET["id"];
$conn->Execute($sql);
echo "<br />刪除成功!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=class';/", 100);</script>";
}
}
//==================================
//后臺(tái):發(fā)表文章(支持HTML)
//==================================
function admin_insert(){
global $conn;
if(@$_GET["innert"] == "add"){
if(@$_POST["title"] == "" || @$_POST["name"] == "" || @$_POST["class"] == "" || @$_POST["body"] == ""){
echo "<br />填寫不完整!";
echo "<script language=/"JavaScript/">setTimeout(/"history.back();/", 2000);</script>";
exit();
}
else {
@$body = $_POST["body"];
$body = str_replace("'", "''", $body);
$body = str_replace("/r/n", "<br />", $body);
@$sql = "Insert into article(by_title,by_name,by_time,by_count,by_body,by_class) Values('" . $_POST["title"] . "' , '" . $_POST["name"] . "' , #" . date("Y-m-d G:i:s") . "# , 0 , '" . $body . "' , '" . $_POST["class"] . "')";
$conn->Execute($sql);
echo "<br />添加成功!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=insert';/", 2000);</script>";
}
}
else {
echo "<div style=/"width:590px;text-align:left/">/r/n"
. "<form action=/"?admin=insert&innert=add/" method=/"post/">/r/n"
. "文章標(biāo)題:<input type=/"text/" name=/"title/" /><br />/r/n"
. "文章作者:<input type=/"text/" name=/"name/" /><br />/r/n"
. "文章類別:<select name=/"class/">/r/n";
@$sql = "Select * From List";
@$rs = $conn->Execute($sql);
while(!$rs->Eof){
echo "<option value=/"" . $rs->Fields[2]->value . "/">" . $rs->Fields[1]->value . "</option>/r/n";
$rs->MoveNext();
}
echo "</select><br />/r/n"
. "文章正文:<textarea cols=/"70/" rows=/"14/" name=/"body/"></textarea><br />/r/n"
. "<center><input type=/"submit/" value=/"提交/" /> <input type=/"reset/" value=/"重置/" /></center>/r/n"
. "</form>/r/n"
. "</div>/r/n";
}
}
//==================================
//后臺(tái):文章列表
//==================================
function admin_list(){
global $conn;
@$sql = "Select id,by_title,by_name,by_time,by_count,by_class From Article Order By id desc";
@$rs = $conn->Execute($sql);
if(!$rs->Eof){
echo "<table border=/"0/" cellspacing=/"1/" cellpadding=/"0/" bgcolor=/"#cccccc/">/r/n"
. " <tr bgcolor=/"#F3F3F3/" align=/"center/">/r/n"
. " <td>文章標(biāo)題</td><td>文章分類<td>文章作者</td><td>發(fā)表時(shí)間</td><td>瀏覽次數(shù)</td><td>操作</td>/r/n"
. " </tr>/r/n";
while(!$rs->Eof){
@$sql = "Select * From List Where by_cid = " . $rs->Fields[5]->value;
@$crs = $conn->Execute($sql);
@$cid = $crs->Fields[1]->value;
echo " <tr bgcolor=/"#FFFFFF/">/r/n"
. " <td><a href=/"?artid=" . $rs->Fields[0]->value . "/">" . $rs->Fields[1]->value . "</a></td><td>" . $cid . "</td><td>" . $rs->Fields[2]->value . "</td><td>" . $rs->Fields[3]->value . "</td><td>" . $rs->Fields[4]->value . "</td><td><a href=/"?admin=list&list=edit&id=" . $rs->Fields[0]->value . "/">編輯</a> | <a href=/"?admin=list&list=del&id=" . $rs->Fields[0]->value . "/">刪除</a></td>/r/n"
. " </tr>/r/n";
$crs->Close();
$rs->MoveNext();
}
echo "</table>/r/n";
}
else {
echo "<br />該分類不存在或暫時(shí)沒(méi)有任何文章!";
}
$rs->Close();
//修改文章
if(@$_GET["list"] == "edit"){
if(@$_GET["edit"] == "true"){
if(@$_POST["title"] == "" || @$_POST["name"] == "" || @$_POST["class"] == "" || @$_POST["body"] == ""){
echo "<br />填寫不完整!";
echo "<script language=/"JavaScript/">setTimeout(/"history.back();/", 2000);</script>";
exit();
}
else {
@$body = $_POST["body"];
$body = str_replace("'", "''", $body);
$body = str_replace("/r/n", "<br />", $body);
@$sql = "Update article Set by_title = '" . $_POST["title"] . "' , by_name = '" . $_POST["name"] . "' , by_count = " . $_POST["count"] . " , by_body = '" . $body . "' , by_class = '" . $_POST["class"] . "' Where id = " . $_GET["id"];
$conn->Execute($sql);
echo "<br />修改成功!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=list';/", 2000);</script>";
}
}
else {
@$sql = "Select * From Article Where id = " . $_GET["id"];
@$rs = $conn->Execute($sql);
echo "<div style=/"width:590px;text-align:left/">/r/n"
. "<form action=/"?admin=list&list=edit&edit=true&id=" . $rs->fields[0]->value . "/" method=/"post/">/r/n"
. "文章標(biāo)題:<input type=/"text/" name=/"title/" value=/"" . $rs->fields[1]->value . "/" /><br />/r/n"
. "文章作者:<input type=/"text/" name=/"name/" value=/"" . $rs->fields[2]->value . "/" /><br />/r/n"
. "瀏覽次數(shù):<input type=/"text/" name=/"count/" value=/"" . $rs->fields[4]->value . "/" /><br />/r/n"
. "文章類別:<select name=/"class/" id=/"class/">/r/n";
@$sql = "Select * From List";
@$crs = $conn->Execute($sql);
while(!$crs->Eof){
echo "<option value=/"" . $crs->Fields[2]->value . "/">" . $crs->Fields[1]->value . "</option>/r/n";
$crs->MoveNext();
}
$crs->close();
@$body = $rs->Fields[5]->value;
$body = str_replace("<br />","/r/n",$body);
echo "</select><br />/r/n"
. "<script language=/"JavaScript/">/r/n"
. "document.getElementById(/"class/").selectedIndex = " . $rs->fields[6]->value . " - 1;/r/n"
. "</script>/r/n"
. "文章正文:<textarea cols=/"70/" rows=/"14/" name=/"body/">" . $body . "</textarea><br />/r/n"
. "<center><input type=/"submit/" value=/"提交/" /> <input type=/"reset/" value=/"重置/" /></center>/r/n"
. "</form>/r/n"
. "</div>/r/n";
}
}
//刪除文章
if(@$_GET["list"] == "del"){
@$sql = "Delete From Article Where id = " . $_GET["id"];
$conn->Execute($sql);
echo "<br />刪除成功!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=list';/", 100);</script>";
}
}
//==================================
//權(quán)限驗(yàn)證
//==================================
function admin_session(){
if(@$_SESSION["ARTICLEADMIN"] != "BY_php_ARTICLE"){
echo "<br />請(qǐng)先登陸!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=login';/", 2000);</script>";
exit();
}
}
//==================================
//后臺(tái)登陸
//==================================
function admin_login(){
if(@$_SESSION["ARTICLEADMIN"] == "BY_php_ARTICLE"){
echo "<script language=/"JavaScript/">window.location.href='?admin=admin';</script>";
}
else{
echo "<table border=/"0/" cellspacing=/"1/" cellpadding=/"0/" bgcolor=/"#cccccc/">/r/n"
. " <tr bgcolor=/"#F3F3F3/" align=/"center/">/r/n"
. " <td><strong>管理員登陸</strong></td>/r/n"
. " </tr>/r/n"
. " <tr bgcolor=/"#FFFFFF/">/r/n"
. " <form method=/"post/" action=/"?admin=check/">/r/n"
. " <td><input type=/"password/" name=/"adminPass/" /><input type=/"submit/" value=/"確定/" /></td>/r/n"
. " </form>/r/n"
. " </tr>/r/n"
. "</table>/r/n";
}
}
//==================================
//登陸驗(yàn)證
//==================================
function admin_check(){
if(trim($_POST["adminPass"]) != "admin"){
echo "<br />錯(cuò)誤的密碼!";
echo "<script language=/"JavaScript/">setTimeout(/"history.back();/", 2000);</script>";
}
else {
echo "<br />登陸成功!";
@$_SESSION["ARTICLEADMIN"] = "BY_php_ARTICLE";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=admin';/", 2000);</script>";
}
}
//==================================
//URL參數(shù)列表
//==================================
function page_load(){
@$classid = $_GET["classid"];
if($classid != ""){
if(!is_numeric($classid)){
echo "<br />錯(cuò)誤的參數(shù)!";
return false;
}
else {
article_list($classid);
}
}
@$artid = $_GET["artid"];
if($artid != ""){
if(!is_numeric($artid)){
echo "<br />錯(cuò)誤的參數(shù)!";
return false;
}
else {
article_look($artid);
}
}
@$admin = $_GET["admin"];
if($admin == "login"){
admin_login();
}
if($admin == "check"){
admin_check();
}
if($admin == "admin"){
admin_session();
echo "<br />登陸成功!請(qǐng)選擇功能菜單進(jìn)行操作.";
}
if($admin == "logout"){
session_destroy();
echo "<br />已成功退出!";
echo "<script language=/"JavaScript/">setTimeout(/"window.location.href='?admin=login';/", 2000);</script>";
}
if($admin == "class"){
admin_session();
admin_class();
}
if($admin == "insert"){
admin_session();
admin_insert();
}
if($admin == "list"){
admin_session();
admin_list();
}
if($classid == "" && $artid == "" && $admin == ""){
echo "<script language=/"JavaScript/">window.location.href='?classid=1';</script>";
}
}
?>
<div style="width:100%;text-align:left;background:#cccccc;line-height:20px;">
<br /><br /><br />文章分類-> <?=article_menu();?>
</div>
<?=page_load();?>
<?php
$conn->Close();
?>
</body>
</html>

php技術(shù)PHP+ACCESS 文章管理程序代碼,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲综合激情视频 | 亚洲人成综合在线播放 | 91久久国产视频 | 福利91| 亚洲欧美国产另类 | 中文婷婷 | 久久国产成人 | 久久香蕉国产精品一区二区三 | 国产精品一区二区在线播放 | 最近中文字幕无吗免费视频 | 在线观看一区 | 久久大香伊蕉在人线国产昨爱 | 国产成人亚洲综合 | 欧美日韩亚洲区久久综合 | 国产精品网站 夜色 | 国产成人综合亚洲欧美在 | 在线成人免费视频 | 国产三级自拍 | 亚洲国产成人久久午夜 | 黄在线观看www免费看 | 99精品国产第一福利网站 | 九色视频在线看 | a爱视频 | 日本精品一区二区三区在线观看 | 久久婷婷激情综合色综合也去 | 久久久91精品国产一区二区 | 91麻豆国产视频 | 欧美成人v视频免费看 | 色综合久久夜色精品国产 | 成人精品视频一区二区在线 | 黄网在线观看视频 | 色婷婷狠狠 | 四虎精品免费视频 | 激情网站免费 | 在线亚洲欧洲国产综合444 | 手机在线黄色网址 | 波多野结衣在线影院 | 婷婷四房 | 久久免费福利视频 | 国产69页 | 一本色道久久综合亚洲精品 |