Added categories and switchable fields

This commit is contained in:
ivan 2017-09-29 11:54:49 +03:00
parent 860d8d2c1c
commit fe42fc4123
5 changed files with 184 additions and 83 deletions

11
README
View File

@ -1,7 +1,16 @@
PHPCSV Guestbook version 0.97
PHPCSV Guestbook version 0.98
Simple php guestbook with csv file data storage.
Features:
- Captcha
- Admin panel
- Search
- Images upload
- 'Read More' button
- Pagination
- Categories
Working example: https://zlaxyi.soundragon.su/gb
PHPCSV Guestbook requires PHP 5.0 or higher version.

View File

@ -13,7 +13,7 @@ function ReadEntries() {
$fhandle=fopen($GBdata,"r") or $DataStatus="empty";
for($e=0; $entrydata=fgetcsv($fhandle, 16384, ","); $e++) {
$Entries["$e"]=$entrydata;
$Entries["$e"][7]=$e+1;
$Entries["$e"][10]=$e+1;
} fclose($fhandle);
if (!$Entries[0]) $DataStatus="empty";
return $Entries;
@ -24,7 +24,7 @@ function SaveEntries() {
global $AdminEntries;
$fhandle=fopen($GBdata,"w");
foreach($AdminEntries as $e=>$Entry) {
unset($Entry[7]);
unset($Entry[10]);
fputcsv($fhandle,$Entry);
}
fclose($fhandle);
@ -35,7 +35,7 @@ function Search($SearchQuery) {
$SearchResultCount=0;
$SearchResult=false;
foreach($Entries as $e=>$Entry) {
for($p=0; $p<7; $p++) {
for($p=0; $p<9; $p++) {
if (mb_stristr($Entry[$p],$SearchQuery)) {
$SearchResult[$SearchResultCount][0]=$e;
$SearchResult[$SearchResultCount][1]=$Entry;
@ -72,6 +72,20 @@ function AdminHeaderView() {
}
}
function SingleEntry($Entry) {
global $Titles;
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
echo " <tr><td>",($Entry[10]),"<input type=checkbox name=\"cb",($Entry[10]-1),"\" value=\"checked\"></td><td>$Entry[0]</td>";
if ($GBcityfield) echo "<td>$Entry[1]</td>";
if ($HBlinkfield) echo "<td>$Entry[2]</td>";
if ($GBsubjectfield) echo "<td>$Entry[7]</td>";
if ($GBcategoryfield) echo "<td>$Entry[8]</td>";
echo "<td>$Entry[3]</td><td>",nl2br($Entry[4]),"</td><td>",nl2br($Entry[6]),"</td><td>",date("j.m.Y, H:i",$Entry[5]),"</td><td><input type=submit name=\"submit",($Entry[10]-1),"\" value=\"$Titles[AdminEdit]\"></td></tr>\n";
}
function AdminEntriesView() {
global $Titles;
global $DataStatus;
@ -80,6 +94,10 @@ function AdminEntriesView() {
global $AdminEntries;
global $GBpagination;
global $GBtextlenght;
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
if ($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))) if ($DataStatus=="empty") echo "$Titles[EmptyFile]\n";
else if ($_SESSION["DeleteStatus"]=="deletion") {
echo " $Titles[AdminSureDel] ",count($_SESSION["DeleteEntries"])," $Titles[AdminSureDelMessages]?\n";
@ -91,9 +109,19 @@ function AdminEntriesView() {
echo " $Titles[AdminMessage] ", ($_SESSION["EditStatus"]),", ",date("j.m.Y, H:i",$AdminEntries[($_SESSION["EditStatus"]-1)][5]),":<br>\n";
echo "<form action=administration.php method=post>\n";
echo " $Titles[AdminName]: <input type=text name=\"editname\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][0],"\" maxlength=255><br>\n";
echo " $Titles[City] <input type=text name=\"editfrom\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][1],"\" maxlength=255><br>\n";
echo " $Titles[Link] <input type=text name=\"editlink\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][2],"\" maxlength=255><br>\n";
if ($GBcityfield) echo " $Titles[City] <input type=text name=\"editfrom\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][1],"\" maxlength=255><br>\n";
if ($GBlinkfield) echo " $Titles[Link] <input type=text name=\"editlink\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][2],"\" maxlength=255><br>\n";
echo " $Titles[Email] <input type=text name=\"editmail\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][3],"\" maxlength=255><br>\n";
if ($GBsubjectfield) echo " $Titles[Subject] <input type=text name=\"editsubj\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][7],"\" maxlength=255><br>\n";
if ($GBcategoryfield) {
echo " $Titles[Category] <select name=\"editcategory\">";
foreach($GBcategoryfield as $Category) {
echo " <option value=\"$Category\"";
if ($AdminEntries[($_SESSION["EditStatus"]-1)][8]==$Category) echo " selected=\"selected\"";
echo ">$Category</option>";
}
echo "</select><br>\n";
}
echo " $Titles[AdminMessage]:<br>\n <textarea name=\"edittext\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$AdminEntries[($_SESSION["EditStatus"]-1)][4],"</textarea><br>\n";
echo " $Titles[Response]:<br>\n <textarea name=\"editresp\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$AdminEntries[($_SESSION["EditStatus"]-1)][6],"</textarea><br>\n";
echo " <input type=submit name=\"submiteedit\" value=\"$Titles[AdminApply]\"> ";
@ -146,18 +174,28 @@ function AdminEntriesView() {
}
echo "</form>\n";
echo "<form action=administration.php method=post>\n";
echo "<table border=1 width=\"100%\">\n <tr><th></th><th>$Titles[AdminName]</th><th>$Titles[City]</th><th>$Titles[Link]</th><th>$Titles[Email]</th><th>$Titles[AdminMessage]</th><th>$Titles[Response]</th><th>$Titles[AdminDate]</th><th></th></tr>\n";
echo "<table border=1 width=\"100%\">\n <tr><th></th><th>$Titles[AdminName]</th>";
if ($GBcityfield) echo "<th>$Titles[City]</th>";
if ($HBlinkfield) echo "<th>$Titles[Link]</th>";
if ($GBsubjectfield) echo "<th>$Titles[Subject]</th>";
if ($GBcategoryfield) echo "<th>$Titles[Category]</th>";
echo "<th>$Titles[Email]</th><th>$Titles[AdminMessage]</th><th>$Titles[Response]</th><th>$Titles[AdminDate]</th><th></th></tr>\n";
for ($e = ($GBpagination*$CurrentPage); $e < ($GBpagination*($CurrentPage+1)); $e++) {
if ($e>=count($Entries)) break;
$Entry = $Entries[$e];
echo " <tr><td>",($Entry[7]),"<input type=checkbox name=\"cb",($Entry[7]-1),"\" value=\"checked\"></td><td>$Entry[0]</td><td>$Entry[1]</td><td>$Entry[2]</td><td>$Entry[3]</td><td>",nl2br($Entry[4]),"</td><td>",nl2br($Entry[6]),"</td><td>",date("j.m.Y, H:i",$Entry[5]),"</td><td><input type=submit name=\"submit",($Entry[7]-1),"\" value=\"$Titles[AdminEdit]\"></td></tr>\n";
SingleEntry($Entry);
}
$_SESSION['currentpage']=$CurrentPage;
} else {
echo "<form action=administration.php method=post>\n";
echo "<table border=1 width=\"100%\">\n <tr><th></th><th>$Titles[AdminName]</th><th>$Titles[City]</th><th>$Titles[Link]</th><th>$Titles[Email]</th><th>$Titles[AdminMessage]</th><th>$Titles[Response]</th><th>$Titles[AdminDate]</th><th></th></tr>\n";
echo "<table border=1 width=\"100%\">\n <tr><th></th><th>$Titles[AdminName]</th>";
if ($GBcityfield) echo "<th>$Titles[City]</th>";
if ($HBlinkfield) echo "<th>$Titles[Link]</th>";
if ($GBsubjectfield) echo "<th>$Titles[Subject]</th>";
if ($GBcategoryfield) echo "<th>$Titles[Category]</th>";
echo "<th>$Titles[Email]</th><th>$Titles[AdminMessage]</th><th>$Titles[Response]</th><th>$Titles[AdminDate]</th><th></th></tr>\n";
$Entries=array_reverse($AdminEntries);
foreach($Entries as $e=>$Entry) echo " <tr><td>",($Entry[7]),"<input type=checkbox name=\"cb",($Entry[7]-1),"\" value=\"checked\"></td><td>$Entry[0]</td><td>$Entry[1]</td><td>$Entry[2]</td><td>$Entry[3]</td><td>",nl2br($Entry[4]),"</td><td>",nl2br($Entry[6]),"</td><td>",date("j.m.Y, H:i",$Entry[5]),"</td><td><input type=submit name=\"submit",($Entry[7]-1),"\" value=\"$Titles[AdminEdit]\"></td></tr>\n";
foreach($Entries as $e=>$Entry) SingleEntry($Entry);
}
echo "</table>\n";
echo " <input type=submit name=\"submitdelete\" value=\"$Titles[AdminDeleteChecked]\">\n";
@ -192,6 +230,8 @@ if ($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))) {
$AdminEntries[($_SESSION["EditStatus"]-1)][3]=$_POST["editmail"];
$AdminEntries[($_SESSION["EditStatus"]-1)][4]=$_POST["edittext"];
$AdminEntries[($_SESSION["EditStatus"]-1)][6]=$_POST["editresp"];
$AdminEntries[($_SESSION["EditStatus"]-1)][7]=$_POST["editsubj"];
$AdminEntries[($_SESSION["EditStatus"]-1)][8]=$_POST["editcategory"];
SaveEntries();
Unset($_SESSION["EditStatus"]);
$AdminEntries=ReadEntries();

172
index.php
View File

@ -12,9 +12,18 @@ function SendMail() {
global $Titles;
global $GBnotificationmailto;
global $GBnotificationmailfrom;
$message=$_POST['name']." ".$Titles[From]." ".$_POST['from']."("
.$_POST['link'].", ".$_POST['email'].") ".$Titles[Wrote].":\r\n\r\n".$_POST['text']
."\r\n\r\n_____\r\n".$Titles[MailAdmin];
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
$message=$_POST['name'];
if ($GBcityfield) $message=$message." ".$Titles[From]." ".$_POST['from'];
$message=$message."(";
if ($GBlinkfield) $message=$message.$_POST['link'].", ";
$message=$message.$_POST['email'].") ".$Titles[Wrote];
if ($GBsubjectfield) $message=$message." ".$_POST['subj'];
if ($GBcategoryfield) $message=$message." [".$_POST['category']."]";
$message=$message.":\r\n\r\n".$_POST['text']."\r\n\r\n_____\r\n".$Titles[MailAdmin];
mail($GBnotificationmailto, $Titles[MailSubject], $message,
"From: ".$GBnotificationmailfrom." \r\n"."Content-type: text/plain; charset=utf-8\r\n"
."X-Mailer: PHP/".phpversion());
@ -26,7 +35,7 @@ function ReadEntries() {
$fhandle=fopen($GBdata,"r") or $DataStatus="empty";
for($e=0; $entrydata=fgetcsv($fhandle, 16384, ","); $e++) {
$Entries["$e"]=$entrydata;
$Entries["$e"][7]=$e+1;
$Entries["$e"][10]=$e+1;
}
fclose($fhandle);
if (!$Entries[0]) $DataStatus="empty";
@ -57,14 +66,21 @@ function AddEntry() {
global $Titles;
global $PageStatus;
global $UploadedFile;
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
$NewEntry[name]=$_POST['name'];
$NewEntry[from]=$_POST['from'];
$NewEntry[link]=$_POST['link'];
if ($GBcityfield) $NewEntry[from]=$_POST['from']; else $NewEntry[from]="";
if ($GBlinkfield) $NewEntry[link]=$_POST['link']; else $NewEntry[link]="";
$NewEntry[email]=$_POST['email'];
if ($UploadedFile) $NewEntry[text]=$_POST['text']." <br><img src=\"$UploadedFile\">";
else $NewEntry[text]=$_POST['text'];
$NewEntry[datetime]=time();
$NewEntry[response]="";
if ($GBsubjectfield) $NewEntry[subj]=$_POST['subj']; else $NewEntry[subj]="";
if ($GBcategoryfield) $NewEntry[category]=$_POST['category']; else $NewEntry[category]="";
$NewEntry[parameters]="";
$fhandle=fopen($GBdata,"a");
fputcsv($fhandle,$NewEntry);
fclose($fhandle);
@ -79,31 +95,44 @@ function AddEntryView() {
global $GBcaptcha;
global $GBtextlenght;
global $GBupload;
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
echo "<h2>",$Titles[Page],"</h2><br>\n";
if ($PageStatus=="added") echo "$Titles[Added]"; else {
$captchanumber11=rand(1, 4);
$captchanumber12=rand(0, 9);
$captchanumber21=rand(1, 4);
$captchanumber22=rand(0, 9);
$_SESSION['captcha']=md5(base64_encode(($captchanumber11.$captchanumber12)+($captchanumber21.$captchanumber22)));
echo "<form action=index.php method=post enctype=\"multipart/form-data\">\n";
echo " $Titles[Name]: <input type=text name=\"name\" value=\"",$Values["name"],"\" maxlength=255> ($Titles[Required])<br>\n";
echo " $Titles[City]: <input type=text name=\"from\" value=\"",$Values["from"],"\" maxlength=255><br>\n";
echo " $Titles[Link]: <input type=text name=\"link\" value=\"",$Values["link"],"\" maxlength=255><br>\n";
echo " $Titles[Email]: <input type=text name=\"email\" value=\"",$Values["email"],"\" maxlength=255> ($Titles[NotPublic])<br>\n";
echo " $Titles[Text]:<br>\n <textarea name=\"text\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$Values["text"],"</textarea><br>\n";
if ($GBupload) {
echo " <label for=\"file\">".$Titles[FileUpload]."</label>\n";
echo " <input type=\"file\" name=\"uploadedfile\"><br>\n";
if ($PageStatus=="added") echo "$Titles[Added]"."<br>\n";
$captchanumber11=rand(1, 4);
$captchanumber12=rand(0, 9);
$captchanumber21=rand(1, 4);
$captchanumber22=rand(0, 9);
$_SESSION['captcha']=md5(base64_encode(($captchanumber11.$captchanumber12)+($captchanumber21.$captchanumber22)));
echo "<form action=index.php method=post enctype=\"multipart/form-data\">\n";
echo " $Titles[Name]: <input type=text name=\"name\" value=\"",$Values["name"],"\" maxlength=255> ($Titles[Required])<br>\n";
if ($GBcityfield) echo " $Titles[City]: <input type=text name=\"from\" value=\"",$Values["from"],"\" maxlength=255><br>\n";
if ($GBlinkfield) echo " $Titles[Link]: <input type=text name=\"link\" value=\"",$Values["link"],"\" maxlength=255><br>\n";
echo " $Titles[Email]: <input type=text name=\"email\" value=\"",$Values["email"],"\" maxlength=255> ($Titles[NotPublic])<br>\n";
if ($GBsubjectfield) echo " $Titles[Subject]: <input type=text name=\"subj\" value=\"",$Values["subj"],"\" maxlength=255><br>\n";
if ($GBcategoryfield) {
echo " $Titles[Category]: <select name=\"category\">";
foreach($GBcategoryfield as $Category) {
echo " <option value=\"$Category\"";
if ($Values["category"]==$Category) echo " selected=\"selected\"";
echo ">$Category</option>";
}
if ($GBcaptcha) echo " $Titles[Captcha]: <font class=\"text\">$captchanumber11</font><font>$captchanumber11</font><font>$captchanumber12</font> $Titles[CaptchaPlus] <font>$captchanumber21</font><font>$captchanumber22</font><font class=\"text\">$captchanumber21</font> = <input type=text name=\"captcha\" size=2 maxlength=2> ?<br>\n";
echo " <input type=submit name=\"submit\" value=\"$Titles[Submit]\">\n";
echo "</form>\n";
if ($PageStatus=="emptyname") echo "$Titles[EmptyName]<br>\n";
if ($PageStatus=="emptytext") echo "$Titles[EmptyText]<br>\n";
if ($PageStatus=="wrongimage") echo "$Titles[WrongImage]<br>\n";
if ($PageStatus=="wrongcaptcha") echo "$Titles[WrongCaptcha]<br>\n";
echo "</select><br>\n";
}
echo " $Titles[Text]:<br>\n <textarea name=\"text\" wrap=virtual cols=50 rows=5 maxlength=$GBtextlenght>",$Values["text"],"</textarea><br>\n";
if ($GBupload) {
echo " <label for=\"file\">".$Titles[FileUpload]."</label>\n";
echo " <input type=\"file\" name=\"uploadedfile\"><br>\n";
}
if ($GBcaptcha) echo " $Titles[Captcha]: <font class=\"text\">$captchanumber11</font><font>$captchanumber11</font><font>$captchanumber12</font> $Titles[CaptchaPlus] <font>$captchanumber21</font><font>$captchanumber22</font><font class=\"text\">$captchanumber21</font> = <input type=text name=\"captcha\" size=2 maxlength=2> ?<br>\n";
echo " <input type=submit name=\"submit\" value=\"$Titles[Submit]\">\n";
echo "</form>\n";
if ($PageStatus=="emptyname") echo "$Titles[EmptyName]<br>\n";
if ($PageStatus=="emptytext") echo "$Titles[EmptyText]<br>\n";
if ($PageStatus=="wrongimage") echo "$Titles[WrongImage]<br>\n";
if ($PageStatus=="wrongcaptcha") echo "$Titles[WrongCaptcha]<br>\n";
}
function Search($SearchQuery) {
@ -111,7 +140,7 @@ function Search($SearchQuery) {
$SearchResultCount=0;
$SearchResult=false;
foreach($Entries as $e=>$Entry) {
for($p=0; $p<7; $p++) {
for($p=0; $p<9; $p++) {
if (mb_stristr($Entry[$p],$SearchQuery)) {
$SearchResult[$SearchResultCount][0]=$e;
$SearchResult[$SearchResultCount][1]=$Entry;
@ -134,12 +163,49 @@ function AddSearchBar() {
}
}
function SinlgeEntry($Entry) {
global $Titles;
global $GBreadmore;
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
echo " <div class=\"entry\"><div class=\"messages_header\"><h4>",$Entry[10],". ";
if ($Entry[2]) echo "<a href=\"",$Entry[2],"\">";
echo "<b>",$Entry[0],"</b>";
if ($Entry[2]) echo "</a>";
if ($Entry[1]) echo " ",$Titles[From]," <b>",$Entry[1],"</b>";
echo ", ",date("j.m.Y, H:i",$Entry[5]),", ",$Titles[Wrote];
if (($GBsubjectfield)&&($Entry[7])) echo " ",$Titles[About]," '",$Entry[7],"'";
if (($GBcategoryfield)&&($Entry[8])) echo " [",$Entry[8],"]";
echo ":</div></h4><br>\n";
if ($GBreadmore>0) {
$Message=strip_tags($Entry[4]);
if (strlen($Message)>$GBreadmore) {
$readmorenumber="readmore".$Entry[10];
if ($_POST[$readmorenumber]) echo " ",nl2br($Entry[4]),"<br>\n";
else {
$Message = substr($Message, 0, $GBreadmore);
$Message = substr($Message, 0, strrpos($Message, ' '))."... <form action=\"\" method=\"post\"><button type=\"submit\" name=\"readmore".$Entry[10]."\" value=\"read\" class=\"btn-link\">".$Titles[ReadMore]."</button></form>";
echo " ",nl2br($Message),"<br>\n";
}
} else echo " ",nl2br($Entry[4]),"<br>\n";
} else echo " ",nl2br($Entry[4]),"<br>\n";
if ($Entry[6]) echo "<br><i><b>$Titles[Response]:</b><br>\n";
if ($Entry[6]) echo nl2br($Entry[6]),"</i><br>\n";
echo "</div><hr>\n";
}
function EntriesView() {
global $Titles;
global $DataStatus;
global $Entries;
global $GBpagination;
global $GBreadmore;
global $GBcityfield;
global $GBlinkfield;
global $GBsubjectfield;
global $GBcategoryfield;
if ($DataStatus=="empty") echo "$Titles[EmptyFile]";
else if($_POST['search']&&$_POST['serachq']) {
$SearchResult=Search($_POST['serachq']);
@ -170,27 +236,7 @@ function EntriesView() {
else $CurrentPage=0;
for ($e = ($GBpagination*$CurrentPage); $e < ($GBpagination*($CurrentPage+1)); $e++) {
if ($e>=count($Entries)) break;
echo " <div class=\"entry\"><div class=\"messages_header\"><h4>",$Entries[$e][7],". ";
if ($Entries[$e][2]) echo "<a href=\"",$Entries[$e][2],"\">";
echo "<b>",$Entries[$e][0],"</b>";
if ($Entries[$e][2]) echo "</a>";
if ($Entries[$e][1]) echo " ",$Titles[From]," <b>",$Entries[$e][1],"</b>";
echo ", ",date("j.m.Y, H:i",$Entries[$e][5]),", ",$Titles[Wrote],":</div></h4><br>\n";
if ($GBreadmore>0) {
$Message=strip_tags($Entries[$e][4]);
if (strlen($Message)>$GBreadmore) {
$readmorenumber="readmore".$Entries[$e][7];
if ($_POST[$readmorenumber]) echo " ",nl2br($Entries[$e][4]),"<br>\n";
else {
$Message = substr($Message, 0, $GBreadmore);
$Message = substr($Message, 0, strrpos($Message, ' '))."... <form action=\"\" method=\"post\"><button type=\"submit\" name=\"readmore".$Entries[$e][7]."\" value=\"read\" class=\"btn-link\">".$Titles[ReadMore]."</button></form>";
echo " ",nl2br($Message),"<br>\n";
}
} else echo " ",nl2br($Entries[$e][4]),"<br>\n";
} else echo " ",nl2br($Entries[$e][4]),"<br>\n";
if ($Entries[$e][6]) echo "<br><i><b>$Titles[Response]:</b><br>\n";
if ($Entries[$e][6]) echo nl2br($Entries[$e][6]),"</i><br>\n";
echo "</div><hr>\n";
SinlgeEntry($Entries[$e]);
}
echo "<form action=index.php method=\"get\">\n";
if ($CurrentPage>0) {
@ -213,29 +259,7 @@ function EntriesView() {
$_SESSION['currentpage']=$CurrentPage;
} else {
$Entries=array_reverse($Entries);
foreach($Entries as $e=>$Entry) {
echo " <div class=\"entry\"><div class=\"messages_header\"><h4>",$Entry[7],". ";
if ($Entry[2]) echo "<a href=\"$Entry[2]\">";
echo "<b>",$Entry[0],"</b>";
if ($Entry[2]) echo "</a>";
if ($Entry[1]) echo " ",$Titles[From]," <b>",$Entry[1],"</b>";
echo ", ",date("j.m.Y, H:i",$Entry[5]),", ",$Titles[Wrote],":</div></h4><br>\n";
if (($GBreadmore>0)&&(!$SearchResult)) {
$Message=strip_tags($Entries[$e][4]);
if (strlen($Message)>$GBreadmore) {
$readmorenumber="readmore".$Entries[$e][7];
if ($_POST[$readmorenumber]) echo " ",nl2br($Entries[$e][4]),"<br>\n";
else {
$Message = substr($Message, 0, $GBreadmore);
$Message = substr($Message, 0, strrpos($Message, ' '))."... <form action=\"\" method=\"post\"><button type=\"submit\" name=\"readmore".$Entries[$e][7]."\" value=\"read\" class=\"btn-link\">".$Titles[ReadMore]."</button></form>";
echo " ",nl2br($Message),"<br>\n";
}
} else echo " ",nl2br($Entries[$e][4]),"<br>\n";
} else echo " ",nl2br($Entries[$e][4]),"<br>\n";
if ($Entry[6]) echo "<br><i><b>$Titles[Response]:</b><br>\n";
if ($Entry[6]) echo nl2br($Entry[6]),"</i><br>\n";
echo "</div><hr>\n";
}
foreach($Entries as $e=>$Entry) SinlgeEntry($Entry);
}
}
@ -266,6 +290,8 @@ if($_POST['submit']) {
$SESSION["value"]["name"]=$_POST['name'];
$SESSION["value"]["from"]=$_POST['from'];
$SESSION["value"]["link"]=$_POST['link'];
$SESSION["value"]["subj"]=$_POST['subj'];
$SESSION["value"]["category"]=$_POST['category'];
$SESSION["value"]["email"]=$_POST['email'];
$SESSION["value"]["text"]=$_POST['text'];
$Values=$SESSION["value"];

View File

@ -19,6 +19,16 @@ $GBimagesize=1048576; // maximum image size
$GBnotificationmailto=""; // leave empty if you don't want send notification
$GBnotificationmailfrom="";
$GBtextlenght=7168; // maximum size of entry text
$GBcityfield=false; // enable or disable 'City' field
$GBlinkfield=false; // enable or disable 'Homepage' field
$GBsubjectfield=true; // enable or disable 'Subject' field
$GBcategoryfield=array(
0=>"Public", // Array of categories, if you want to disable
1=>"Help", // 'Category' field, just leave
2=>"Special", // '$GBcategoryfield=false' string
3=>"Suppot",
4=>"Order",
5=>"Other");
$Titles[HeadTitle]="Guestbook";
$Titles[Page]="Guestbook";
$Titles[Name]="Your name";
@ -67,4 +77,7 @@ $Titles[NoResult]="No search result";
$Titles[ReadMore]="Read more";
$Titles[FileUpload]="Upload image:";
$Titles[WrongImage]="Can't upload image.";
$Titles[Subject]="Subject";
$Titles[Category]="Category";
$Titles[About]="about";
?>

View File

@ -20,6 +20,16 @@ $GBimagesize=1048576; // максимальный размер изображе
$GBnotificationmailto=""; // оставьте поле пустым, если не хотите отправки уведомлений о новых записях
$GBnotificationmailfrom="";
$GBtextlenght=7168; // максимальное количество символов для текста записи
$GBcityfield=false; // включение или отключение поля 'Город'
$GBlinkfield=false; // включение или отключение поля 'Домашняя страница'
$GBsubjectfield=true; // включение или отключение поля 'Тема'
$GBcategoryfield=array(
0=>"Public", // Список категорий, если вы хотите удалить
1=>"Help", // поле 'Категории', просто оставьте строку
2=>"Special", // '$GBcategoryfield=false'
3=>"Suppot",
4=>"Order",
5=>"Other");
$Titles[HeadTitle]="Гостевая книга";
$Titles[Page]="Гостевая книга";
$Titles[Name]="Ваше имя";
@ -68,4 +78,7 @@ $Titles[NoResult]="Ничего не найдено";
$Titles[ReadMore]="Читать далее";
$Titles[FileUpload]="Загрузить изображение:";
$Titles[WrongImage]="Не могу загрузить изображение.";
$Titles[Subject]="Тема";
$Titles[Category]="Категория";
$Titles[About]="о";
?>