www.6766.comPHP+ACCESS 文章管理程序代码_php技巧_脚本之家

复制代码 代码如下:

碧原网络PHP+ACCESS文章管理系统

Open(“DRIVER={Microsoft Access Driver }; DBQ=” . realpath;
//================================== //文章导航
//================================== function article_menu(){ global
$conn; @$sql = “Select * From List”; @$rs = $conn->Execute; while{
echo “|” . $rs->Fields[1]->value .
“”; $rs->MoveNext(); }
echo
“|后台管理rn”;
$rs->Close(); if(@$_SESSION[“ARTICLEADMIN”] ==
“BY_PHP_ARTICLE”){ echo “
管理选项->|分类管理|发表文章|文章列表|退出登陆”;
} } //================================== //文章列表:article_list
//================================== function article_list{ 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{ echo “

rn” . “

rn” . “

文章标题

文章作者

发表时间

浏览次数

rn” . “

rn”; while{ echo “

rn” . “

” . $rs->Fields[1]->value .

” . $rs->Fields[2]->value . “

” . date(“Y-m-d H:i:s”,$rs->Fields[3]->value) . “

” . $rs->Fields[4]->value . “

rn” . “

rn”; $rs->MoveNext(); } echo “

rn”; } else { echo “
该分类不存在或暂时没有任何文章!”; } $rs->Close(); }
//================================== //文章详细:article_look
//================================== function article_look{ global
$conn; @$sql = “Select * From Article Where id = ” . $str; @$rs =
$conn->Execute; @$usql= “Update Article Set by_count = Where id = ”
. $str; $conn->Execute{ @$body = $rs->Fields[5]->value; $body
= str_replace(“[url=file://%22,%22%22,$body/]\”,””,$body[/url]);
echo “

rn” . “

rn” . “

” . $rs->Fields[1]->value . “

rn” . “

rn” . “

rn” . “

文章作者:” . $rs->Fields[2]->value . “|发表时间:” . date(“Y-m-d
H:i:s”,$rs->Fields[3]->value) . “|浏览次数:” .
$rs->Fields[4]->value . “

rn” . “

rn” . “

rn” . “

” . $body . “

rn” . “

rn” . “

rn” . “

【 rn” .

rn” . “

rn” . “

rn”; } else { echo “
该文章不存在或已被管理员删除!”; } $rs->Close(); }
//================================== //后台:分类管理
//================================== function admin_class(){ global
$conn; @$sql = “Select * From List”; @$rs = $conn->Execute; echo
“rn”; //增加一个类别 if(@$_GET[“class”] == “add”){
if(@$_POST[“class_name”] == “” || @$_POST[“class_cid”] == “”){
echo “
填写不完整!”; echo “

“; exit(); } else { @$sql = “Insert into List Values(‘” .
$_POST[“class_name”] . “‘ , ‘” . $_POST[“class_cid”] . “‘)”;
$conn->Execute; echo “
添加成功!”; echo “

“; } } //修改一个类别 if(@$_GET[“class”] == “edit”){
if(@$_POST[“class_” . $_GET[“id”]] == “” ||
@$_POST[“class_cid_” . $_GET[“id”]] == “”){ echo “
填写不完整!”; echo “

“; 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; echo “
修改成功!”; echo “

“; } } //删除一个类别 if(@$_GET[“class”] == “del”){ @$sql = “Delete
From List Where id = ” . $_GET[“id”]; $conn->Execute; echo “
删除成功!”; echo “

“; } } //================================== //后台:发表文章
//================================== function admin_insert(){ global
$conn; if(@$_GET[“innert”] == “add”){ if(@$_POST[“title”] == “” ||
@$_POST[“name”] == “” || @$_POST[“class”] == “” ||
@$_POST[“body”] == “”){ echo “
填写不完整!”; echo “

“; exit(); } else { @$body = $_POST[“body”]; $body = str_replace;
$body = str_replace(“rn”, “
“, $body); @$sql = “Insert into
article(by_title,by_name,by_time,by_count,by_body,by_class)
Values(‘” . $_POST[“title”] . “‘ , ‘” . $_POST[“name”] . “‘ , #”
. date . “# , 0 , ‘” . $body . “‘ , ‘” . $_POST[“class”] . “‘)”;
$conn->Execute; echo “
添加成功!”; echo “

“; } } else { echo “

rn” . “rn” . “

rn”; } } //================================== //后台:文章列表
//================================== 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{ echo “

rn” . “

rn” . “

文章标题

文章分类

文章作者

发表时间

浏览次数

操作

rn” . “

rn”; while{ @$sql = “Select * From List Where by_cid = ” .
$rs->Fields[5]->value; @$crs = $conn->Execute; @$cid =
$crs->Fields[1]->value; echo “

rn” . “

” . $rs->Fields[1]->value .

” . $cid . “

” . $rs->Fields[2]->value . “

” . $rs->Fields[3]->value . “

” . $rs->Fields[4]->value . “

编辑|删除

rn” . “

rn”; $crs->Close; } echo “

rn”; } else { echo “
该分类不存在或暂时没有任何文章!”; } $rs->Close(); //修改文章
if(@$_GET[“list”] == “edit”){ if(@$_GET[“edit”] == “true”){
if(@$_POST[“title”] == “” || @$_POST[“name”] == “” ||
@$_POST[“class”] == “” || @$_POST[“body”] == “”){ echo “
填写不完整!”; echo “

“; exit(); } else { @$body = $_POST[“body”]; $body = str_replace;
$body = str_replace(“rn”, “
“, $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; echo “
修改成功!”; echo “

“; } } else { @$sql = “Select * From Article Where id = ” .
$_GET[“id”]; @$rs = $conn->Execute; echo “

rn” . “rn” . “

rn”; } } //删除文章 if(@$_GET[“list”] == “del”){ @$sql = “Delete
From Article Where id = ” . $_GET[“id”]; $conn->Execute; echo “
删除成功!”; echo “

“; } } //================================== //权限验证
//================================== function admin_session(){
if(@$_SESSION[“ARTICLEADMIN”] != “BY_PHP_ARTICLE”){ echo “
请先登陆!”; echo “

“; exit(); } } //================================== //后台登陆
//================================== function admin_login(){
if(@$_SESSION[“ARTICLEADMIN”] == “BY_PHP_ARTICLE”){ echo “

“; } else{ echo “

rn” . “

rn” . “

管理员登陆

rn” . “

rn” . “

rn” . ” rn” . “

rn” . “

rn”; } } //================================== //登陆验证
//================================== function admin_check(){ if(trim !=
“admin”){ echo “
错误的密码!”; echo “

“; } else { echo “
登陆成功!”; @$_SESSION[“ARTICLEADMIN”] = “BY_PHP_ARTICLE”; echo “

“; } } //================================== //URL参数列表
//================================== function page_load(){ @$classid =
$_GET[“classid”]; if{ if){ echo “
错误的参数!”; return false; } else { article_list; } } @$artid =
$_GET[“artid”]; if{ if{ echo “
错误的参数!”; return false; } else { article_look; } } @$admin =
$_GET[“admin”]; if{ admin_login(); } if{ admin_check(); } if{
admin_session(); echo “
登陆成功!请选择功能菜单进行操作.”; } if{ session_destroy(); echo “
已成功退出!”; echo “

“; } if{ admin_session; } if{ admin_session; } if{ admin_session; }
if($classid == “” && $artid == “” && $admin == “”){ echo “

“; } } ?>

文章分类->=article_menu();?>

=page_load();?>

Close(); ?>

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图