check_captcha($_POST['captcha'], $_POST['captcha_hash'])) $run=1; } if($run) { safe_query("INSERT INTO ".PREFIX."guestbook (date, name, email, hp, icq, ip, comment) values('$date', '".$name."', '".$email."', '".$url."', '".$icq."', '$ip', '".$_POST['message']."')"); if($gb_info) { $ergebnis=safe_query("SELECT userID FROM ".PREFIX."user_groups WHERE feedback='1'"); while($ds=mysql_fetch_array($ergebnis)) { $touser[]=$ds[userID]; } $message = '[b]There is a new guestbook entry![/b] [URL=index.php?site=guestbook#'.mysql_insert_id().']Click here[/URL] '; foreach($touser as $id) { sendmessage($id,'New guestbook comment',$message); } } } header("Location: index.php?site=guestbook"); } elseif($_GET['delete']) { include("_mysql.php"); include("_settings.php"); include("_functions.php"); if(!isanyadmin($userID)) die('no access!'); foreach($_POST['gbID'] as $id) { safe_query("DELETE FROM ".PREFIX."guestbook WHERE gbID='$id'"); } header("Location: index.php?site=guestbook"); } elseif($_POST['savecomment']) { include("_mysql.php"); include("_settings.php"); include("_functions.php"); if(!isfeedbackadmin($userID)) die('no access!'); safe_query("UPDATE ".PREFIX."guestbook SET admincomment='".$_POST['comment']."' WHERE gbID='".$_POST['guestbookID']."' "); redirect('index.php?site=guestbook','',0); } elseif($_GET['action'] == 'comment') { if(!isfeedbackadmin($userID)) die('no access!'); $ergebnis = safe_query("SELECT admincomment FROM ".PREFIX."guestbook WHERE gbID='".$_GET['guestbookID']."'"); $ds = mysql_fetch_array($ergebnis); eval ("\$title_guestbook = \"".gettemplate("title_guestbook")."\";"); echo $title_guestbook; eval ("\$guestbook_comment = \"".gettemplate("guestbook_comment")."\";"); echo $guestbook_comment; } elseif($_GET['action'] == 'add') { if($_GET['messageID']) { $ds=mysql_fetch_array(safe_query("SELECT comment, name FROM `".PREFIX."guestbook` WHERE gbID='".$_GET['messageID']."'")); $message='[quote]'.$ds['name'].' wrote: [br]'.$ds['comment'].'[/quote]'; } else $message=''; if($loggedin) { eval ("\$guestbook_loggedin = \"".gettemplate("guestbook_loggedin")."\";"); echo $guestbook_loggedin; } else { $CAPCLASS = new Captcha; $captcha = $CAPCLASS->create_captcha(); $hash = $CAPCLASS->get_hash(); $CAPCLASS->clear_oldcaptcha(); eval ("\$guestbook_notloggedin = \"".gettemplate("guestbook_notloggedin")."\";"); echo $guestbook_notloggedin; } } else { eval ("\$title_guestbook = \"".gettemplate("title_guestbook")."\";"); echo $title_guestbook; $gesamt = mysql_num_rows(safe_query("SELECT gbID FROM ".PREFIX."guestbook")); $pages=1; $page = $_GET['page']; $type = $_GET['type']; if(!isset($page)) $page = 1; if(!isset($type)) $type = "DESC"; $max=$maxguestbook; for ($n=$max; $n<=$gesamt; $n+=$max) { if($gesamt>$n) $pages++; } if($pages>1) $page_link = makepagelink("index.php?site=guestbook&type=$type", $page, $pages); if ($page == "1") { $ergebnis = safe_query("SELECT * FROM ".PREFIX."guestbook ORDER BY date $type LIMIT 0,$max"); if($type=="DESC") $n=$gesamt; else $n=1; } else { $start=$page*$max-$max; $ergebnis = safe_query("SELECT * FROM ".PREFIX."guestbook ORDER BY date $type LIMIT $start,$max"); if($type=="DESC") $n = $gesamt-($page-1)*$max; else $n = ($page-1)*$max+1; } if($type=="ASC") $sorter='Sort: '; else $sorter='Sort: '; echo'
'.$sorter.' '.$page_link.' |