SoFunction
Updated on 2025-04-09

Guestbook that supports OICQ avatar (I)

Features:
Supports OICQ avatar, automatic paging, display message ip, email legality verification, convenient and safe message management,
Without complex functions, it is easy for beginners to understand.
Program example: http://medguider./notebook/
Complete program download (including pictures) http://medguider./download/
Program List:
Configuration file Database file Show message main program Add message Delete message

create table notebook (name char(6),email varchar(35),time char(30),face char(2),ip varchar(16),title varchar(255),nnote text);
//Message book name name email time time face avatar ip title title nnote content

<?php
//Change it to your own database username and password
$db = mysql_connect("localhost", "root");
mysql_select_db("test",$db);
//Change it to your own management username and password
$username="demo";
$password="demo";
?>

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>Message Book</TITLE>
<style type="text/css">
<!--
.blue9 {  font-size: 9pt; color: #0099FF; text-decoration: none}
.black9 {  font-size: 9pt; text-decoration: none}
.purple10 {  font-size: 10pt; color: #9900FF; text-decoration: none}
.white12 {  font-size: 12pt; color: #FFFFFF; text-decoration: none}
a:visited {  color: #FFFFFF}
a:link {  color: #FFFFFF}
-->
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
include ("");
$result = mysql_query("SELECT * FROM notebook ",$db);
$row=mysql_num_rows($result);// Check how many rows there are in the query result
$max=$row; //Total number of posts
//Suppose 10 articles are displayed on each page, you can set it yourself, the total number of $p pages, which page $page, which line $low starts from, and how many lines $x reads
if (!$page){ $page=1;}//The default value of $page is 1
$p=ceil($max/10);//The maximum integer with the number of pages $max/10
$low=10*($page-1);
if($page==$p&&($max%10)<>0){$x=($max%10);} else {$x=10;}//If it is the last page and is not an integer multiple of 10, read $max divided by the remainder of 10, otherwise take 10
if($max==0){$x=0;}//If there is no post, $x will take 0
$result = mysql_query("select * from notebook ORDER BY time DESC limit $low,$x",$db);//Query in descending order of post time
?>
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="61">
  <tr>  
<td height="62" width="34%"><a href=""><img src="image/" width="243" height="60" alt="Medical Navigation Network" border="0"></a></td>
    <td height="62" width="66%">  
      <div align="center"><img src="image/" width="410" height="60"><img src="image/" width="60" height="60"></div>
    </td>
  </tr>
</table>
<table width="95%" border="1" cellspacing="0" cellpadding="0" height="253" bordercolordark="#FFFFFF" bordercolorlight="#003399" align="center">
  <tr>  
    <td height="250">  
      <div align="center"></div>
      <table width="95%" border="0" cellspacing="0" cellpadding="0" height="32" bgcolor="#3366FF">
        <tr>  
<td width="26%" class="white12" height="23"><a href="../" class="white12">Home</a>
&gt; Guestbook</td>
          <td width="48%" class="white12" height="23">  
            <?php
echo "Total number of posts: &nbsp;",$max," &nbsp;&nbsp;&nbsp;";
          for ($n=1;$n<=$p;$n++){
          echo "<a href=?page=$n>$n</a>&nbsp;";
          }
echo "page";
          ?>
          </td>
          <td width="15%" height="23"><a href=""><img src="image/" width="91" height="21" border="0"></a></td>
<td width="11%" height="23"><a href=""><span class="white12">Message Management</span></a></td>
        </tr>
      </table>  
<?php
   for ($i=0;$i<=($x-1);$i++) {
   $name=mysql_result($result,$i,'name');
   $email=mysql_result($result,$i,'email');
   $face=mysql_result($result,$i,'face');
$face='image/face/icon'.$face;    //User avatar
   $time=mysql_result($result,$i,'time');
   $ip=mysql_result($result,$i,'ip');
   $title=mysql_result($result,$i,'title');
   $nnote=mysql_result($result,$i,'nnote');
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' height=107' bordercolor='#FFFFFF'> <tr bgcolor='#eeeeee'>";  
echo "<td width='10%' height='33' bgcolor='#eeeeee' class='blue9'>&nbsp;<img src='$' width='32' height='32'></td>";
echo        "<td width='16%' height='33' bgcolor='#eeeeee' class='blue9'>Message: $name</td>";
echo       "<td width='41%' height='33' bgcolor='#eeeeee' class='blue9'>Posted in:$time</td>";
echo        "<td width='12%' height='33' bgcolor='#eeeeee' class='blue9'><a href='mailto:$email'><img src='image/' width='16' height='16' border=0></a></td>";
echo        "<td width='21%' height='33' class='blue9'><img src='image/' width='13' height='15'> &nbsp;$ip</td>  </tr> <tr>";  
echo        "<td colspan='5' class='purple10' height='33'>Title: $title</td> </tr>";
echo       "<tr bgcolor='#ffffff'><td colspan='5' class='black9' height='37'>Message content:$nnote</td></tr></table>";
}
mysql_close($db);
?>     
    </td>
</tr>
</table>
</BODY>
</HTML>