Ec (2); & lt ;? Php tutorial session_start (); Author: biyuan time: 2006.07 contact: qq6010707? & Gt; & lt; html & gt; & lt; head & gt; & lt; title & gt; Biyuan network php teaches script ec (2); script
Session_start ();
// ==================================
// Author: biyuan
// Time: 2006.07
// Contact: qq6010707
// ==================================
?>
Biyuan network php tutorial + access Document Management System
// ==========================================
// Database connection 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 "| fields [2]-> value." ">". $ rs-> fields [1]-> value ."";
$ Rs-> movenext ();
}
Echo "| background management ";
$ Rs-> close ();
If (@ $ _ session ["articleadmin"] = "by_php_article "){
Echo"
Manage options-> | Category Management | post | article list | log out ";
}
}
// ==========================================
// Article list: article_list (document 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"
"."
"."
Article Title |
Author |
Posting time |
Browsing times | "."
";While (! $ Rs-> eof ){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 ." | "."
";$ Rs-> movenext ();}Echo"
";
}
Else {
Echo"
This category does not exist or there are no articles for the time being! ";
}
$ Rs-> close ();
}
// ==========================================
// Article details: 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"
"."
"."
". $ Rs-> fields [1]-> value ." | "."
"."
"."
Author :". $ rs-> fields [2]-> value. "| posting time :". date ("y-m-d h: I: s", $ rs-> fields [3]-> value ). "| browsing times :". $ rs-> fields [4]-> value." | "."
"."
"."
". $ Body ." | "."
"."
"."
[Back] [print] [close] | "."
"."
"
."