$Entry) {
unset($Entry[7]);
fputcsv($fhandle,$Entry);
}
fclose($fhandle);
}
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 (!(($_SESSION["EditStatus"]) or ($_SESSION["DeleteStatus"]=="deletion"))) if ($GBsearch) {
echo "
";
}
}
function AdminHeaderView() {
global $Titles;
global $GBadmin;
global $GBpassword;
echo "\n";
if ($_SESSION["SessionStatus"]==(md5($GBadmin.$GBpassword))) {
echo "",AddSearchBar(),"
";
echo "\n";
echo " $Titles[AdminHello], $GBadmin!\n";
}
}
function AdminEntriesView() {
global $Titles;
global $DataStatus;
global $GBadmin;
global $GBpassword;
global $AdminEntries;
global $GBpagination;
global $GBtextlenght;
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";
echo "\n";
} else if ($_SESSION["EditStatus"]) {
echo " $Titles[AdminMessage] ", ($_SESSION["EditStatus"]),", ",date("j.m.Y, H:i",$AdminEntries[($_SESSION["EditStatus"]-1)][5]),":
\n";
echo "\n";
} else {
if($_POST['search']&&$_POST['serachq']) {
$SearchResult=Search($_POST['serachq']);
if ($SearchResult) {
$GBpagination=0;
unset($AdminEntries);
foreach($SearchResult as $n=>$Entry) $AdminEntries[$n]=$Entry[1];
} else echo "$Titles[NoResult]: '",$_POST['serachq'],"'.
\n";
}
if (($GBpagination>0)&&(count($AdminEntries)>$GBpagination)) {
$Entries=array_reverse($AdminEntries);
if ($_GET['page']) switch ($_GET['page']) {
case $Titles[First]:
$CurrentPage=0;
break;
case $Titles[Last]:
$CurrentPage=intdiv(count($Entries),$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;
echo "\n";
echo "