PHP Access Message Board Program _php Tutorial

Source: Internet
Author: User
Tags mysql tutorial php and mysql setcookie access database
PHP Access Message Board program is not a PHP and MySQL message board program, but a simple and practical PHP Access message board program Oh, using the ADODB to connect to the Access database Oh.

PHP Tutorial Access Message Board Program
This is not the PHP and MySQL tutorial message board program, but a simple and practical PHP Access message board program Oh, using the ADODB to connect to the Access database tutorial Oh.
*/

error_reporting (0);
$conn = new COM ("Adodb.connection");
$conn->open ("Driver={microsoft Access Driver (*.mdb)}; Dbq= ". Realpath ("Db.mdb"));
$rs =new com ("Adodb.recordset");

$ABC = $_get["abc"]; $WEBN = $_post["WEBN"]; $name = $_post["name"]; $PWS = $_post["PWS"]; $NEWPWS = $_post["NEWPWS"];
$rs->open ("SELECT * from [web]", $conn, 1, 1);
$adminname = $rs->fields (1)->value;
$ADMINPWS = $rs->fields (2)->value;
$ll = $rs->fields (3)->value;
$webname = $rs->fields (4)->value;
$rs->close ();
$admincookie = $adminname;

$conn->execute ("Update [web] set [ll] = ' $ll ' +1"); $rs->close ();
?>




<? Echo $webname?>


if ($abc = = "Admin") {
if ($name = = $adminname && $PWS = = $ADMINPWS) {
Setcookie ("admin", $admincookie, Time () +3600); Header ("location:./");
}else{echo "";}
}

if ($ABC = = "Exit") {
Setcookie ("admin", "", Time ()-3600); Header ("location:./");
}

if ($abc = = "Editadmin") {
if (! $webname | |! $name | |! $pws) {
echo "";
}
if ($PWS! = $ADMINPWS) {
echo "";
}
if ($NEWPWS! = "") {
$conn->execute ("Update [web] set [webname] = ' $webname ', [name] = ' $name ', [PWS] = ' $NEWPWS '");
$conn->close (); $conn =null;
echo "";
}else{
$conn->execute ("Update [web] set [webname] = ' $WEBN ', [name] = ' $name '");
$conn->close (); $conn =null;
echo "";
}
}
?>

" "
Manage change data security exit





$id =$_get[' id '];
$SJ =date (' y-m-d ');
if ($ABC = = "Add") {
$nr =$_post[' nr '];
$ip =getenv ("remote_addr");
if (! $nr) {
echo "";
}else{
$conn->execute ("INSERT into [txt] (NR,SJ) VALUES (' $nr ', ' $SJ ')");
}
echo "";
$conn->close (); $conn =null;
}

if ($abc = = "Del") {
$conn->execute ("delete from [txt] where [id]=". $id);
$conn->close (); $conn =null; Header ("location:./");
}

if ($abc = = "Edit") {
$nr =$_post[' nr '];
$HF =$_post[' HF '];
$conn->execute ("Update [TXT] set [nr] = ' $nr ', [HF] = ' $HF ' WHERE [id]= '. $id);
$conn->close (); $conn =null; Header ("location:./");
}

$zd =$_get[' ZD '];
if ($zd! = "") {
if ($zd = = "0") $zd = 1; else $zd = 0;
$conn->execute ("Update [TXT] set [ZD] = ' $zd ' WHERE [id]=". $id);
$conn->close (); $conn =null; Header ("location:./");
}
?>





Page out
$rs->open ("select * from [TXT] ORDER by [ZD] desc, [SJ] desc", $conn, 1, 3);
$rs->pagesize=5;
$page =trim ($_get[' page ');
if ($page = = "" | | is_numeric (intval ($page)) <=0) {$page = 1;} else if (intval ($page) > $rs->pagecount) {$page = $rs->pagecount;}
$page =intval ($page);
if (! $rs->eof| | $rs->bof) {
$rs->absolutepage= $page; $mypagesize = $rs->pagesize; $i = $rs->recordcount ()-($page-1) * $rs->pagesize;
while (! $rs->eof && $mypagesize >0 && $i >= $rs->recordcount ()-$rs->pagesize* $page) {
$id = $rs->fields (0)->value;
$NR = $rs->fields (1)->value;
$HF = $rs->fields (2)->value;
$SJ = $rs->fields (3)->value;
$zd = $rs->fields (4)->value;
?>




 
Action: |
Modify/Reply |
Delete



Date








$NR = Str_replace ("n", "N".
', $NR);
$NR = Str_replace ("", "', $NR);
echo $nr. "
";
?>
if ($HF! = "") {
echo "Reply:";
$HF = Str_replace ("n", "N".
', $HF);
$HF = Str_replace ("", "', $HF);
echo $HF. "";
}
?>

MoveNext $mypagesize--; $i--; }}//Paging cycle?>


Number of messages ( RecordCount ();?>)
Home
Previous page
Section / PageCount;? > Page
Next page
Last
Number of visits ( )

Close (); $rs =null; $conn->close (); $conn =null;?>


Database structure
ID name PWS LL webname
1 ABC abc 4 ABC message book PHP+ACC

http://www.bkjia.com/PHPjc/630806.html www.bkjia.com true http://www.bkjia.com/PHPjc/630806.html techarticle PHP Access Message Board program is not a PHP and MySQL message board program, but a simple and practical PHP Access message board program Oh, using the ADODB to connect to the Access database Oh. PHP Tutorials ...

  • 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.