<?php Tutorial
session_start ();
//==========================
//Author: Biyuan
//Time: 2006.07
//Contact: qq6010707
//==========================
?>
<html>
<head>
<title> bi-Original network PHP tutorial +access article management system </title>
<meta http-equiv= "Content-type" content= "text/html"; charset=gb2312 "/>
<style type= "text/css Tutorial" >
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
//==================================
//Connection Database tutorial
//==================================
@ $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 "| <a href= "? classid=". $rs->fields[2]->value. ">". $rs->fields[1]->value. "</a>";
$rs->movenext ();
}
echo "| <a href= "? admin=login" > Admin </a> ";
$rs->close ();
if (@$_session["articleadmin"] = = "By_php_article") {
echo "<br/> Admin Option-> | <a href= "? Admin=class" > Classification Management </a> | <a href= "? Admin=insert" > Published articles </a> | <a href= "? admin=list" > Articles List </a> | <a href= "? admin=logout" > Exit login </a> ";
}
}
//==================================
//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 "<table border=" 0 "cellspacing=" 1 "cellpadding=" 0 "bgcolor=" #cccccc ">"
. "<tr bgcolor=" #f3f3f3 "align=" center ">"
. "<td> article title </td><td> article author </td><td> published time </td><td> browse times </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/> The category does not exist or temporarily does not have any articles!";
}
$rs->close ();
}
//==================================
//Article Detail: Article_look (article 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> article Author:". $rs->fields[2]->value. " | Publication time: ". Date ("Y-m-d h:i:s", $rs->fields[3]->value). " | Browse Number: ". $rs->fields[4]->value. "</td>"
. "</tr>"
. "<tr bgcolor=" #ffffff ">"
. "<td>". $body. "</td>"
. "</tr>"
. "<tr bgcolor=" #f3f3f3 ">"
. "<td align=" right > "<a href=" JavaScript Tutorial: History.back (); " > Back </a> "<a href=" JavaScript Tutorial: Print (); " > Printing </a> "<a href=" javascript:close (); > Close </a> "</td>"
. "</tr>"
. "</table>"
. "<script language=" javascript ">document.title + +"-". $rs->fields[1]->value. "";</script> ";
}
else {
echo "<br/> The article does not exist or has been deleted by the administrator!";
}
$rs->close ();
}