Text-based visitor sign-in book_PHP tutorial
By chance, I saw someone on the Internet using PHP+MYSQL to make a guest sign-in book. I thought it was very useful, so I wanted to make one myself. But using MYSQL felt a bit overkill, so I built a text-based visitor sign-in book. Its function is similar to what I saw on the Internet using MYSQL. I will publish its source code here, hoping that it will help netizens learn PHP. It is limited to my level, so there must be bugs in it, and I hope friends don’t forget to tell me if they find it. This sign-in book consists of two files: one is the sign.txt file that stores the sign-in information, which can be created by NOTEPAD; the second is the sign.php file that processes the information. There is a demo of it on Bamboo Garden's homepage
就是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","a");
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"斑竹园签到簿";
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"
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to set up keyboard startup on Gigabyte's motherboard. First, if it needs to support keyboard startup, it must be a PS2 keyboard! ! The setting steps are as follows: Step 1: Press Del or F2 to enter the BIOS after booting, and go to the Advanced (Advanced) mode of the BIOS. Ordinary motherboards enter the EZ (Easy) mode of the motherboard by default. You need to press F7 to switch to the Advanced mode. ROG series motherboards enter the BIOS by default. Advanced mode (we use Simplified Chinese to demonstrate) Step 2: Select to - [Advanced] - [Advanced Power Management (APM)] Step 3: Find the option [Wake up by PS2 keyboard] Step 4: This option The default is Disabled. After pulling down, you can see three different setting options, namely press [space bar] to turn on the computer, press group

1. WeChat is a social platform that pays attention to privacy protection. Users cannot see who has visited their Moments or personal homepage. 2. This design is intended to protect user privacy and avoid potential harassment or snooping. 3. Users can only see the likes and comments records in their circle of friends, further ensuring the confidentiality of personal information.

1. Processor When choosing a computer configuration, the processor is one of the most important components. For playing games like CS, the performance of the processor directly affects the smoothness and response speed of the game. It is recommended to choose Intel Core i5 or i7 series processors because they have powerful multi-core processing capabilities and high frequencies, and can easily cope with the high requirements of CS. 2. Graphics card Graphics card is one of the important factors in game performance. For shooting games such as CS, the performance of the graphics card directly affects the clarity and smoothness of the game screen. It is recommended to choose NVIDIA GeForce GTX series or AMD Radeon RX series graphics cards. They have excellent graphics processing capabilities and high frame rate output, and can provide a better gaming experience. 3. Memory power

Is it frustrating to automatically remove leading zeros from Excel workbooks? When you enter a number into a cell, Excel often removes the leading zeros in front of the number. By default, it treats cell entries that lack explicit formatting as numeric values. Leading zeros are generally considered irrelevant in number formats and are therefore omitted. Additionally, leading zeros can cause problems in certain numerical operations. Therefore, zeros are automatically removed. This article will teach you how to retain leading zeros in Excel to ensure that the entered numeric data such as account numbers, zip codes, phone numbers, etc. are in the correct format. In Excel, how to allow numbers to have zeros in front of them? You can preserve leading zeros of numbers in an Excel workbook, there are several methods to choose from. You can set the cell by

SPDIFOUT connection line sequence on the motherboard. Recently, I encountered a problem regarding the wiring sequence of the wires. I checked online. Some information says that 1, 2, and 4 correspond to out, +5V, and ground; while other information says that 1, 2, and 4 correspond to out, ground, and +5V. The best way is to check your motherboard manual. If you can't find the manual, you can use a multimeter to measure it. Find the ground first, then you can determine the order of the rest of the wiring. How to connect motherboard VDG wiring When connecting the VDG wiring of the motherboard, you need to plug one end of the VGA cable into the VGA interface of the monitor and the other end into the VGA interface of the computer's graphics card. Please be careful not to plug it into the motherboard's VGA port. Once connected, you can

What should I do if win7 system cannot open txt text? When we need to edit text files on our computers, the easiest way is to use text tools. However, some users find that their computers cannot open txt text files. So how to solve this problem? Let’s take a look at the detailed tutorial to solve the problem of unable to open txt text in win7 system. Tutorial to solve the problem that win7 system cannot open txt text. 1. Right-click any txt file on the desktop. If there is no txt file, you can right-click to create a new text document, and then select properties, as shown below: 2. In the opened txt properties window , find the change button under the general options, as shown in the figure below: 3. In the pop-up open mode setting

In iOS 17, Apple has overhauled its entire selection of ringtones and text tones, offering more than 20 new sounds that can be used for calls, text messages, alarms, and more. Here's how to see them. Many new ringtones are longer and sound more modern than older ringtones. They include arpeggio, broken, canopy, cabin, chirp, dawn, departure, dolop, journey, kettle, mercury, galaxy, quad, radial, scavenger, seedling, shelter, sprinkle, steps, story time , tease, tilt, unfold and valley. Reflection remains the default ringtone option. There are also 10+ new text tones available for incoming text messages, voicemails, incoming mail alerts, reminder alerts, and more. To access new ringtones and text tones, first, make sure your iPhone

1. Text task This article mainly discusses the method of generative text summarization, and how to use contrastive learning and large models to implement the latest generative text summarization training paradigm. It mainly involves two articles, one is BRIO: Bringing Order to Abstractive Summarization (2022), which uses contrastive learning to introduce ranking tasks in the generative model; the other is OnLearning to Summarize with Large Language Models as References (2023), which further introduces large models to generate high-quality training data based on BRIO. 2. Generative text summarization training methods and
