Php+access Simple and Practical article Management program code

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags access code content echo function html http list

<?php Tutorial


session_start ();


?>


<html>


<head>


<title> Construction Station Teaching Network PHP tutorial webpage article management system </title>


<meta http-equiv= "Content-type content=" 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" > Background management </a>rn;


$rs->close ();


if (@$_session["articleadmin"] = = "By_php_article") {


echo "<br/> Admin Option-> | <a href= "Admin=class" > Classified 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 aspires 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 ">rn"


. "<tr bgcolor=" #f3f3f3 "align=" center ">rn"


. "<td> article title </td><td> article author </td><td> published time </td><td> browse times </td>rn"


. "</tr>rn";


while (! $rs->eof) {


echo "<tr bgcolor=" #ffffff ">rn"


. "<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>rn"


. "</tr>rn";


$rs->movenext ();


}


echo "</table>rn";


}


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 aspires where id =". $STR;


@ $rs = $conn->execute ($sql);


@ $usql = "Update aspires 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 ">rn"


. "<tr bgcolor=" #f3f3f3 "align=" center ">rn"


. "<td style=" Font-size:14px;font-weight:bold ">". $rs->fields[1]->value. "</td>rn"


. "</tr>rn"


. "<tr bgcolor=" #f3f3f3 "align=" center ">rn"


. "<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>rn"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.