コードをコピーします コードは次のとおりです: session_start(); //========================== //作者: biyuan / /時間:2006.07 //連絡先:QQ6010707 //=========================== ?> Biyuan Network PHP+ACCESS 記事管理システム <br>マージン:0px; <br>フォントサイズ:12px; <br>フォントサイズ:12px; :4px ; <br>フォントファミリー:verdana <br>} <br>A:リンク、<br>A:訪問済み、<br>テキスト装飾: なし <br>} <br>カラー: # ff5a00; テキスト装飾: <br>} <br></head> <br><?php <BR>//======== === ================= <BR>//データベースに接続します<BR>//==================== ====== ========= <BR>@$conn = 新しい com("ADODB.Connection") <BR>$conn->Open("DRIVER={Microsoft Access ドライバー (*.mdb) DBQ=" .realpath("article.mdb")); <br>//============================== ===== <br>// 記事ナビゲーション<br>//================================== <br>関数article_menu (){ <br>global $conn; <br>@$sql = "リストから * を選択"; <br>@$rs = $conn->Execute($sql){ <br>echo "| <a href=" ?classid=" . $rs->Fields[2]->value . "">" . /a> "; <br>$rs ->MoveNext(); <br>} <br>echo "| <a href="?admin=login">バックエンド管理</a>rn"; <br>$rs->閉じる(); <br>if(@ $_SESSION["ARTICLEADMIN"] == "BY_PHP_ARTICLE"){ <br>echo "<br />管理オプション-> | <a href="?admin=class">カテゴリ管理</a>a href="?admin=insert">記事リスト</a> ="?admin =logout">ログアウト</a>"; <br>} <br>} <br>//========================== ==== ===== <br>//記事リスト:article_list (記事カテゴリID) <br>//========================== ====== ==== <br>functionarticle_list($str){ <br>global $conn; <br>@$sql = "記事から id、by_title、by_time、by_count を選択します。 ID による順序の説明"; <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->Fields[0]- >値 . ""> . $rs->フィールド[1]->値 . "</a></td><td>" . $rs->フィールド[2] ->値 . "</td><td>" .date("Y-m-d H:i:s",$rs->フィールド[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->Close() ; <br>}<br>//================================== <br>//文章详细:article_look(文章ID) <br>/ /================================== <br>関数article_look($str){ <br>グローバル$conn; <br>@$sql = "ID = "の記事から * を選択します。 $str; <br>@$rs = $conn->Execute($sql); <br>@$usql= "記事セットを更新 by_count = (by_count + 1) Where id = " . $str; <br>$conn->実行($usql); <br>if(!$rs->Eof){ <br>@$body = $rs->フィールド[5]->値; <br>$body = str_replace("[url=file://%22,%22%22,$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->Fields[2]->value 。 " | 発行表時間:" . 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>" 。 $body . 「</td>rn」<br>。 「</tr>rn」<br>。 " <tr bgcolor="#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 language="JavaScript">document.title += "--" . $rs->Fields[1]->value . "";</script>rn"; <br>} <br>else { <br>echo "<br />该文章不存在またはすでに被管理员删除!"; <br>} <br>$rs->Close(); <br>} <br>//================================== <br>//後台:分类管理 <br>//= ================================= <br>function admin_class(){ <br>global $conn; <br>@$sql = "リストから * を選択"; <br>@$rs = $conn->Execute($sql); <br>echo "<form action="" method="post" name="frm">rn"; <br>while(!$rs->Eof){ <br>echo "类别:<input type="text" value="" . $rs->Fields[1]->value . "" name="class_ " . $rs->Fields[0]->value . "" /> 编号:<input type="text" value="" . $rs->Fields[2]->value . "" name="class_cid_" . $rs->Fields[0]->value . "" /> <input type="button" value="修正" . ->value . "';submit();" /> <input type="button" value="删除" . "';submit() ;" /><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"] == "add"){ <br>if(@$_POST["class_name"] == "" || @$_POST["class_cid"] = = ""){ <br>echo "<br />充填写不完整!"; <br>echo "<script language="JavaScript">setTimeout("history.back();", 2000);</script>"; <br>終了(); <br>} <br>else { <br>@$sql = "List(by_list,by_cid) Values('" . $_POST["class_name"] . "' , '" . $_POST["class_cid"] . "')" に挿入します。 ; <br>$conn->実行($sql); <br>echo "<br />追加成功!"; <br>echo "<script language="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 language="JavaScript">setTimeout("history.back();", 2000);</script>"; <br>終了(); <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 language="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 順に記事の順序から ID、タイトル、名前、時間、カウント、クラスを選択します。"; ;Eof){ <br>echo "<table border="0" cellpacing="1" cellpadding="0" bgcolor="#cccccc">rn" <br>. " <tr bgcolor="#F3F3F3" align="センター">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]->値; <br>エコー " <tr bgcolor="#FFFFFF">rn" <br>. $rs->Fields[0]->value 。 "">" . $rs->Fields[1]->value . "</p> <td>" . $cid . "</td> <td> " . $rs->Fields[2]->value . "</td>gt;</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>rn" <br>." </tr>rn"; <BR>$crs->Close(); <br>$rs->MoveNext(); <br>} <br>echo "</table>rn"; <BR>} <BR>else { <BR>echo "<br />该分类不存在または暂時没!" <BR>$rs->Close(); //修正文章 <br>if(@$_GET["list"] == "edit"){ <br>if(@$_GET["edit"] == "true"){ <br>if(@$_POST["title" ] == "" || @$_POST["名前"] == " || @$_POST["クラス"] == "" || @$_POST["本体"] == ""){ echo "<br />充填写不完整!"; <br>echo "<script language="JavaScript">setTimeout("history.back();", 2000);</script>"; (); <br>} <br>else { <br>@$body = $_POST["body"] <br>$body = str_replace("'", "''", $body); "<br />", $body); <br>@$sql = "記事を更新 by_title = '" . $_POST["title"] "' , by_name = '" . . "' 、 by_count = " . " 、 by_body = '" 、 $_POST["class" ] 。 _GET["id"]; <br>$conn->Execute($sql); <br>echo "<br />修正成功!" <br>echo "<script language="JavaScript">setTimeout("window .location.href='?admin=list';", 2000);"; <br>} <br>} <br>else { <br>@$sql = "ID = " の記事から * を選択します。 $_GET["id"]; <br>@$rs = $conn->Execute($sql); <br>エコー「<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></html> <br> 上記は、sandisksecureaccess の内容を含む、PHP+ACCESS 記事管理プログラムのコードを紹介しています。PHP チュートリアルに興味のある友人に役立つことを願っています。 <br> <br> <br> </td>