";
else $NewEntry[text]=$_POST['text'];
$NewEntry[datetime]=time();
$NewEntry[response]="";
$fhandle=fopen($GBdata,"a");
fputcsv($fhandle,$NewEntry);
fclose($fhandle);
$PageStatus="added";
$_SESSION['captcha']="";
}
function AddEntryView() {
global $Titles;
global $Values;
global $PageStatus;
global $GBcaptcha;
global $GBtextlenght;
global $GBupload;
echo "
",$Titles[Page],"
\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 "\n";
if ($PageStatus=="emptyname") echo "$Titles[EmptyName] \n";
if ($PageStatus=="emptytext") echo "$Titles[EmptyText] \n";
if ($PageStatus=="wrongimage") echo "$Titles[WrongImage] \n";
if ($PageStatus=="wrongcaptcha") echo "$Titles[WrongCaptcha] \n";
}
}
function Search($SearchQuery) {
$Entries=ReadEntries();
$SearchResultCount=0;
$SearchResult=false;
foreach($Entries as $e=>$Entry) {
for($p=0; $p<7; $p++) {
if (mb_stristr($Entry[$p],$SearchQuery)) {
$SearchResult[$SearchResultCount][0]=$e;
$SearchResult[$SearchResultCount][1]=$Entry;
$SearchResultCount++;
break;
}
}
}
return $SearchResult;
}
function AddSearchBar() {
global $Titles;
global $GBsearch;
if ($GBsearch) {
echo "";
}
}
function EntriesView() {
global $Titles;
global $DataStatus;
global $Entries;
global $GBpagination;
global $GBreadmore;
if ($DataStatus=="empty") echo "$Titles[EmptyFile]";
else if($_POST['search']&&$_POST['serachq']) {
$SearchResult=Search($_POST['serachq']);
if ($SearchResult) {
$GBpagination=0;
unset($Entries);
foreach($SearchResult as $n=>$Entry) $Entries[$n]=$Entry[1];
} else echo "$Titles[NoResult]: '",$_POST['serachq'],"'. \n";
}
if (($GBpagination>0)&&(count($Entries)>$GBpagination)) {
$Entries=array_reverse($Entries);
if ($_GET['page']) switch ($_GET['page']) {
case $Titles[First]:
$CurrentPage=0;
break;
case $Titles[Last]:
$CurrentPage=intdiv((count($Entries)-1),$GBpagination);
break;
case "$Titles[Previous]":
$CurrentPage=$_SESSION['currentpage']-1;
break;
case "$Titles[Next]":
$CurrentPage=$_SESSION['currentpage']+1;
break;
default:
$CurrentPage=$_GET['page']-1;
}
else $CurrentPage=0;
for ($e = ($GBpagination*$CurrentPage); $e < ($GBpagination*($CurrentPage+1)); $e++) {
if ($e>=count($Entries)) break;
echo "
",$Entries[$e][7],". ";
if ($Entries[$e][2]) echo "";
echo "",$Entries[$e][0],"";
if ($Entries[$e][2]) echo "";
if ($Entries[$e][1]) echo " ",$Titles[From]," ",$Entries[$e][1],"";
echo ", ",date("j.m.Y, H:i",$Entries[$e][5]),", ",$Titles[Wrote],":