⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guestbook.php

📁 phpBook 是個建立於 PHP 及 MySQL 的留言板。 功能包括: -- 內建多種語法 (包括中文) -- IP 封鎖及禁止存取 -- 可自訂表情符號 -- URL-Code
💻 PHP
📖 第 1 页 / 共 3 页
字号:
    echo "             </td>\n";
    echo "            </tr>\n";
    echo "           </table>\n";
    echo "           <div class=\"maintext\">\n";

    #  Start with Output
    #################################################################################################

    echo "<table align=\"center\"  cellspacing=\"0\" cellpadding=\"3\" width=\"100%\" border=\"0\">\n";
    echo "<tr><td><div class=\"maincatnav\">\n";
    echo "$gb_desc<br>\n";
    echo "</div></td>\n";

    #  Calculate Page-Numbers
    #################################################################################################

    if (empty($perpage)) $perpage = 1;
    if (empty($pperpage)) $pperpage = 9;	//!!! ONLY 5,7,9,11,13 !!!!
    if (empty($sort)) $sort = "desc";
    if (empty($offset)) $offset = 0;
    if (empty($poffset)) $poffset = 0;
    $amount = mysql_db_query($database, "SELECT count(*) FROM guestbook");
    $amount_array = mysql_fetch_array($amount);
    $pages = ceil($amount_array["0"] / $perpage);
    $actpage = ($offset+$perpage)/$perpage;
    $maxoffset = ($pages-1)*$perpage;
    $maxpoffset = $pages-$pperpage;
    $middlepage=($pperpage-1)/2;
    if ($maxpoffset<0) {$maxpoffset=0;}
    echo "<td><div class=\"mainpages\">\n";
    if ($pages) {                                       // print only when pages > 0
        echo "$ad_pages\n";
	if ($offset) {
    	    $noffset=$offset-$perpage;
            $npoffset = $noffset/$perpage-$middlepage;
	    if ($npoffset<0) {$npoffset=0;}
            if ($npoffset>$maxpoffset) {$npoffset = $maxpoffset;}
	    echo "[<a href=\"$PHP_SELF?offset=0&poffset=0$adminlink\"><<</a>] ";
	    echo "[<a href=\"$PHP_SELF?offset=$noffset&poffset=$npoffset$adminlink\"><</a>] ";
    	}
        for($i = $poffset; $i< $poffset+$pperpage && $i < $pages; $i++) {
	    $noffset = $i * $perpage;
    	    $npoffset = $noffset/$perpage-$middlepage;
    	    if ($npoffset<0) {$npoffset = 0;}
    	    if ($npoffset>$maxpoffset) {$npoffset = $maxpoffset;}
	    $actual = $i + 1;
    	    if ($actual==$actpage) {
 		echo "(<b>$actual</b>) ";
            } else {
 		echo "[<a href=\"$PHP_SELF?offset=$noffset&poffset=$npoffset$adminlink\">$actual</a>] ";
	    }
	}
	if ($offset+$perpage<$amount_array["0"]) {
    	    $noffset=$offset+$perpage;
    	    $npoffset = $noffset/$perpage-$middlepage;
    	    if ($npoffset<0) {$npoffset=0;}
    	    if ($npoffset>$maxpoffset) {$npoffset = $maxpoffset;}
	    echo "[<a href=\"$PHP_SELF?offset=$noffset&poffset=$npoffset$adminlink\">></a>] ";
	    echo "[<a href=\"$PHP_SELF?offset=$maxoffset&poffset=$maxpoffset$adminlink\">>></a>] ";
        }
    }
    echo "</div></td></tr>\n";
    echo "</table>\n";

    #  Start the Page
    #################################################################################################

    echo "<table align=\"center\"  cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" border=\"0\">\n";
    echo "   <tr>\n";
    echo "     <td class=\"gbheader\">$gb_name</td>\n";
    echo "     <td class=\"gbheader\">$gb_comments</td>\n";
    echo "   </tr>\n";

    #  Get actions for current page
    #################################################################################################

    $result = mysql_db_query($database, "SELECT * FROM guestbook ORDER by id $sort LIMIT $offset, $perpage");
    while ($db = mysql_fetch_array($result)) {

    if ($dateformat=="eu")
 {					// European Date & Timeformat
        $when = strftime("%d.%m.%Y %H:%M", $db["timestamp"]);
    } else {							// US  Date & Timeformat
	$when = strftime("%m/%d/%Y %I:%M %p", $db["timestamp"]);
    }

    if ($db[email]   != "none") {
	$email = "<a href=\"mailto:".$db[email]."\"><img src=\"$image_dir/icons/email.gif\" alt=\"$send_email\" border=\"0\" align=\"right\"></a>";
	} else {
	$email = "";
	}
    if ($db[icq]     != 0)      {
	$icq = "<a href=\"http://wwp.icq.com/scripts/contact.dll?msgto=$db[icq]\"><img src=\"http://wwp.icq.com/scripts/online.dll?icq=" . $db[icq] . "&img=5\" alt=\"$icq_message\" border=\"0\" align=\"right\" height=\"17\"></a>";
	} else {
	$icq = "";
	}
    if ($db[http]    != "none") {
	$http = "<a href=\"http://$db[http]\" target=\"_blank\"><img src=\"$image_dir/icons/home.gif\" alt=\"$view_homepage\" border=\"0\" align=\"right\"></a>";
	} else {
	$http = "";
	}
    if ($db[ip]      != "none") {
       if ($admin==$adminpass) {
	  $ip = "<img src=\"$image_dir/icons/ip.gif\" alt=\"".$db[ip]."\" align=\"left\">";
       } else {
	  $ip = "<img src=\"$image_dir/icons/ip.gif\" alt=\"$ip_logged\" align=\"left\">";
       }
    } else {
	$ip = "";
    }
    if ($db[location]!= "none") {
	$location = "$gb_location<br>$db[location]<br>";
	} else {
	$location = "<br><br>";
	}
    if ($db[browser]      != "") {
	$browser = "<img src=\"$image_dir/icons/browser.gif\" alt=\"$db[browser]\" align=\"left\">";
	} else {
	$browser = "";
	}
    echo "  <tr>\n";
    echo "     <td class=\"gbtable1\">\n";
    echo "        <div class=\"mainname\">$db[name]</div><br>\n";
    echo "        <div class=\"smallleft\">$location<br></div>\n";
    echo "        <br>$icq $http $email $ip $browser\n";
    echo "     </td>\n";
    echo "        <td class=\"gbtable2\"><div class=\"smallleft\">\n";
    if ($admin==$adminpass) {
        echo "<a href=\"$PHP_SELF?action=submit&delid=$db[id]&offset=$offset&poffset=$poffset$adminlink\"><img src=\"$image_dir/icons/trash.gif\" alt=\"$moderator_del_action\" border=\"0\" align=\"right\"></a>";
        echo "<a href=\"$PHP_SELF?action=submit&delcommentid=$db[id]&offset=$offset&poffset=$poffset$adminlink\"><img src=\"$image_dir/icons/trashcomment.gif\" alt=\"$moderator_del_comment\" border=\"0\" align=\"right\"></a>";
        echo "<a href=\"$PHP_SELF?action=submit&commentid=$db[id]&offset=$offset&poffset=$poffset$adminlink\"><img src=\"$image_dir/icons/comment.gif\" alt=\"$moderator_edit_comment\" border=\"0\" align=\"right\"></a>";
		        echo "<div class=\"spaceleft\">&nbsp;</div>\n";
    }
    echo "        $gb_posted $when</div><hr><div class=\"mainleft\">".censor_msg($db[message],($admin==$adminpass))."</div>\n";
    if($commentid == $db[id] && $action!="changed" && $admin==$adminpass) {
      echo "  &nbsp;&nbsp\n";
      echo "  <form action=\"$PHP_SELF?action=submit\" method=\"post\">\n";
      echo "     <input type=\"hidden\" name=\"admin\" value=\"$admin\"><input type=\"hidden\" name=\"commentid\" value=\"$commentid\">\n";
      echo "     <input type=\"hidden\" name=\"offset\" value=\"$offset\"><input type=\"hidden\" name=\"poffset\" value=\"$poffset\">\n";
      echo "     <div class=\"comment\"><textarea name=\"comment\" cols=\"".($text_field_size-5)."\" rows=\"5\">".decode_msg($db[comment])."</textarea>\n<BR>";
      echo "     <input type=\"submit\">&nbsp;&nbsp;<a href=\"smiliehelp.php\"
                            onClick='enterWindow=window.open(\"smiliehelp.php\",\"Smilie\",
                            \"width=250,height=450,top=100,left=100,scrollbars=yes\"); return false'
                            onmouseover=\"window.status='$smiliehelp'; return true;\"
                            onmouseout=\"window.status=''; return true;\">$smiley_help</a></div>\n";
      echo "  </form>\n";
    } elseif(!empty($db[comment])) {
      echo "  &nbsp;&nbsp<div class=\"comment\">".$gb_modcomment.$db[comment]."</div>\n";
    }
    echo "      </td>\n  </tr>\n";
    }

    # End of Page reached
    #################################################################################################

    echo"</table>\n";
    echo"</div>\n";
  }
  echo"        </td>\n";
  echo"       </tr>\n";
  echo"      </table>\n";
  echo"    </td>\n";
  echo"   </tr>\n";
  echo"   <tr>\n";
  echo"    <td>\n";
  echo"<br>\n";

  if ($show_sysinfo) {
    list($usec, $sec) = explode(" ",$proctime_start);
    $proctime_start = $usec+$sec;

    list($usec, $sec) = explode(" ",microtime());
    $proctime_end = $usec+$sec;
    $proctime = $proctime_end-$proctime_start;

    $query = mysql_db_query($database, "SELECT id FROM guestbook");
    $countall=mysql_num_rows($query);


    echo"<div class=\"footer\">Processingtime: ".substr($proctime,0,7)." sec., Entries: $countall, PHP Ver. ".phpversion()."</div>\n";
  }

  #  PLEASE DO NOT REMOVE OR EDIT THIS COPYRIGHT-NOTICE !!! THANKS !!! ################################################

  echo"<div class=\"footer\">phpBook Ver. $book_version &copy; 2001-".date("Y")." by <a href=\"http://www.smartisoft.com\" target=\"_blank\">SmartISoft</a></div>\n";
  #####################################################################################################################

  echo"    </td>\n";
  echo"   </tr>\n";
  echo" </table>\n";
  echo"</body>\n";
  echo"</html>\n";


}

#  Disconnect DB
#################################################################################################
mysql_close();

if ($support==$supportpwd && $supportpwd) {echo "<br><br>"; phpinfo();}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -