Added ability to enable/disable captcha
This commit is contained in:
parent
4c4d09a953
commit
3e16941936
2
README
2
README
|
@ -1,4 +1,4 @@
|
||||||
PHPCSV Guestbook version 0.95
|
PHPCSV Guestbook version 0.96
|
||||||
|
|
||||||
Simple php guestbook with csv file data storage.
|
Simple php guestbook with csv file data storage.
|
||||||
|
|
||||||
|
|
10
index.php
10
index.php
|
@ -55,6 +55,7 @@ function AddEntryView() {
|
||||||
global $Titles;
|
global $Titles;
|
||||||
global $Values;
|
global $Values;
|
||||||
global $PageStatus;
|
global $PageStatus;
|
||||||
|
global $GBcaptcha;
|
||||||
echo "<h2>",$Titles[Page],"</h2><br>\n";
|
echo "<h2>",$Titles[Page],"</h2><br>\n";
|
||||||
if ($PageStatus=="added") echo "$Titles[Added]"; else {
|
if ($PageStatus=="added") echo "$Titles[Added]"; else {
|
||||||
$captchanumber11=rand(1, 4);
|
$captchanumber11=rand(1, 4);
|
||||||
|
@ -68,7 +69,7 @@ function AddEntryView() {
|
||||||
echo " $Titles[Link]: <input type=text name=\"link\" value=\"",$Values["link"],"\" 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[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=7168>",$Values["text"],"</textarea><br>\n";
|
echo " $Titles[Text]:<br>\n <textarea name=\"text\" wrap=virtual cols=50 rows=5 maxlength=7168>",$Values["text"],"</textarea><br>\n";
|
||||||
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";
|
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 " <input type=submit name=\"submit\" value=\"$Titles[Submit]\">\n";
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
if ($PageStatus=="emptyname") echo "$Titles[EmptyName]<br>\n";
|
if ($PageStatus=="emptyname") echo "$Titles[EmptyName]<br>\n";
|
||||||
|
@ -126,7 +127,7 @@ function EntriesView() {
|
||||||
$CurrentPage=0;
|
$CurrentPage=0;
|
||||||
break;
|
break;
|
||||||
case $Titles[Last]:
|
case $Titles[Last]:
|
||||||
$CurrentPage=intdiv(count($Entries),$GBpagination);
|
$CurrentPage=intdiv((count($Entries)-1),$GBpagination);
|
||||||
break;
|
break;
|
||||||
case "$Titles[Previous]":
|
case "$Titles[Previous]":
|
||||||
$CurrentPage=$_SESSION['currentpage']-1;
|
$CurrentPage=$_SESSION['currentpage']-1;
|
||||||
|
@ -151,7 +152,7 @@ function EntriesView() {
|
||||||
if ($Entries[$e][6]) echo nl2br($Entries[$e][6]),"</i><br>\n";
|
if ($Entries[$e][6]) echo nl2br($Entries[$e][6]),"</i><br>\n";
|
||||||
echo "</div><hr>\n";
|
echo "</div><hr>\n";
|
||||||
}
|
}
|
||||||
echo "<form action=\".\" method=\"get\">\n";
|
echo "<form action=index.php method=\"get\">\n";
|
||||||
if ($CurrentPage>0) {
|
if ($CurrentPage>0) {
|
||||||
echo " <input type=\"submit\" value=\"$Titles[First]\" name=\"page\"/>\n";
|
echo " <input type=\"submit\" value=\"$Titles[First]\" name=\"page\"/>\n";
|
||||||
echo " <input type=\"submit\" value=\"$Titles[Previous]\" name=\"page\"/>\n";
|
echo " <input type=\"submit\" value=\"$Titles[Previous]\" name=\"page\"/>\n";
|
||||||
|
@ -194,6 +195,9 @@ if($_POST['submit']) {
|
||||||
if ($_POST["captcha"]&&(md5(base64_encode($_POST["captcha"]))==$_SESSION["captcha"])) {
|
if ($_POST["captcha"]&&(md5(base64_encode($_POST["captcha"]))==$_SESSION["captcha"])) {
|
||||||
AddEntry();
|
AddEntry();
|
||||||
if ($GBnotificationmailto) SendMail();
|
if ($GBnotificationmailto) SendMail();
|
||||||
|
} else if (!$GBcaptcha) {
|
||||||
|
AddEntry();
|
||||||
|
if ($GBnotificationmailto) SendMail();
|
||||||
} else $PageStatus="wrongcaptcha";
|
} else $PageStatus="wrongcaptcha";
|
||||||
if (($PageStatus)&&!($PageStatus=="added")) {
|
if (($PageStatus)&&!($PageStatus=="added")) {
|
||||||
$SESSION["value"]["name"]=$_POST['name'];
|
$SESSION["value"]["name"]=$_POST['name'];
|
||||||
|
|
|
@ -12,6 +12,7 @@ $GBadmin="root";
|
||||||
$GBpassword="password";
|
$GBpassword="password";
|
||||||
$GBpagination=10; // pagination for entries, 0 - disabled
|
$GBpagination=10; // pagination for entries, 0 - disabled
|
||||||
$GBsearch=true; // enable or disable search bar
|
$GBsearch=true; // enable or disable search bar
|
||||||
|
$GBcaptcha=true; // enable or disable captcha
|
||||||
$GBnotificationmailto=""; // leave empty if you don't want send notification
|
$GBnotificationmailto=""; // leave empty if you don't want send notification
|
||||||
$GBnotificationmailfrom="";
|
$GBnotificationmailfrom="";
|
||||||
$Titles[HeadTitle]="Guestbook";
|
$Titles[HeadTitle]="Guestbook";
|
||||||
|
|
|
@ -12,7 +12,8 @@ $GBdata="gbdb.csv";
|
||||||
$GBadmin="root";
|
$GBadmin="root";
|
||||||
$GBpassword="password";
|
$GBpassword="password";
|
||||||
$GBpagination=10; // количество записей на странице, 0 - все записи на одной странице
|
$GBpagination=10; // количество записей на странице, 0 - все записи на одной странице
|
||||||
$GBsearch=true; // включение или отключения строки поиска
|
$GBsearch=true; // включение или отключение строки поиска
|
||||||
|
$GBcaptcha=true; // включение или отключение капчи
|
||||||
$GBnotificationmailto=""; // оставьте поле пустым, если не хотите отправки уведомлений о новых записях
|
$GBnotificationmailto=""; // оставьте поле пустым, если не хотите отправки уведомлений о новых записях
|
||||||
$GBnotificationmailfrom="";
|
$GBnotificationmailfrom="";
|
||||||
$Titles[HeadTitle]="Гостевая книга";
|
$Titles[HeadTitle]="Гостевая книга";
|
||||||
|
|
Loading…
Reference in New Issue