Php+dbfile Development of Small message book _php Foundation
Source: Internet
Author: User
Recently has been using Php+dbfile development blog, the development process to learn a lot of things, so I tried to write a small message book.
This message used Php+dbfile, do not need to use the database, you can put in the blog, such as http://www.customyze.com, this blog tag board is this message.
The whole message needs four files, namely: board.php, index.php, config.php, admin.php.
Board.php is used to store data, you can add a message record in it first. Code Copy Box
<?php $Board =array (Array (1081410332, ' Test ', ' Test message book ', ' http://www.piscdong.com '));?>
[Ctrl + a All select and copy]
config.php is stored in the management of the message of the password, put the password in a separate file for easy modification. Code Copy Box
<?php $password = ' 123456 ';?>
[Ctrl + a All select and copy]
admin.php is the admin page, the function is very simple, can only delete the message. When you delete, you need to enter the admin password and the admin password is stored in the config.php. Code Copy Box
<?php require_once (' board.php '); Require_once (' config.php '); if (isset ($HTTP _post_vars[' id ']) && $HTTP _post_vars[' id ']!= ' && addslashes ($HTTP _post_vars[') Password '] = = $password) {if (count ($Board) >1) {unset ($Board [Intval ($HTTP _post_vars[' id]]); for ($i =0; $i < Count ($Board); $i + +) {$bd =current ($Board); $s []=] \tarray (". $BD [0].", ' "$bd [1]." ', ' $BD [2]. "', '". $BD [3]. ($Board); $content = "<?php\n\ $Board =array (\ n". Join ($s, ", \ n"). " \ n);\n?> "; $configpath _parts1 = pathinfo ($SCRIPT _filename); $filename = $configpath _parts1[' dirname ']. ' /'.' Board.php '; if (is_writable ($filename)
!file_exists ($filename)) {if (! $handle =fopen ($filename, ' W ')) {return false;} if (!fwrite ($handle, $content)) {return False } fclose ($handle); }else{return false;} Header (' Location:admin.php '); }else{?> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> [Ctrl + a All select and copy]
This message is also very simple, functional is not sound, such as no paging, but also can continue to improve. :-)
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.