Added enable/disable email field

This commit is contained in:
ivan 2017-10-22 11:01:58 +03:00
parent 4694fc18b4
commit 0e56403679
5 changed files with 14 additions and 6 deletions

2
README
View File

@ -1,4 +1,4 @@
PHPCSV Guestbook version 0.99.3 PHPCSV Guestbook version 0.99.4
Simple php guestbook with csv file data storage. Simple php guestbook with csv file data storage.

View File

@ -84,12 +84,14 @@ function SingleEntry($Entry) {
global $GBlinkfield; global $GBlinkfield;
global $GBsubjectfield; global $GBsubjectfield;
global $GBcategoryfield; global $GBcategoryfield;
global $GBemailfield;
echo " <tr><td>",($Entry[10]),"<input type=checkbox name=\"cb",($Entry[10]-1),"\" value=\"checked\"></td><td>$Entry[0]</td>"; 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 ($GBcityfield) echo "<td>$Entry[1]</td>";
if ($GBlinkfield) echo "<td>$Entry[2]</td>"; if ($GBlinkfield) echo "<td>$Entry[2]</td>";
if ($GBsubjectfield) echo "<td>$Entry[7]</td>"; if ($GBsubjectfield) echo "<td>$Entry[7]</td>";
if ($GBcategoryfield) echo "<td>$Entry[8]</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"; if ($GBemailfield) echo "<td>$Entry[3]</td>";
echo "<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() { function AdminEntriesView() {
@ -108,6 +110,7 @@ function AdminEntriesView() {
global $GBfield1; global $GBfield1;
global $GBfield2; global $GBfield2;
global $GBfield3; global $GBfield3;
global $GBemailfield;
if (isset($_SESSION["SessionStatus"])?($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))):false) if ($DataStatus=="empty") echo $Titles["EmptyFile"],"\n"; if (isset($_SESSION["SessionStatus"])?($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))):false) if ($DataStatus=="empty") echo $Titles["EmptyFile"],"\n";
else if (isset($_SESSION["DeleteStatus"])) { else if (isset($_SESSION["DeleteStatus"])) {
if ($_SESSION["DeleteStatus"]=="deletion") { if ($_SESSION["DeleteStatus"]=="deletion") {
@ -123,7 +126,7 @@ function AdminEntriesView() {
echo " ",$Titles["AdminName"],": <input type=text name=\"editname\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][0],"\" maxlength=255><br>\n"; echo " ",$Titles["AdminName"],": <input type=text name=\"editname\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][0],"\" 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 ($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"; 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 ($GBemailfield) 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 ($GBsubjectfield) echo " ",$Titles["Subject"]," <input type=text name=\"editsubj\" value=\"",$AdminEntries[($_SESSION["EditStatus"]-1)][7],"\" maxlength=255><br>\n";
if ($GBcategoryfield) { if ($GBcategoryfield) {
echo " ",$Titles["Category"]," <select name=\"editcategory\">"; echo " ",$Titles["Category"]," <select name=\"editcategory\">";
@ -201,7 +204,8 @@ function AdminEntriesView() {
if ($GBlinkfield) echo "<th>",$Titles["Link"],"</th>"; if ($GBlinkfield) echo "<th>",$Titles["Link"],"</th>";
if ($GBsubjectfield) echo "<th>",$Titles["Subject"],"</th>"; if ($GBsubjectfield) echo "<th>",$Titles["Subject"],"</th>";
if ($GBcategoryfield) echo "<th>",$Titles["Category"],"</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"; if ($GBemailfield) echo "<th>",$Titles["Email"],"</th>";
echo "<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++) { for ($e = ($GBpagination*$CurrentPage); $e < ($GBpagination*($CurrentPage+1)); $e++) {
if ($e>=count($Entries)) break; if ($e>=count($Entries)) break;
$Entry = $Entries[$e]; $Entry = $Entries[$e];
@ -215,7 +219,8 @@ function AdminEntriesView() {
if ($GBlinkfield) echo "<th>",$Titles["Link"],"</th>"; if ($GBlinkfield) echo "<th>",$Titles["Link"],"</th>";
if ($GBsubjectfield) echo "<th>",$Titles["Subject"],"</th>"; if ($GBsubjectfield) echo "<th>",$Titles["Subject"],"</th>";
if ($GBcategoryfield) echo "<th>",$Titles["Category"],"</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"; if ($GBemailfield) echo "<th>",$Titles["Email"],"</th>";
echo "<th>",$Titles["AdminMessage"],"</th><th>",$Titles["Response"],"</th><th>",$Titles["AdminDate"],"</th><th></th></tr>\n";
$Entries=array_reverse($AdminEntries); $Entries=array_reverse($AdminEntries);
foreach($Entries as $e=>$Entry) SingleEntry($Entry); foreach($Entries as $e=>$Entry) SingleEntry($Entry);
} }

View File

@ -153,6 +153,7 @@ function AddEntryView() {
global $GBfield1; global $GBfield1;
global $GBfield2; global $GBfield2;
global $GBfield3; global $GBfield3;
global $GBemailfield;
echo "<h2>",$Titles["Page"],"</h2><br>\n"; echo "<h2>",$Titles["Page"],"</h2><br>\n";
if ($PageStatus=="added") echo $Titles["Added"]."<br>\n"; if ($PageStatus=="added") echo $Titles["Added"]."<br>\n";
$captchanumber11=rand(1, 4); $captchanumber11=rand(1, 4);
@ -164,7 +165,7 @@ function AddEntryView() {
echo " ",$Titles["Name"],": <input type=text name=\"name\" value=\"",$Values["name"],"\" maxlength=255> (",$Titles["Required"],")<br>\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 ($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"; 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 ($GBemailfield) 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 ($GBsubjectfield) echo " ",$Titles["Subject"],": <input type=text name=\"subj\" value=\"",$Values["subj"],"\" maxlength=255><br>\n";
if ($GBcategoryfield) { if ($GBcategoryfield) {
echo " ",$Titles["Category"],": <select name=\"category\">"; echo " ",$Titles["Category"],": <select name=\"category\">";

View File

@ -47,6 +47,7 @@ $GBstickylocked=true; // stick or lock entries in admin panel
$GBfield1=true; // enable or disable special field 1 $GBfield1=true; // enable or disable special field 1
$GBfield2=true; // enable or disable special field 2 $GBfield2=true; // enable or disable special field 2
$GBfield3=true; // enable or disable special field 3 $GBfield3=true; // enable or disable special field 3
$GBemailfield=true; // enable or disable email field
$Titles["HeadTitle"]="Guestbook"; $Titles["HeadTitle"]="Guestbook";
$Titles["Page"]="Guestbook"; $Titles["Page"]="Guestbook";
$Titles["Name"]="Your name"; $Titles["Name"]="Your name";

View File

@ -48,6 +48,7 @@ $GBstickylocked=true; // приклеивать или лочить записи
$GBfield1=true; // включить или отключить специальное поле 1 $GBfield1=true; // включить или отключить специальное поле 1
$GBfield2=true; // включить или отключить специальное поле 2 $GBfield2=true; // включить или отключить специальное поле 2
$GBfield3=true; // включить или отключить специальное поле 3 $GBfield3=true; // включить или отключить специальное поле 3
$GBemailfield=true; // включить или отключить поле электронной почты
$Titles["HeadTitle"]="Гостевая книга"; $Titles["HeadTitle"]="Гостевая книга";
$Titles["Page"]="Гостевая книга"; $Titles["Page"]="Гостевая книга";
$Titles["Name"]="Ваше имя"; $Titles["Name"]="Ваше имя";