>백엔드 개발 >PHP 튜토리얼 >sandisksecureaccess PHP ACCESS 기사 관리 프로그램 코드

sandisksecureaccess PHP ACCESS 기사 관리 프로그램 코드

WBOY
WBOY원래의
2016-07-29 08:43:051627검색

코드 복사 코드는 다음과 같습니다.


session_start()
//========================
//저자 : 비위안
//시간 : 2006.07
//연락처 : QQ6010707
//====================== = ===
?>

비위안 네트워크 PHP ACCESS 기사 관리 시스템<br><meta http equiv="content-type" c><style type="text/css"> <br>body { <br>margin:0px <br> 글꼴 크기:12px; <br>글꼴-가족:verdana; 글꼴 계열:verdana <br>} <br>A:link, <br>A:visited, <br>A:active { <br>color: #005a17; 텍스트 장식: 없음 <br>} <br>A:hover { <br>색상: #ff5a00; 텍스트 장식: 밑줄 <br>} <br></style> <br><body> <?php <BR>//=================================== <BR>// 데이터베이스 연결 <BR>//================================= <BR>@$conn = new com ( "ADODB.Connection"); <BR>$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .realpath("article.mdb") <br>/ / ================================== <br>//기사 탐색<br>//=== = ============================ <br>function article_menu(){ <br>global $conn <br>@ $ sql = "목록에서 * 선택"; <br>@$rs = $conn->Execute($sql) <br>while(!$rs->Eof){ <br>echo "| < a href="?classid=" . $rs->필드[2]->값 . "">" . $rs->필드[1]->값 . "</a> ; <br>$rs->MoveNext(); <br>} <br>echo "| <a href="?admin=login">백엔드 관리</a>rn"; ->Close(); <br>if(@$_SESSION["ARTICLEADMIN"] == "BY_PHP_ARTICLE"){ <br>echo "<br />관리 옵션-> | <a href=" ?admin=class">카테고리 관리</a> | <a href="?admin=insert">기사 게시</a> | <a href="?admin=list">기사 목록< /a> <a href="?admin=logout">로그아웃</a>"; <br>} <br>} <br>//======= ===== ===================== <br>//기사 목록: 기사_목록(기사 카테고리 ID) <br>//===== ===== ======================= <br>function article_list($str){ <br>global $conn <br>@ $sql = "선택 id,by_title,by_name,by_time,by_count 기사에서 by_class = " . $str . " Order By id desc"; <br>@$rs = $conn->Execute($sql); <br>if(! $rs->Eof){ <br>echo "<table border="0" cellpacing="1" cellpadding="0" bgcolor="#cccccc">rn" <br> " <tr bgcolor. ="#F3F3F3" align="center">rn" <br>. " <td>기사 제목</td><td>기사 작성자</td><td> 게시 시간</td> ;td>조회수</td>rn" <br>. " </tr>rn"; <br>while(!$rs->Eof){ <br> echo " <tr bgcolor=" #FFFFFF">rn" <br>. " <td><a href="?artid=" . $rs->필드[0]->값 . " ">" >필드[1]->값 . "</a></td>" . $rs->필드[2]->값 . td>" . date("Y-m-d H:i:s",$rs->Fields[3]->value) . "</td><td>" . $rs->Fields[4 ]->value . "</td>rn" <br>. " </tr>rn" <br>$rs->MoveNext() <br> } <br>echo "< /table>rn"; <br>} <br>else { <br>echo "<br />이 카테고리가 존재하지 않거나 현재 기사가 없습니다!"; <br>} <br>$rs- >닫기() <br>}<br>//=================================== <br>//文章详细:article_look(文章) ID) <br>//======================================== <br>함수 기사_룩($str) { <br>글로벌 $conn; <br>@$sql = "ID = "인 기사에서 *를 선택하세요. $str; <br>@$rs = $conn->Execute($sql); <br>@$usql= "기사 세트 업데이트 by_count = (by_count 1) 여기서 id = " . $str; <br>$conn->실행($usql); <br>if(!$rs->Eof){ <br>@$body = $rs->Fields[5]->value; <br>$body = str_replace("[url=file://","",$body/]\","",$body[/url]); <br>echo "<table border=" 0" width="60%" cellpacing="1" cellpadding="0" bgcolor="#cccccc">rn" <br>. " <tr bgcolor="#F3F3F3" align="center">rn " <br>. " <td style="font-size:14px;font-weight:bold">" . $rs->Fields[1]->value . "</td>rn" <br>. " </tr>rn" <br>. " <tr bgcolor="#F3F3F3" align="center">rn" <br> " <td>文章작자:" . rs->필드[2]->값 " | 发表时间:" . date("Y-m-d H:i:s",$rs->Fields[3]->value) . " | 浏览次数:" . $rs->Fields[4]->value . "</td>rn" <br>. " </tr>rn" <br>. " <tr bgcolor=" #FFFFFF">rn" <br>. " <td>" . "</td>rn" <br>. ="#F3F3F3">rn" <br>. " <td align="right">【 <a href="javascript:history.back();">返 回</a> 】  【 <a href="javascript:print();">打 印</a> 】  【 <a href="javascript:close();">关 闭</a> 】</td>rn" <br>. " </tr>rn" <br>. " </table>rn" <br>. " <script 언어="JavaScript">document.title = "--" . $rs->필드[1]->값 . "";</script>rn"; <br>} <br>else { <br>echo "<br />该文章不存在或已被管理员删除!"; <br>} <br>$rs->닫기() <br>} <br>//============================ === <br>//后台:분류类管리 <br>//================================ = <br>function admin_class(){ <br>global $conn; <br>@$sql = "목록에서 * 선택" <br>@$rs = $conn->Execute($sql); >echo "<form action="" method="post" name="frm">rn"; <br>while(!$rs->Eof){ <br>echo "类别:<입력 유형 ="텍스트" 값="" . $rs->필드[1]->값 . "" 이름="클래스_" . $rs->필드[0]->값 . "" /> 오류:<input type="text" value="" . $rs->필드[2]->값 . "" name="class_cid_" . $rs->필드[0]->값 . "" /> <input type="button" value="修改" . $rs->필드[0]->값 . "';제출하다();" /> <input type="button" value="删除" . $rs->필드[0]->값 . "';제출하다();" /><br />rn"; <br>$rs->MoveNext(); <br>} <br>echo "类别:<input type="text" name="class_name" /> ; 유형:<input type="text" name="class_cid" /> <input type="button" value="增加" /> <input type="button" value="闲置" 비활성화 />rn" <br>. "</form>rn"; <br>//增加一个类别 <br>if(@$_GET[" class"] == "추가"){ <br>if(@$_POST["class_name"] == "" || @$_POST["class_cid"] == ""){ <br>echo "< br />填写不完整!"; <br>echo "<script 언어="JavaScript">setTimeout("history.back();", 2000);</script>"; <br>exit (); <br>} <br>else { <br>@$sql = "List(by_list,by_cid) 값에 삽입('" . $_POST["class_name"] . "' , '" . $_POST[ "class_cid"] . "')"; <br>$conn->Execute($sql) <br>echo "<br />添加成功!" <br>echo "<스크립트 언어= "JavaScript">setTimeout("window.location.href='?admin=class';", 2000);</script>"; <br>} <br>} <br>//修改一个类别 <br>if(@$_GET["class"] == "edit"){ <br>if(@$_POST["class_" . $_GET["id"]] == "" || @$_POST[ "class_cid_" . $_GET["id"]] == ""){ <br>echo "<br />填写不完整!" <br>echo "<script 언어="JavaScript"> setTimeout("history.back();", 2000);</script>"; <br>exit(); <br>} <br>else { <br>@$sql = "목록 세트 업데이트 by_list = '" . $_POST["class_" . $_GET["id"]] . "' , by_cid = '" . $_POST["class_cid_" . $_GET["id"]] . "' ID = "인 경우. $_GET["ID"]; <br>$conn->실행($sql); <br>echo "<br />修改成功!"; <br>echo "<script 언어="JavaScript">setTimeout("window.location.href='?admin=class';", 2000);</script>"; <br>} <br>} <br>//删除一个类别 <br>if(@$_GET["class"] == "del"){ <br>@$sql = "Delete From List Where id = " . $_GET["id"]; <br>$conn->Execute($sql); <br>echo "<br />删除成功!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"window.location.href='?admin=class';\", 100);</script>"; <br>} <br>} <br>//================================== <br>//后台:发表文章(支持HTML) <br>//================================== <br>function admin_insert(){ <br>global $conn; <br>if(@$_GET["innert"] == "add"){ <br>if(@$_POST["title"] == "" || @$_POST["name"] == "" || @$_POST["class"] == "" || @$_POST["body"] == ""){ <br>echo "<br />填写不完整!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"history.back();\", 2000);</script>"; <br>exit(); <br>} <br>else { <br>@$body = $_POST["body"]; <br>$body = str_replace("'", "''", $body); <br>$body = str_replace("\r\n", "<br />", $body); <br>@$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"] . "')"; <br>$conn->Execute($sql); <br>echo "<br />添加成功!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"window.location.href='?admin=insert';\", 2000);</script>"; <br>} <br>} <br>else { <br>echo "<div style=\"width:590px;text-align:left\">\r\n" <br>. "<form action=\"?admin=insert&innert=add\" method=\"post\">\r\n" <br>. "文章标题:<input type=\"text\" name=\"title\" /><br />\r\n" <br>. "文章作者:<input type=\"text\" name=\"name\" /><br />\r\n" <br>. "文章类别:<select name=\"class\">\r\n"; <br>@$sql = "Select * From List"; <br>@$rs = $conn->Execute($sql); <br>while(!$rs->Eof){ <br>echo "<option value=\"" . $rs->Fields[2]->value . "\">" . $rs->Fields[1]->value . "</option>\r\n"; <br>$rs->MoveNext(); <br>} <br>echo "</select><br />\r\n" <br>. "文章正文:<textarea cols=\"70\" rows=\"14\" name=\"body\"></textarea><br />\r\n" <br>. "<center><input type=\"submit\" value=\"提交\" /> <input type=\"reset\" value=\"重置\" /></center>\r\n" <br>. "</form>\r\n" <br>. "</div>rn"; <br>} <br>} <br>//================================ = = <br>//백엔드: 기사 목록<br>//================================== == <br>function admin_list(){ <br>global $conn; <br>@$sql = "기사 순서 기준 id desc에서 id,by_title,by_name,by_time,by_count,by_class 선택"; rs = $ conn->Execute($sql); <br>if(!$rs->Eof){ <br>echo "<table border="0" cellpadding="1" cellpadding="0" bgcolor=" #cccccc">rn" <br>. " <tr bgcolor="#F3F3F3" align="center">rn" <br>. " <td>기사 제목</td>< td> 기사 카테고리<td>기사 작성자</td> <td>게시 시간</td> <td>조회수</td> <td>작업</td>rn" <br> . </tr>rn"; <br>while(!$rs->Eof){ <br>@$sql = "Select * From List Where by_cid = " . $rs->Fields[5] -> ;value <br>@$crs = $conn->Execute($sql) <br>@$cid = $crs->Fields[1]->value <br>echo " < ;tr bgcolor="#FFFFFF">rn" <br>. " <td><a href="?artid=" . $rs->Fields[0]->value "". $rs->필드[1]->값 . "</td><td>" . ;필드[2]->값 . "</td><td .>필드[3]->값 . ->필드[4]->값 . "</td><td><a href="?admin=list&list=edit&id=" . $rs->필드[0]-> ;값 . "">수정</a> | <a href="?admin=list&list=del> ;/td>rn" <br>. " </tr>rn"; <br>$crs->Close(); <br>$rs->MoveNext(); <br> } <br> echo "</table>rn"; <br>} <br>else { <br>echo "<br />이 카테고리가 없거나 현재 기사가 없습니다!"; >$rs->Close(); <br>//기사 수정<br>if(@$_GET["list"] == "edit"){ <br>if(@$_GET["edit "] == "참"){ <br>if(@$_POST["title"] == "" || @$_POST["name"] == "" || @$_POST["class"] == "" || @$_POST["body"] == ""){ <br>echo "<br />미완료!" <br>echo "<script 언어="JavaScript" >setTimeout( "history.back();", 2000);</script>"; <br>exit(); <br>} <br>else { <br>@$body = $_POST[" body"]; <br>$body = str_replace("'", "''", $body) <br>$body = str_replace("rn", "<br />", $body) <br>@ $sql = "기사 세트 by_title = '" . "' , by_name = '" . "' , by_count = " . . " , by_body = '" . $body . "' , by_class = '" . $_POST["class"] . <br>$ conn-> Execute($sql); <br>echo "<br />수정 성공!" <br>echo "<script 언어="JavaScript">setTimeout("window.location.href= '?admin= list';", 2000);</script>"; <br>} <br>} <br>else { <br>@$sql = "* From Article Where id = " $ _GET["id "]; <br>@$rs = $conn->Execute($sql); <br>echo "<div style="width:590px;text-align:left">rn" <br>. "<form action="?admin=list&list=edit&edit=true&id=" . $rs->fields[0]->value . "" method="post">rn" <br> "기사 제목. :<input type="text" name="title" value="" . $rs->fields[1]->value . "" /><br />rn" <br>. "기사 작성자:<input type="text" name="name" value="" . $rs->fields[2]->value . "" /><br /> ;rn" <BR>. "조회수:<input type="text" name="count" value="" . $rs->fields[4]->value . "" />< br /> ;rn" <BR>. "기사 카테고리: <select name="class" id="class">rn"; <br>@$sql = "목록에서 * 선택"; <br>@ $crs = $conn->Execute($sql); <br>while(!$crs->Eof){ <br>echo "<option value="" . $crs->Fields[2] -> value . "">" . $crs->Fields[1]->value . "</option>rn"; <br>$crs->MoveNext(); <br>} <br>$crs->close(); <br>@$body = $rs->Fields[5]->value; <br>$body = str_replace("<br />","\r\n",$body); <br>echo "</select><br />\r\n" <br>. "<script language=\"JavaScript\">\r\n" <br>. "document.getElementById(\"class\").selectedIndex = " . $rs->fields[6]->value . " - 1;\r\n" <br>. "</script>\r\n" <br>. "文章正文:<textarea cols=\"70\" rows=\"14\" name=\"body\">" . $body . "</textarea><br />\r\n" <br>. "<center><input type=\"submit\" value=\"提交\" /> <input type=\"reset\" value=\"重置\" /></center>\r\n" <br>. "</form>\r\n" <br>. "</div>\r\n"; <br>} <br>} <br>//删除文章 <br>if(@$_GET["list"] == "del"){ <br>@$sql = "Delete From Article Where id = " . $_GET["id"]; <br>$conn->Execute($sql); <br>echo "<br />删除成功!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"window.location.href='?admin=list';\", 100);</script>"; <br>} <br>} <br>//================================== <br>//权限验证 <br>//================================== <br>function admin_session(){ <br>if(@$_SESSION["ARTICLEADMIN"] != "BY_PHP_ARTICLE"){ <br>echo "<br />请先登陆!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"window.location.href='?admin=login';\", 2000);</script>"; <br>exit(); <br>} <br>} <br>//================================== <br>//后台登陆 <br>//================================== <br>function admin_login(){ <br>if(@$_SESSION["ARTICLEADMIN"] == "BY_PHP_ARTICLE"){ <br>echo "<script language=\"JavaScript\">window.location.href='?admin=admin';</script>"; <br>} <br>else{ <br>echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#cccccc\">\r\n" <br>. " <tr bgcolor=\"#F3F3F3\" align=\"center\">\r\n" <br>. " <td><strong>管理员登陆</strong></td>\r\n" <br>. " </tr>\r\n" <br>. " <tr bgcolor=\"#FFFFFF\">\r\n" <br>. " <form method=\"post\" action=\"?admin=check\">\r\n" <br>. " <td><input type=\"password\" name=\"adminPass\" /><input type=\"submit\" value=\"确定\" /></td>\r\n" <br>. " </form>\r\n" <br>. " </tr>\r\n" <br>. "</table>\r\n"; <br>} <br>} <br>//================================== <br>//登陆验证 <br>//================================== <br>function admin_check(){ <br>if(trim($_POST["adminPass"]) != "admin"){ <br>echo "<br />错误的密码!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"history.back();\", 2000);</script>"; <br>} <br>else { <br>echo "<br />登陆成功!"; <br>@$_SESSION["ARTICLEADMIN"] = "BY_PHP_ARTICLE"; <br>echo "<script language=\"JavaScript\">setTimeout(\"window.location.href='?admin=admin';\", 2000);</script>"; <br>} <br>} <br>//================================== <br>//URL参数列表 <br>//================================== <br>function page_load(){ <br>@$classid = $_GET["classid"]; <br>if($classid != ""){ <br>if(!is_numeric($classid)){ <br>echo "<br />错误的参数!"; <br>return false; <br>} <br>else { <br>article_list($classid); <br>} <br>} <br>@$artid = $_GET["artid"]; <br>if($artid != ""){ <br>if(!is_numeric($artid)){ <br>echo "<br />错误的参数!"; <br>return false; <br>} <br>else { <br>article_look($artid); <br>} <br>} <br>@$admin = $_GET["admin"]; <br>if($admin == "login"){ <br>admin_login(); <br>} <br>if($admin == "check"){ <br>admin_check(); <br>} <br>if($admin == "admin"){ <br>admin_session(); <br>echo "<br />登陆成功!请选择功能菜单进行操作."; <br>} <br>if($admin == "logout"){ <br>session_destroy(); <br>echo "<br />已成功退出!"; <br>echo "<script language=\"JavaScript\">setTimeout(\"window.location.href='?admin=login';\", 2000);</script>"; <br>} <br>if($admin == "class"){ <br>admin_session(); <br>admin_class(); <br>} <br>if($admin == "insert"){ <br>admin_session(); <br>admin_insert(); <br>} <br>if($admin == "list"){ <br>admin_session(); <br>admin_list(); <br>} <br>if($classid == "" && $artid == "" && $admin == ""){ <br>echo "<script language=\"JavaScript\">window.location.href='?classid=1';</script>"; <br>} <br>} <br>?> <br><div> <br><br /><br /><br />文章分类-> <?=article_menu();?> <br></div> <br><?=page_load();?> <br><?php <BR>$conn->Close() <br></body> ></html> <br><br> <br> 이상은 sandisksecureaccess의 내용을 포함하여 sandisksecureaccess PHP ACCESS 기사 관리 프로그램 코드를 소개하고 있으며, PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되기를 바랍니다. <p> </p> </td>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.