<?php教程
session_start();
//==========================
//作者:biyuan
//时间:2006.07
//联系:qq6010707
//==========================
?>
<html>
<head>
<title>碧原网络php教程+access文章管理系统</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<style type="text/css教程">
body {
margin:0px;
text-align:center;
font-size:12px;
font-family:verdana;
}
td {
font-size:12px;
height:28px;
padding:4px;
font-family:verdana;
}
a:link,
a:visited,
a:active {
color: #005a17; text-decoration: none;
}
a:hover {
color: #ff5a00; text-decoration: underline;
}
</style>
</head>
<body>
<?php
//==================================
//连接数据库教程
//==================================
@$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 "| <a href="?classid=" . $rs->fields[2]->value . "">" . $rs->fields[1]->value . "</a> ";
$rs->movenext();
}
echo "| <a href="?admin=login">后台管理</a> ";
$rs->close();
if(@$_session["articleadmin"] == "by_php_article"){
echo "<br />管理选项-> | <a href="?admin=class">分类管理</a> | <a href="?admin=insert">发表文章</a> | <a href="?admin=list">文章列表</a> | <a href="?admin=logout">退出登陆</a>";
}
}
//==================================
//文章列表: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 "<table border="0" cellspacing="1" cellpadding="0" bgcolor="#cccccc"> "
. " <tr bgcolor="#f3f3f3" align="center"> "
. " <td>文章标题</td><td>文章作者</td><td>发表时间</td><td>浏览次数</td> "
. " </tr> ";
while(!$rs->eof){
echo " <tr bgcolor="#ffffff"> "
. " <td><a href="?artid=" . $rs->fields[0]->value . "">" . $rs->fields[1]->value . "</a></td><td>" . $rs->fields[2]->value . "</td><td>" . date("y-m-d h:i:s",$rs->fields[3]->value) . "</td><td>" . $rs->fields[4]->value . "</td> "
. " </tr> ";
$rs->movenext();
}
echo "</table> ";
}
else {
echo "<br />该分类不存在或暂时没有任何文章!";
}
$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 "<table border="0" width="60%" cellspacing="1" cellpadding="0" bgcolor="#cccccc"> "
. " <tr bgcolor="#f3f3f3" align="center"> "
. " <td style="font-size:14px;font-weight:bold">" . $rs->fields[1]->value . "</td> "
. " </tr> "
. " <tr bgcolor="#f3f3f3" align="center"> "
. " <td>文章作者:" . $rs->fields[2]->value . " | 发表时间:" . date("y-m-d h:i:s",$rs->fields[3]->value) . " | 浏览次数:" . $rs->fields[4]->value . "</td> "
. " </tr> "
. " <tr bgcolor="#ffffff"> "
. " <td>" . $body . "</td> "
. " </tr> "
. " <tr bgcolor="#f3f3f3"> "
. " <td align="right">【 <a href="javascript教程:history.back();">返 回</a> 】 【 <a href="javascript教程:print();">打 印</a> 】 【 <a href="javascript:close();">关 闭</a> 】</td> "
. " </tr> "
. " </table> "
. " <script language="javascript">document.title += "--" . $rs->fields[1]->value . "";</script> ";
}
else {
echo "<br />该文章不存在或已被管理员删除!";
}
$rs->close();
}
首页 1 2 3 4 5 6 7 末页