Home >Backend Development >PHP Tutorial >sandisksecureaccess PHP+ACCESS article management program code

sandisksecureaccess PHP+ACCESS article management program code

WBOY
WBOYOriginal
2016-07-29 08:43:051631browse

Copy the code The code is as follows:


session_start();
//============================
//Author: biyuan
//Time :2006.07
//Contact: QQ6010707
//============================
?>

Biyuan Network PHP+ACCESS article management system




//================== =================
//Connect to the database
//========================== =========
@$conn = new com("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("article.mdb"));
//====================================
// Article navigation
//==================================
function article_menu(){
global $conn;
@$sql = "Select * From List";
@$rs = $conn->Execute($sql);
while(!$rs->Eof){
echo "| Fields[2]->value . "">" . $rs->Fields[1]->value . " ";
$rs ->MoveNext();
}
echo "| Backend Managementrn";
$rs->Close();
if(@ $_SESSION["ARTICLEADMIN"] == "BY_PHP_ARTICLE"){
echo "
Administrative Options-> | Category Management | Publish article | Article list | Log out";
}
}
//============================== =====
//Article list: article_list (article category 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 "

rn"
. " rn"
. " rn"
. " rn";
while(!$rs->Eof ){
echo " rn"
. " rn"
. " rn";
$rs->MoveNext();
}
echo "< ;/table>rn";
}
else {
echo "
This category does not exist or there are currently no articles!";
}
$rs->Close();
}
//==================================
//文章详细: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 "
Article TitleArticle Author Published timeNumber of views
Fields[0]->value . "">" . $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"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. " rn"
. "
" . $rs->Fields[1]->value . "
文章作者:" . $rs->Fields[2]->value . " | 发表时间:" . date("Y-m-d H:i:s",$rs->Fields[3]->value) . " | 浏览次数:" . $rs->Fields[4]->value . "
" . $body . "
返 回 】  【 打 印 】  【 关 闭
rn"
. " rn";
}
else {
echo "
该文章不存在或已被管理员删除!";
}
$rs->Close();
}
//==================================
//后台:分类管理
//==================================
function admin_class(){
global $conn;
@$sql = "Select * From List";
@$rs = $conn->Execute($sql);
echo "
rn";
while(!$rs->Eof){
echo "类别:Fields[1]->value . "" name="class_" . $rs->Fields[0]->value . "" /> 编号:Fields[2]->value . "" name="class_cid_" . $rs->Fields[0]->value . "" /> Fields[0]->value . "';submit();" /> Fields[0]->value . "';submit();" />
rn";
$rs->MoveNext();
}
echo "类别: 编号:  rn"
. "
rn";
//增加一个类别
if(@$_GET["class"] == "add"){
if(@$_POST["class_name"] == "" || @$_POST["class_cid"] == ""){
echo "
填写不完整!";
echo "";
exit();
}
else {
@$sql = "Insert into List(by_list,by_cid) Values('" . $_POST["class_name"] . "' , '" . $_POST["class_cid"] . "')";
$conn->Execute($sql);
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($sql);
echo "
修改成功!";
echo "";
}
}
//删除一个类别
if(@$_GET["class"] == "del"){
@$sql = "Delete From List Where id = " . $_GET["id"];
$conn->Execute($sql);
echo "
删除成功!";
echo "";
}
}
//==================================
//后台:发表文章(支持HTML)
//==================================
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);
$body = str_replace("\r\n", "
", $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 "
添加成功!";
echo "";
}
}
else {
echo "
\r\n"
. "
\r\n"
. "文章标题:
\r\n"
. "文章作者:
\r\n"
. "文章类别:
\r\n"
. "文章正文:
\r\n"
. "
 
\r\n"
. "
\r\n"
. "
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($sql);
if(!$rs->Eof){
echo "rn"
. " rn"
. " rn"
. " rn";
while(!$rs->Eof){
@$sql = "Select * From List Where by_cid = " . $rs->Fields[5]->value;
@$crs = $conn->Execute($sql);
@$cid = $crs->Fields[1]->value;
echo " rn"
. " rn"
. " rn";
$crs->Close();
$rs->MoveNext();
}
echo "
文章标题文章分类文章作者发表时间浏览次数操作
Fields[0]->value . "">" . $rs->Fields[1]->value . "" . $cid . "" . $rs->Fields[2]->value . "" . $rs->Fields[3]->value . "" . $rs->Fields[4]->value . "Fields[0]->value . "">编辑 | Fields[0]->value . "">删除
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);
$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($sql);
echo "
修改成功!";
echo "";
}
}
else {
@$sql = "Select * From Article Where id = " . $_GET["id"];
@$rs = $conn->Execute($sql);
echo "
rn"
. "
fields[0]->value . "" method="post">rn"
. "文章标题:fields[1]->value . "" />
rn"
. "文章作者:fields[2]->value . "" />
rn"
. "浏览次数:fields[4]->value . "" />
rn"
. "文章类别:
\r\n"
. "\r\n"
. "文章正文:
\r\n"
. "
 
\r\n"
. "
\r\n"
. "
\r\n";
}
}
//删除文章
if(@$_GET["list"] == "del"){
@$sql = "Delete From Article Where id = " . $_GET["id"];
$conn->Execute($sql);
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 "\r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. "
管理员登陆
\r\n";
}
}
//==================================
//登陆验证
//==================================
function admin_check(){
if(trim($_POST["adminPass"]) != "admin"){
echo "
错误的密码!";
echo "";
}
else {
echo "
登陆成功!";
@$_SESSION["ARTICLEADMIN"] = "BY_PHP_ARTICLE";
echo "";
}
}
//==================================
//URL参数列表
//==================================
function page_load(){
@$classid = $_GET["classid"];
if($classid != ""){
if(!is_numeric($classid)){
echo "
错误的参数!";
return false;
}
else {
article_list($classid);
}
}
@$artid = $_GET["artid"];
if($artid != ""){
if(!is_numeric($artid)){
echo "
错误的参数!";
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 "
登陆成功!请选择功能菜单进行操作.";
}
if($admin == "logout"){
session_destroy();
echo "
已成功退出!";
echo "";
}
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 "";
}
}
?>




文章分类-> 


$conn->Close();
?>


The above introduces the sandisksecureaccess PHP+ACCESS article management program code, including the content of sandisksecureaccess. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn