On the Internet, I saw someone using php + MySQL as a visitor's check-in book. at that time, I thought it was very useful, so I also wanted to create one. However, MYSQL is a little useful, so it creates a text-based visitor check-in book. Its functions are similar to those I have seen on the Internet using MYSQL. here I will publish its source code, hoping it will be helpful to enlarge the user's learning about PHP. It is limited to my own level, and there may be bugs in it. I also hope that my friends will discover it and don't forget to tell me a chance. on the Internet, I saw someone using php + MySQL as a visitor's check-in book, at that time, I felt very useful, so I also wanted to develop one. However, MYSQL is a little useful, so it creates a text-based visitor check-in book. Its functions are similar to those I have seen on the Internet using MYSQL. here I will publish its source code, hoping it will help me to enlarge the user's learning about PHP. It is limited to my own level, and there must be bugs in it. I hope my friends will find it and don't forget to tell me. This check-in book consists of two files: one is the sign.txt file that stores the signed information, which can be created by NOTEPAD; the other is the sign. php file that processes the information. Home page of bamboo garden We have a demo of it. please check it out. Below
Is the source code of sign. php:
Sign. php
If (isset ($ name) & isset ($ msg )){
$ Name = ltrim ($ name );
$ T = date (y, m, d );
$ Dat = "[". $ t. "]";
$ Msg = ltrim ($ msg );
$ Name = trim ($ name );
$ Msg = trim ($ msg );
$ PRistr = $ name. "". $ dat. "". $ msg. "\ n ";
$ F = fopen ("sign.txt", "");
Fwrite ($ f, $ pristr );
Fclose ($ f );
}
$ File = file ("sign.txt ");
If (! Isset ($ pagenum )){
$ Pagenum = 1;
}
$ Lesssign = 0;
$ Num = count ($ file );
$ Dispnumed = 6 * ($ pagenum-1 );
$ Dispnumbeg = $ num-$ dispnumed;
$ Artnumeof1 = 6 * $ pagenum;
$ Isdispnum = $ num-$ artnumeof1;
If ($ isdispnum <= 0 ){
$ Dispnumeof = 1;
$ Lesssign = 1;
}
Else {
$ Dispnumeof = $ isdispnum + 1;
}
$ Sign = 0;
$ Pagec = 0;
For ($ icount = 0; ($ icount <$ num) & ($ sign = 0); $ icount + = 6 ){
For ($ I = 0; $ I <= 6; $ I ++ ){
If ($ icount * 6 + $ I) = $ num ){
$ Sign = 1;
}
}
$ Pagec ++;
}
$ Pagecount = $ pagec;
Echo"
";$ Fuhao = "◇ ";$ Color = e9eae9;$ Iscolor = 0;$ Lessnum = 5;Echo"
"; Echo "bamboo garden check-in book "; Echo" |
";For ($ I = $ dispnumbeg; $ I >=$ dispnumeof; $ I --){$ Linknum = $ num-$ I;$ Lessnum --;$ Stringmsg1 = $ file [($ i-1)];$ Stringmsg2 = strrev ($ stringmsg1 );$ Stringmsg3 = strstr ($ stringmsg2, "psbn ");$ Stringmsg = strrev ($ stringmsg3 );$ Stringlink = strstr ($ file [($ i-1)], "http ");$ Dispvar = $ fuhao. $ stringmsg;Echo"
"; Echo $ dispvar; Echo ""; Echo ""; Echo $ stringlink; Echo ""; Echo" |
";If ($ iscolor = 0 ){$ Color = ffffff;$ Iscolor = 1;}Else {$ Color = e9eae9;$ Iscolor = 0;}}If ($ lesssign = 1 ){For ($ iless = $ lessnum; $ iless> 0; $ iless --){Echo"
"; Echo $ fuhao ." \ N "; Echo" |
";If ($ iscolor = 0 ){$ Color = ffffff;$ Iscolor = 1;}Else {$ Color = e9eae9;$ Iscolor = 0;}}}Echo"
";Echo "";Echo"
";Echo"
";
?>