Home > Backend Development > PHP Tutorial > An example of a text guestbook made in PHP (2)_PHP Tutorial

An example of a text guestbook made in PHP (2)_PHP Tutorial

WBOY
Release: 2016-07-21 16:06:03
Original
843 people have browsed it

Last time we studied the guest.php file. Specific questions also require readers to practice them in depth by themselves, and some reference books are needed to learn. If you have no knowledge of PHP, the author advises you not to think about it. The author does not have much time and space to explore the purpose and meaning of a php file sentence by sentence. Okay, let's edit the file edit.php next.
-----------
//edit.php

if ($Submit)
{
if ($SavePassword=="on")
{setcookie("TxtPassword", "$TxtPassword",time()+30*24*3600);}
else
{setcookie("TxtPassword");}
}
?>





Modify message
require ("sys.php");
function readvalue($tags,$tage)
{
global $message,$long,$reply;
$StrStart=strlen(strstr($message, $tags))-strlen($tags);//The starting position of the string where the variable is after removing the tag.
$StrEnd=strlen(strstr($message,$tage));
$len=$ StrStart-$StrEnd;
$StrStart=$long-$StrStart;//Start character.
$StrString=substr($message,$StrStart,$len);
return $StrString;
}

function save($record)
{
global $TxtContent,$TxtEmail,$TxtHomepage,$TxtEmail,$TxtName,$TxtFrom,$TxtReply,$REMOTE_ADDR,$guestfile;
$content=file($guestfile,"r");
$space = " ";
$time = date(Y year m month d day H hour i minute);
$ip= $REMOTE_ADDR;
$TxtReply=StripSlashes($TxtReply);
$TxtContent=StripSlashes($TxtContent);
$TxtContent=htmlspecialchars($TxtContent);
$TxtContent=check_strlen_long($TxtContent) ;
$TxtContent=nl2br($TxtContent);
$Wcontent = "Message content:
< !--content>$TxtContent