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

📄 index.php

📁 我们运用一个小的记事本
💻 PHP
字号:
<?php
session_start(); 
error_reporting(E_ALL & ~E_NOTICE);
include 'include/config.php';
include 'include/para.php';
include 'include/page_.php';
include 'include/randnum.php';
$s = new code();
$s->genimg(); 
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>浏览留言 - <?php echo $gb_name?></title>
<link href="include/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
if(!defined('MCBOOKINSTALLED'))
{?>
<table width="80%" border="0" align="center" cellpadding="6" cellspacing="3" bgcolor="#FFFFFF" class="border2">
  <tr>
    <td><font class=ohred><b>多多留言本没有正确安装!</b></font><br />
        <a href=install/install.php><font color="#0033CC">》》点击这里安装</font></a>
      <?php 
  exit();
}
?></td>
  </tr>
</table>
<?php include 'include/head.php';?>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
  <tr> 
    <td align="center"> 
      <table width="96%" border="0" cellpadding="0" cellspacing="15" bgcolor="#EBF5FE">
        <tr> 
          <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="6" cellspacing="0" class="border2">
              <tr> 
                <td>
                  <?php
if(empty($_GET['page'])) $page=1;
$sql="select * from ".TABLE_PREFIX."guestbook order by settop desc,id desc";
$total=$db->get_rows($sql);//直接取出记录集行数供分页之用
if($total!=0)//判断记录是否为空
{
pageft($total,$page_);
$rs=$db->execute($sql." limit $firstcount,$displaypg");?>
                  <table width="100%" border="0" cellpadding="3" cellspacing="0">
                    <?php 
while($rows=$db->fetch_array($rs))
{ 
?>
                    <tr> 
                      <td height="1" colspan="3" bgcolor="#EBF5FE"></td>
                    </tr>
                    <tr> 
                      <td width="58%" bgcolor="#F4FAFF"><font color="#175CBB"><img src="images/icon_write.gif" width="16" height="16"> 
                        <?php echo $rows['username']?></font> <font color="#999999">于 
                        <?php echo date("Y-m-d H:i",strtotime($rows["systime"]));?> 
                        发表留言:</font> 
                        <?php if(date("Y-m-d",strtotime($rows["systime"]))==date("Y-m-d"))  echo '<img src=images/new.gif alt=最新留言>';?>
                          
                        <?php if($rows['settop']!=0){?>
                        <img src="images/settop.gif" alt="已置顶" width="11" height="11"> 
                        <?php }?>                      </td>
                      <td width="33%" align="right" bgcolor="#F4FAFF"><?php if(!empty($_SESSION['admin_pass'])){?>
                        <a href="javascript:if(confirm('确认删除此留言?'))location='admin_action.php?ac=delete&id=<?php echo $rows['id'];?>'"><img src="images/icon_del.gif" alt="删除此条留言" width="11" height="11" border="0"></a> 
                        <a href="edit.php?id=<?php echo $rows['id'];?>"><img src="images/icon_rn.gif" alt="编辑/回复此留言" width="11" height="11" border="0"></a> 
                        <?php if($rows['settop']==0){?>
                        <a href="admin_action.php?ac=settop&id=<?php echo $rows['id'];?>"><img src="images/settop.gif" alt="将本留言置顶" width="11" height="11" border="0"></a> 
                        <?php }else{?>
                        <a href="admin_action.php?ac=unsettop&id=<?php echo $rows['id'];?>"><img src="images/unsettop.gif" alt="取消置顶" width="12" height="11" border="0"></a> 
                        <?php }?>
                        <?php }?>                      </td>
                      <td width="9%" align="right" bgcolor="#F4FAFF" class="font14"> 
                        <?php if(!empty($rows['email'])){?>
                        <a href="mailto:<?php echo $rows['email']?>"><img src="images/email.gif" alt="点击用OutLook发送邮件至:<?php echo $rows['email']?>" border="0"></a> 
                        <?php }?><?php if(!empty($_SESSION['admin_pass'])){?>
                        <img src="images/ip.gif" alt="留言者IP:<?php echo $rows['userip'];?>" border="0"> 
                      <?php }?>
					  </td>
                    </tr>
                    <tr> 
                      <td height="1" colspan="3" bgcolor="#EBF5FE"></td>
                    </tr>
                    <tr> 
                      <td colspan="3" bgcolor=""> <table width="100%" border="0" cellspacing="5" cellpadding="0">
                          <tr> 
                            <td colspan="2" style="width: 615px; word-wrap: break-word" class="p"><font color="#555555">
							<?php 
							if($ifauditing==1){
								if($rows['ifshow']==0){
								 	echo '(此留言需要审核才能显示!)';
								 }elseif($rows['ifqqh']==1){
								 	echo '(此留言为悄悄话……)';
								}else{
								 	echo $rows['content'];
								 }
							}else{
								 if($rows['ifqqh']==1){
								 	echo '(此留言为悄悄话……)';
								 }else{
								 	echo $rows['content'];
								 }
								 
							}
							?></font></td>
                          </tr>
                          <?php if(!empty($rows['reply'])){?>
                          <tr> 
                            <td width="25">&nbsp;</td>
                            <td width="616"> <table width="90%" border="0" cellpadding="3" cellspacing="2" class="xborder">
                                <tr> 
                                  <td bgcolor="#f8f8f8"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td>  <font color="#FF9933"><strong><?php echo $replyadmtit;?>:</strong><?php echo date("Y-m-d H:i",strtotime($rows["replytime"]));?></font></td>
                                      </tr>
                                      <tr> 
                                        <td class="p"><font color="#555555"><?php echo $rows['reply'];?></font></td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table></td>
                          </tr>
                          <?php }?>
                        </table></td>
                    </tr>
                    <tr> 
                      <td height="8" colspan="3" bgcolor=""></td>
                    </tr>
                    <?php
		   }
		   $db->free_result($rs);
		   }else{
		   echo '暂无留言……';
		   }?>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="221" align="center">留言总数:<?php echo $total;?> 条 </td>
    <td width="529"><?php echo $pagenav;?></td>
  </tr>
</table>
<form name="form1" method="post" action="add.php" onSubmit="return FrontPage_Form1_Validator(this)">
  <table width="750" border="0" align="center" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
    <tr> 
      <td align="center"> 
        <table width="96%" border="0" cellpadding="0" cellspacing="15" bgcolor="#EBF5FE">
          <tr> 
            <td align="center" valign="top" bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="3" cellspacing="0" class="border2">
                <tr> 
                  <td height="50" colspan="2"> <table width="95%" border="0" cellspacing="2" cellpadding="0">
                      <tr> 
                        <td width="9%" align="center"><font color="#0066FF"><img src="images/i1.gif" width="36" height="36"></font></td>
                        <td width="91%" class="font16"><img src="images/add.gif" width="99" height="28"></td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td width="20%" align="right"><font color="#333333">昵称:</font></td>
                  <td width="80%"> <input name="username" type="text" id="username"> 
                    <font color="#999999">*</font></td>
                </tr>
                <tr> 
                  <td align="right"><font color="#333333">Email:</font></td>
                  <td><input name="email" type="text" id="email" size="50"></td>
                </tr>
                <tr> 
                  <td align="right"><font color="#333333">内容:</font></td>
                  <td> <textarea name="content" cols="60" rows="6" id="content"></textarea>
                    <font color="#999999">*<br>
                    <font color="#999999"><font color="#666666">提交之前请先按CTRL+V保存您的留言内容,以免程序出错而丢失!</font></font><font color="#666666"><br>
                    </font><font color="#999999"><font color="#999999"><font color="#666666"> 
                    </font></font><font color="#666666">留言内容最少5个字符! </font></font><font color="#666666"> 
                    </font></font></td>
                </tr>
                <tr>
                  <td align="right">悄悄话:</td>
                  <td valign="top"><label>
                    <font color="#666666">
                  <input name="ifqqh" type="checkbox" id="ifqqh" value="1">
                  (当选中时,此留言只有管理员可见)</font></label></td>
                </tr>
                <tr> 
                  <td align="right"><font color="#333333">验证码:</font></td>
                  <td valign="top"> 
                    <input name="unum" type="text" id="unum" size="10">
                    <font color="#999999">*</font> <IMG SRC='<?php echo 'imcode.png?'.time();?>' WIDTH='50' HEIGHT='25' BORDER=0 ALT=''>                  </td>
                </tr>
                <tr> 
                  <td align="right"> <script language=JavaScript>
function FrontPage_Form1_Validator(theForm)
{
  if (theForm.username.value == "")
  {
    alert("请填写昵称!");
    theForm.username.focus();
    return (false);
  }
  if (theForm.username.value.length<3)
  {
    alert("昵称至少应为3个字符!");
    theForm.username.focus();
    return (false);
  }
  if(theForm.email.value!=""){
              var email1 = theForm.email.value;
              var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 
              flag = pattern.test(email1); 
              if(!flag){
              alert("邮件地址格式不对!");
     theForm.email.focus();
           return false;}
  }

  if (theForm.content.value == "")
  {
    alert("留言内容不能空!");
    theForm.content.focus();
    return (false);
  }
  if (theForm.content.value.length<5)
  {
    alert("留言内容最少5个字符!");
    theForm.content.focus();
    return (false);
  }
  if (theForm.unum.value == "")
  {
    alert("请您输入验证码!");
    theForm.unum.focus();
    return (false);
  }
   return (true);
}
</script></td>
                  <td height="50" class="font14"> <input type="submit" name="Submit" value=" 发表留言 "> 
                    <input name="ac" type="hidden" id="ac" value="add"> </td>
                </tr>
              </table></td>
          </tr>
        </table>
        
      </td>
    </tr>
  </table>
</form>
<?php include 'include/foot.php';?>
</body>
</html>

⌨️ 快捷键说明

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