";
clearoldadmins();
showmenu();
// admin stuff
if ($do=="admin") {
if ($action=="login"){
if ($name==$adminname && $pwd==$adminpwd){
include($log);
$fp=fopen($log, "w");
fputs($fp, "\n");
$i=0;
if (count($admins)>0){
foreach ($admins as $line){
fputs($fp, "\$admins[$i]['time']=".$line['time']."; \$admins[$i]['hash']='".$line['hash']."';\n");
$i++;
}
}
fputs($fp, "\$admins[$i]['time']=".$now."; \$admins[$i]['hash']='".md5($hash)."';\n?>");
fclose($fp);
echo "";
}
}
if ($action=="delete" && isloggedin()){
$todel=getkey($id, $stuff);
unset($stuff->data[$todel]);
$stuff->msort();
saveposts($stuff);
$do="view";
}else{
?>
}
}
// sign post
if ($do=="sign"){
if ($action=="save"){
$error=false;
$saveit=false;
if ($name=="") $error.=" » $txtbadname"; if ($email!=""){ if (!validemail($email)) $error.=" » $txtbademail"; } if ($msg=="") $error.=" » $txtbadmsg"; if ($error===false){ if ($id=="new"){ $index=$numposts; $id=$nextindex; $time=$now; $saveit=true; }else if (isloggedin() && is_numeric($id)){ $index=getkey($id, $stuff); $saveit=true; } if ($saveit){ $stuff->data[$index]['id']=$id; $stuff->data[$index]['time']=$time; $stuff->data[$index]['name']=htmlentities(strip_tags($name), ENT_QUOTES); $stuff->data[$index]['email']=strip_tags($email); if ($www!="http://") $stuff->data[$index]['www']=strip_tags($www); else $stuff->data[$index]['www']=""; $stuff->data[$index]['post']=str_replace(array("\r", "\n"), array("", " "), htmlentities(strip_tags($msg), ENT_QUOTES)); saveposts($stuff); $stuff->msort(); $empty=false; } $do="view"; }else echo " $txterrors$error ";
}else{
if ($action=="edit" && isloggedin()){
$post=$stuff->data[getkey($id, $stuff)];
$name= html_entity_decode($post['name'], ENT_QUOTES);
$email=$post['email'];
$www=$post['www'];
$msg=stripslashes(str_replace("$txtclickback ", "\n", html_entity_decode($post['post'], ENT_QUOTES))); $time=$post['time']; }else{ $name=""; $email=""; $www=""; $msg=""; $time="notset"; $id="new"; } ?> } } // display posts if ($do=="view" || !isset($do)){ if (!$empty){ $tpl=implode("", file($template)); $i=1; foreach($stuff->data as $post){ if ($post['id']!=0 && $i>=$from && $i< ($from+$ppp) ){ $post['post']=str_ireplace($badwords, "******", $post['post']); $match=array("{name}", "{time}", "{website}", "{post}", "{edit}", "{delete}"); if (isloggedin()) $replace=array( ($post['email']!="") ? "".$post['name']."" : $post['name'], date("d. M Y", $post['time']), ($post['www']!="") ? "Website" : "", stripslashes($post['post']), "$txtedit", "$txtdelete" ); else $replace=array( ($post['email']!="") ? "".$post['name']."" : $post['name'], date("d. M Y", $post['time']), ($post['www']!="") ? "Website" : "", stripslashes($post['post']), "", "" ); $html.=str_replace($match, $replace, $tpl); } $i++; } echo $html; $numpages=(fmodAddOn($numposts,$ppp)>0) ? floor($numposts/$ppp)+1 : ($numposts/$ppp); echo ""; } } function fmodAddOn($x,$y) { $i = floor($x/$y); // r = x - i * y return $x - $i*$y; } // closing table tags // Please don't remove the 'powered by...' link echo " |
Powered by SignMe $version |