php txt message board (also has paging function)
php tutorial txt message board (also has paging function)
$ file = "data.dat"; // data file
if (file_exits ($ file)) {// fault tolerance processing, prevent the existence of unsecured files
$ fp = FOPEN ($ file, "" "" "" "" "" "" "" "" w+");
fclose($fp);
unset($fp);
}
$listnumber = 20; //Number of items displayed per page
$fp = file($ file); // Read data to
$ Number = Count ($ FP); // Calculate the total data volume
$ Pagenumber = Floor ($ Number/$ ListNumber) +1; ($number<1){
print "No record yet, please leave a message";
/*+------------------------ --------+
|Print the form here or connect to the table |
| url, |
|
+------------- ------------------+*/
}else{
if(empty($_post["page"])){ //This if. ..else... is written to be compatible with the default settings of php4.20 and to prevent invalid global variables
o subscript
}else{
$page = $_post["page"]
}
if($page<0 || $page>pagenumber){ //Error detection processing, When the page parameter jumps out of the total page or is less than the homepage (0), it will return to the first page
$page=0;
$endnote = $startnote+$listnumber; //End recording position
//for($int_a=$startnote;$int_a<$endnote;$int_a++){ //Sort display similar to asc mode
pirnt "