Add notifications and new CSS

This commit is contained in:
feder 2017-01-27 13:28:04 +03:00
parent de81fe25dd
commit 5e9f25e430
7 changed files with 211 additions and 14 deletions

4
README
View File

@ -1,8 +1,8 @@
PHPCSV Guestbook version 0.9 PHPCSV Guestbook version 0.92
Simple php guestbook with csv file data storage. Simple php guestbook with csv file data storage.
PHPCSV Guestbook 0.9 requires PHP 5.0 or higher version. PHPCSV Guestbook 0.92 requires PHP 5.0 or higher version.
Installation: Installation:

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Administration program file of PHPCSV Guestbook version 0.9 * Administration program file of PHPCSV Guestbook version 0.92
* See settings.php for configuration. * See settings.php for configuration.
* Edit page.php for change appearance. * Edit page.php for change appearance.
*/ */
@ -124,10 +124,14 @@ if ($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))) {
<head> <head>
<title><?php echo $Titles[HeadTitle];?></title> <title><?php echo $Titles[HeadTitle];?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu:regular&amp;subset=Latin,Cyrillic">
<link rel="stylesheet" type="text/css" href="anthrstlsht.css">
</head> </head>
<body> <body>
<div class="container">
<?php AdminHeaderView();?> <?php AdminHeaderView();?>
<hr> <hr>
<?php AdminEntriesView();?> <?php AdminEntriesView();?>
</div>
</body> </body>
</html> </html>

166
anthrstlsht.css Normal file
View File

@ -0,0 +1,166 @@
/**
* anthrstlsht.css (another style sheet) v0.8
* https://github.com/zlaxy/anthrstlsht
* DWTWL 2.5 license: https://soundragon.su/license/license.html
* fonts connection: http://font.ubuntu.com/web/ , for example:
* <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:regular&subset=Latin,Cyrillic">
*/
html {
font-family: sans-serif;
}
body {
margin: 0;
font-family: Ubuntu, sans-serif;
color: #222;
}
.container {
width: 95%;
margin: auto;
}
div.entry {
border: #eee solid 1px;
box-shadow: 4px 4px 10px #ddd;
}
div.messages_header {
border-bottom: 1px solid #eee;
}
font.text {
color: #000;
color: rgba(0, 0, 0, 0);
}
h1, h2, h3, h4 {
margin-top: 0;
margin-bottom: 0;
font-weight: 500;
}
h1 {
font-size: 3.6rem;
}
h2 {
font-size: 3.2rem;
}
h3 {
font-size: 2.6rem;
}
h4 {
font-size: 2.0rem;
}
hr {
border-width: 0;
border-top: 1px solid #bbb;
}
p {
margin-top: 0;
margin-bottom: 0;
}
img {
border: 0;
}
.button,
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
padding: 0 20px;
color: #555;
text-align: center;
font-family: Ubuntu, sans-serif;
font-weight: 800;
line-height: 28px;
background-color: transparent;
border-radius: 6px;
border: 1px solid #bbb;
cursor: pointer;
}
.button:hover,
button:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
input[type="submit"]:hover,
.button:focus,
button:focus,
input[type="button"]:focus,
input[type="reset"]:focus,
input[type="submit"]:focus {
color: #333;
border-color: #999;
outline: 0;
}
button[disabled],
html input[disabled] {
cursor: default;
}
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea,
select {
height: 28px;
padding: 3px 5px;
border: 1px solid #bbb;
border-radius: 6px;
box-shadow: none;
}
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
border: 1px solid #888;
outline: 0;
}
code {
font-family: monospace, monospace;
padding: .2rem .2rem;
font-size: 80%;
background: #eee;
white-space: pre;
border: 1px solid #ccc;
border-radius: 6px;
}
ul {
list-style: circle;
}
ol, ul, li {
margin-top: 0;
margin-bottom: 0;
}
button,
.button,
input,
textarea,
select,
fieldset {
margin-bottom: .1rem;
}

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Main program file of PHPCSV Guestbook version 0.9 * Main program file of PHPCSV Guestbook version 0.92
* See settings.php for configuration. * See settings.php for configuration.
* Edit page.php for change appearance. * Edit page.php for change appearance.
* See license.txt for licensing information. * See license.txt for licensing information.
@ -8,6 +8,18 @@
session_start(); session_start();
include "settings.php"; include "settings.php";
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];
mail($GBnotificationmailto, $Titles[MailSubject], $message,
"From: ".$GBnotificationmailfrom." \r\n"."Content-type: text/plain; charset=utf-8\r\n"
."X-Mailer: PHP/".phpversion());
}
function ReadEntries() { function ReadEntries() {
global $GBdata; global $GBdata;
global $DataStatus; global $DataStatus;
@ -56,7 +68,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 color=\"transparent\">$captchanumber11</font><font>$captchanumber11</font><font>$captchanumber12</font> $Titles[CaptchaPlus] <font>$captchanumber21</font><font>$captchanumber22</font><font color=\"transparent\">$captchanumber21</font> = <input type=text name=\"captcha\" size=2 maxlength=2> ?<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";
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";
@ -73,16 +85,16 @@ function EntriesView() {
else { else {
$Entries=array_reverse($Entries); $Entries=array_reverse($Entries);
foreach($Entries as $e=>$Entry) { foreach($Entries as $e=>$Entry) {
echo " ",$Entry[7],". "; echo " <div class=\"entry\"><div class=\"messages_header\"><h4>",$Entry[7],". ";
if ($Entry[2]) echo "<a href=\"$Entry[2]\">"; if ($Entry[2]) echo "<a href=\"$Entry[2]\">";
echo "<b>",$Entry[0],"</b>"; echo "<b>",$Entry[0],"</b>";
if ($Entry[2]) echo "</a>"; if ($Entry[2]) echo "</a>";
if ($Entry[1]) echo " ",$Titles[From]," <b>",$Entry[1],"</b>"; if ($Entry[1]) echo " ",$Titles[From]," <b>",$Entry[1],"</b>";
echo ", ",date("j.m.Y, H:i",$Entry[5]),", ",$Titles[Wrote],":<br>\n"; echo ", ",date("j.m.Y, H:i",$Entry[5]),", ",$Titles[Wrote],":</div></h4><br>\n";
echo " ",nl2br($Entry[4]),"<br>\n"; echo " ",nl2br($Entry[4]),"<br>\n";
if ($Entry[6]) echo "<br><i><b>$Titles[Response]:</b><br>\n"; if ($Entry[6]) echo "<br><i><b>$Titles[Response]:</b><br>\n";
if ($Entry[6]) echo nl2br($Entry[6]),"</i><br>\n"; if ($Entry[6]) echo nl2br($Entry[6]),"</i><br>\n";
echo "<hr>\n"; echo "</div><hr>\n";
} }
} }
} }
@ -91,8 +103,10 @@ if($_POST['submit']) {
if(!$_POST['text']) $PageStatus="emptytext"; if(!$_POST['text']) $PageStatus="emptytext";
if(!$_POST['name']) $PageStatus="emptyname"; if(!$_POST['name']) $PageStatus="emptyname";
if(($_POST['name'])&&($_POST['text'])) if(($_POST['name'])&&($_POST['text']))
if ($_POST["captcha"]&&(md5(base64_encode($_POST["captcha"]))==$_SESSION["captcha"])) AddEntry(); if ($_POST["captcha"]&&(md5(base64_encode($_POST["captcha"]))==$_SESSION["captcha"])) {
else $PageStatus="wrongcaptcha"; AddEntry();
if ($GBnotificationmailto) SendMail();
} else $PageStatus="wrongcaptcha";
if (($PageStatus)&&!($PageStatus=="added")) { if (($PageStatus)&&!($PageStatus=="added")) {
$SESSION["value"]["name"]=$_POST['name']; $SESSION["value"]["name"]=$_POST['name'];
$SESSION["value"]["from"]=$_POST['from']; $SESSION["value"]["from"]=$_POST['from'];

View File

@ -1,17 +1,22 @@
<?php <?php
/** /**
* Main page of PHPCSV Guestbook version 0.9 * Main page of PHPCSV Guestbook version 0.92
* See settings.php for configuration. * See settings.php for configuration.
* For changing appearance you can edit this file like simple html. For example: add css tags. * For changing appearance you can edit this file like simple html. For example: add css tags.
*/ */
?><html> ?><!DOCTYPE html>
<html>
<head> <head>
<title><?php echo $Titles[HeadTitle];?></title> <title><?php echo $Titles[HeadTitle];?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Ubuntu:regular&amp;subset=Latin,Cyrillic">
<link rel="stylesheet" type="text/css" href="anthrstlsht.css">
</head> </head>
<body> <body>
<div class="container">
<?php AddEntryView();?> <?php AddEntryView();?>
<hr> <hr>
<?php EntriesView();?> <?php EntriesView();?>
</div>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Settings file of PHPCSV Guestbook version 0.9 * Settings file of PHPCSV Guestbook version 0.92
* Edit page.php for change appearance. * Edit page.php for change appearance.
* $GBdata parameter for changing entries data file. * $GBdata parameter for changing entries data file.
* Please, change $GBadmin and $GBpassword parameters for access to administration page. * Please, change $GBadmin and $GBpassword parameters for access to administration page.
@ -10,6 +10,8 @@
$GBdata="gbdb.csv"; $GBdata="gbdb.csv";
$GBadmin="root"; $GBadmin="root";
$GBpassword="password"; $GBpassword="password";
$GBnotificationmailto=""; // leave empty if you don't want send notification
$GBnotificationmailfrom="";
$Titles[HeadTitle]="Guestbook"; $Titles[HeadTitle]="Guestbook";
$Titles[Page]="Guestbook"; $Titles[Page]="Guestbook";
$Titles[Name]="Your name"; $Titles[Name]="Your name";
@ -47,4 +49,6 @@ $Titles[AdminDelete]="Delete";
$Titles[AdminCancel]="Cancel"; $Titles[AdminCancel]="Cancel";
$Titles[AdminSureDel]="Are you sure to delete"; $Titles[AdminSureDel]="Are you sure to delete";
$Titles[AdminSureDelMessages]="messages"; $Titles[AdminSureDelMessages]="messages";
$Titles[MailSubject]="New entry in your guestbook";
$Titles[MailAdmin]="You can edit, delete or reply this message via admin page";
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Russian version of settings file PHPCSV Guestbook version 0.9 * Russian version of settings file PHPCSV Guestbook version 0.92
* Для руссификации гостевой книги замените оригинальный settings.php на содержимое этого файла. * Для руссификации гостевой книги замените оригинальный settings.php на содержимое этого файла.
* Редактируйте page.php для изменения внешнего вида. * Редактируйте page.php для изменения внешнего вида.
* $GBdata параметр служит для смены файла данных записей гостевой книги. * $GBdata параметр служит для смены файла данных записей гостевой книги.
@ -11,6 +11,8 @@
$GBdata="gbdb.csv"; $GBdata="gbdb.csv";
$GBadmin="root"; $GBadmin="root";
$GBpassword="password"; $GBpassword="password";
$GBnotificationmailto=""; // оставьте поле пустым, если не хотите отправки уведомлений о новых записях
$GBnotificationmailfrom="";
$Titles[HeadTitle]="Гостевая книга"; $Titles[HeadTitle]="Гостевая книга";
$Titles[Page]="Гостевая книга"; $Titles[Page]="Гостевая книга";
$Titles[Name]="Ваше имя"; $Titles[Name]="Ваше имя";
@ -48,4 +50,6 @@ $Titles[AdminDelete]="Удалить";
$Titles[AdminCancel]="Отменить"; $Titles[AdminCancel]="Отменить";
$Titles[AdminSureDel]="Вы уверены, что хотите удалить"; $Titles[AdminSureDel]="Вы уверены, что хотите удалить";
$Titles[AdminSureDelMessages]="сообщений"; $Titles[AdminSureDelMessages]="сообщений";
$Titles[MailSubject]="Новая запись в вашей гостевой книге";
$Titles[MailAdmin]="Вы можете редактировать, удалить или ответить на эту запись через страницу администрирования";
?> ?>