Heim > Backend-Entwicklung > PHP-Tutorial > sandisksecureaccess PHP+ACCESS 文章管理程序代码

sandisksecureaccess PHP+ACCESS 文章管理程序代码

WBOY
Freigeben: 2016-07-29 08:43:05
Original
1529 Leute haben es durchsucht

复制代码 代码如下:


session_start();
//==========================
//作者:biyuan
//时间:2006.07
//联系:QQ6010707
//==========================
?>


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




//==================================
//连接数据库
//==================================
@$conn = new com("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("article.mdb"));
//==================================
//文章导航
//==================================
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 "| 后台管理\r\n";
$rs->Close();
if(@$_SESSION["ARTICLEADMIN"] == "BY_PHP_ARTICLE"){
echo "
管理选项-> | 分类管理 | 发表文章 | 文章列表 | 退出登陆";
}
}
//==================================
//文章列表: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 "\r\n"
. " \r\n"
. " \r\n"
. " \r\n";
while(!$rs->Eof){
echo " \r\n"
. " \r\n"
. " \r\n";
$rs->MoveNext();
}
echo "
文章标题 文章作者 发表时间 浏览次数
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 . "
\r\n";
}
else {
echo "
该分类不存在或暂时没有任何文章!";
}
$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 "\r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. " \r\n"
. "
" . $rs->Fields[1]->value . "
文章作者:" . $rs->Fields[2]->value . " | 发表时间:" . date("Y-m-d H:i:s",$rs->Fields[3]->value) . " | 浏览次数:" . $rs->Fields[4]->value . "
" . $body . "
返 回 】  【 打 印 】  【 关 闭
\r\n"
. " \r\n";
}
else {
echo "
该文章不存在或已被管理员删除!";
}
$rs->Close();
}
//==================================
//后台:分类管理
//==================================
function admin_class(){
global $conn;
@$sql = "Select * From List";
@$rs = $conn->Execute($sql);
echo "
\r\n";
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();\" />
\r\n";
$rs->MoveNext();
}
echo "类别: 编号:  \r\n"
. "
\r\n";
//增加一个类别
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"
. "
\r\n";
}
}
//==================================
//后台:文章列表
//==================================
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 "\r\n"
. " \r\n"
. " \r\n"
. " \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 " \r\n"
. " \r\n"
. " \r\n";
$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 . "\">删除
\r\n";
}
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("\r\n", "
", $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 "
\r\n"
. "
fields[0]->value . "\" method=\"post\">\r\n"
. "文章标题:fields[1]->value . "\" />
\r\n"
. "文章作者:fields[2]->value . "\" />
\r\n"
. "浏览次数:fields[4]->value . "\" />
\r\n"
. "文章类别:
\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 "";
}
}
?>




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

=page_load();?>
$conn->Close();
?>


以上就介绍了sandisksecureaccess PHP+ACCESS 文章管理程序代码,包括了sandisksecureaccess方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage