📄 guestbook_view.php
字号:
<?php/** Copyright (c) 2004 Heiko Rutenbeck <bzrudi@tuxpower.de>** This program is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** You should have received a copy of the GNU General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/if(!defined('TOP_DIR')) { define('TOP_DIR','../..'); }ini_set('include_path', TOP_DIR); // set in include path because in db_connect.php isn't TOP_DIR used to include adodb.inc.php!include_once(TOP_DIR.'/header.php');$mess_per_page=read_config("gb_max_pages");include_once(TOP_DIR.'/include/left_menu.class.php'); $menu = new LeftMenuView(); $menu->generateTableHead(); $menu->buildMenu(); $menu->generateTableFooter(); ?> <td class='adminpages' colspan='2' style='vertical-align: top;'><?php/** * Guestbook view starts here */if(!isset($_GET['mode'])){$_GET['mode']="view";} // set default to view mesages// no anonymos entry with direct browser call (Thanks to jst71)if((!$passed) && (!$gb_anon_posts)) {$_GET['mode']="view";} /** * Exit if plugin is disabled */exit_if_not_active('guestbook');switch($_GET['mode']){/** * add new guestbook entry*/case("insert"): echo "<script language=\"JavaScript\" type=\"text/javascript\">"; echo "function icon(theicon) {"; echo 'document.form.comment.value += " "+theicon;'; echo 'document.form.comment.focus(); '; echo '} '; echo "</script>"; echo "<div align='center'> <form action='guestbook_view.php?mode=store' name=form method=post> <table cellspacing=0 cellpadding=0 border=0 width='75%' align='center' style='height: 25px;'> <tr> <td class='subfoldertable' width='25%' valign=top align=center><b>".$gb_sign."</b></td> </tr> </table> <table><tr><td></td></tr></table> <table cellspacing=0 cellpadding=0 border=0 width='75%' style='border-collapse: collapse;'> <tr> <td class='subfoldertable' width='25%'>".$gb_name." :</td> <td class='subfoldertable' width='75%'><input type=text name=name value='".htmlspecialchars(@$_SESSION['user_name'],ENT_QUOTES)."'". " maxlength='17'></td> </tr> <tr> <td class='subfoldertable' width='25%'>".$gb_email." :</td> <td class='subfoldertable' width='75%'><input type=text name=email></td> </tr> <tr> <td class='subfoldertable' width='25%'>".$gb_hp." :</td> <td class='subfoldertable' width='75%'><input type=text name=url value=\"http://\"></td> </tr> <tr> <td class='subfoldertable' width='25%'>".$gb_country." :</td> <td class='subfoldertable' width='75%'><input type=text name=country maxlength='15'></td> </tr> <tr> <td class='subfoldertable' width='25%'>".$radio_comment." :</td> <td class='subfoldertable' width='75%'><textarea name=comment cols=40 rows=5></textarea><br>"; include_once(TOP_DIR."/plugins/guestbook/smileys.php"); foreach($smileys as $key=>$value) { echo "<a href=\"javascript:icon('".$value."')\" class='subfoldertable'>"; echo "<img src=\"".TOP_DIR."/plugins/guestbook/images/smileys/".$key.".gif\" border=0 alt='$value'>"; echo "</a>\n"; } ?> <br/><a href="guestbook_view.php?mode=formatting" target="_blank"><?php echo $formatting_possibilities; ?></a> </td></tr></table> <table cellspacing=0 cellpadding=3 border=0 width='98%'> <tr> <td width='75%' height=40 align=center><input type=submit value=" <?php echo $submit_button_folder; ?> "></td> </tr> </table> </form></div><?phpbreak;/** * insert comment (DB action) */case("store"): if(empty($_POST['name']) || empty($_POST['comment'])) { echo "<br><br><br><center>$gb_msg_error". "<form><INPUT TYPE=\"button\"". "STYLE=\"background:#666666; font-size: 12px; font-family: Verdana; font-weight: bold; color:#ffffff\"". "VALUE=\" ".STR_BACK." \" onClick=\"history.go(-1)\"></form></center>"; } else { /** * take care of blacklists before storing. e.g. SPAMblock * (other.php) */ do_blacklist_compare($_POST['comment'], 'guestbook'); /** * Argh, we have to even check username */ do_blacklist_compare($_POST['name'], 'guestbook'); $date=time(); $gb_name = linpha_addslashes(htmlspecialchars($_POST['name'])); $gb_email = linpha_addslashes(htmlspecialchars($_POST['email'])); $gb_country = linpha_addslashes(htmlspecialchars($_POST['country'])); $gb_url = linpha_addslashes(htmlspecialchars($_POST['url'])); $gb_comment = linpha_addslashes($_POST['comment']); // no htmlspecialchars! we use htmltag on output linpha_log('guestbook','notice','Guestbook entry added by '.$gb_name); $insert_entry = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."guestbook ". "(name, email, country, url, comment, date) ". "VALUES('".$gb_name."', '".$gb_email."','".$gb_country."',". "'".$gb_url."','".$gb_comment."','".$date."')"); echo "<script language=\"JavaScript\" type=\"text/javascript\">parent.location=\"guestbook_view.php?mode=view\";</script>"; //Header('Location: guestbook_view.php?mode=view'); }break;/** * the main guestbook view */case("view"): $result = $GLOBALS['db']->Execute("SELECT id FROM ".PREFIX."guestbook"); if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 0; } $no_msg = @$result->RecordCount(); $div=$no_msg%$mess_per_page; if($div=="0") { $num_page=$no_msg/$mess_per_page; }else { $num_page_dec=$no_msg/$mess_per_page; $num_page_dec=explode(".",$num_page_dec); $num_page=$num_page_dec[0]+1; } echo "<table cellspacing=0 cellpadding=0 border=0 width='98%'> <tr><td width='98%' height=60 align=center class='viewimage'> <b>".$num_page."</b> ".$gb_pages." , <b>".$no_msg."</b> ".$gb_messages."<br><br>"; // page register if($page!="0") { $backward=$page-1; echo "<a href='guestbook_view.php?mode=view&page=0'> <img src='".TOP_DIR."/plugins/guestbook/images/bbw.gif' border=0 alt='first page'></a> <a href='guestbook_view.php?mode=view&page={$backward}'> <img src='".TOP_DIR."/plugins/guestbook/images/bw.gif' border=0 alt='previous page'></a> "; } if($page==($num_page-1)){$term=$page;if($num_page<3){$beg=$page-1;}else{$beg=$page-2;}}else{$term=$page+1;$beg=$page-1;} if($page==0){$term=$page+2;$beg=$page;} if($num_page<=$term){$term=$num_page-1;}else{} for($i=$beg;$i<=$term;$i++){ $page_show=$i+1; if($i==$page){echo "(<b>$page_show</b>)";} else{echo "[<a href='guestbook_view.php?mode=view&page={$i}'><b>".$page_show."</b></a>]";} } if($num_page>1){ if($page==($num_page-1)) { $forward=""; } else { $end=$num_page-1; $forward=$page+1; echo "<a href='guestbook_view.php?mode=view&page={$forward}'> <img src='".TOP_DIR."/plugins/guestbook/images/fw.gif' border=0 alt='next page'></a> <a href='guestbook_view.php?mode=view&page={$end}'> <img src='".TOP_DIR."/plugins/guestbook/images/ffw.gif' border=0 alt='last page'></a> "; } } echo "</td></tr></table>"; // allow insert only in case of login or guest writing (Thanks to jst71) if(($passed) || ($gb_anon_posts)) { echo "<b>::<a href='guestbook_view.php?mode=insert'> ".$gb_new_msg."</a> ::</b><br><hr noshade>"; } $limit=$mess_per_page*$page; $posts_order=read_config('gb_posts_order'); $query = $GLOBALS['db']->SelectLimit("SELECT id,name, email, country, url, comment, date ". "FROM ".PREFIX."guestbook ". "ORDER BY date ".$posts_order ,$mess_per_page, $limit); echo "<table cellspacing=0 cellpadding=2 border=0 width='98%'><tr><td width='100%'></td></tr></table>"; echo "<table cellspacing=0 cellpadding=2 border=0 width='98%'>"; while($row=$query->FetchRow(ADODB_FETCH_ASSOC)) { // Name $name=stripslashes($row["name"]); // Email $email=$row["email"]; if($email=="") { $aut="<b>$name</b>";$mailico=""; } elseif(!empty($email) && strpos($email,'@') !== false) { $pieces = explode ("@", $email); $aut = '<script language="JavaScript" type="text/javascript"> <!-- var email2 = "'.$pieces[1].'"; var email1 = "'.$pieces[0].'"; var email = email1+"@"+email2; document.write(\'<a href="mailto:\'+email+\'"><b>'.$name.'</b></a>\'); //--> </script> <NOSCRIPT>NOSPAM_'.str_replace('@',' _ AT _ ',$email).'</NOSCRIPT>'; $mailico = '<script language="JavaScript" type="text/javascript"> <!-- document.write(\'<a href="mailto:\'+email+\'"><img src='.TOP_DIR.'/plugins/guestbook/images/mail.gif border=0></a>\'); //--> </script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -