Phpaccess message board project_php tutorial

Source: Internet
Author: User
Phpaccess message board program. The phpaccess message board program is not a message board program of php and mysql, but a simple and practical phpaccess message board program. it uses adodb to connect to the access database. Php access message board program for php and mysql is not a message board program, but a simple and practical php access message board program. it uses adodb to connect to the access database.

Php Tutorial access message board program
This is not a message board program for php and mysql tutorials, but a simple and practical php access message board program. I used adodb to connect to the access database tutorial.
*/

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 "script alert ('user name or password is incorrect! '); History. back (); script ";}
}

If ($ abc = "exit "){
Setcookie ("admin", "", time ()-3600); header ("location :./");
}

If ($ abc = "editadmin "){
If (! $ Webname |! $ Name |! $ Pws ){
Echo "script alert ('the message book, user name, and original password cannot be blank! '); History. back (); script ";
}
If ($ pws! = $ Adminpws ){
Echo "script" alert ('May the password be wrong! '); History. back (); script ";
}
If ($ newpws! = ""){
$ Conn-> execute ("update [web] set [webname] = '$ webname', [name] =' $ name ', [pws] = '$ newpws '");
$ Conn-> close (); // $ conn = null;
Echo "script alert ('modified successfully. please log on again! '); Location = '? Abc = exit '; script ";
} Else {
$ Conn-> execute ("update [web] set [webname] = '$ webn', [name] =' $ name '");
$ Conn-> close (); // $ conn = null;
Echo "script" alert ('modification successful! '); Location ='./'; script ";
}
}
?>

【 ]
Management Modify data security and exit





$ Id = $ _ get ['id'];
$ Sj = date ('Y-m-D ');
If ($ abc = "add "){
$ Nr = $ _ post ['NR '];
$ Ip = getenv ("remote_addr ");
If (! $ Nr ){
Echo "script" alert ('the message cannot be blank! '); History. back (); script ";
} Else {
$ Conn-> execute ("insert into [txt] (nr, sj) values ('$ nr', '$ sj ')");
}
Echo "script" alert ('Operation successful! '); Location ='./'; script ";
$ 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 :./");
}
?>





// Pagination
$ 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 ()-1-$ 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;
?>




 
Operation: |
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 -- ;}// pagination loop?>


Number of messages ( Recordcount ();?>)
Homepage
Previous Page
The / Pagecount;?> Page
Next page
Last page
Traffic ( )

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


Database structure
Id name pws ll webname
1 abc 4 abc message book php + acc

Http://www.bkjia.com/PHPjc/630806.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630806.htmlTechArticlephp access message board program here is not 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...

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.