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

📄 index.php

📁 需要mysql
💻 PHP
字号:
<?php
/*-------------------------------------------------------------
名称: PHP scud_gb 留言本
作者:scud(飞云小侠)
邮件: scud@email.com.cn
网址: http://www.cnscud.com
Oicq: 21981110
时间: 2001/06/10

版权所有,请多指教.谢谢.
-------------------------------------------------------------*/

if(!$inc_lib)  { include("lib.inc.php"); }
if(!$inc_condb)  { include("conn_db.inc.php"); }

?>
<html>
<head>
<meta HTTP-EQUIV=Content-Type content="text/html; charset=gb2312">
<title><? echo $gb_title; ?></title>
<link rel="stylesheet" href="nr.css" type="text/css">
<script language=javascript>
function openwin(url,myname)
{
	window.open(url,myname,'resizable=1,scrollbars=1,status=no,toolbar=no,location=no,menu=no,left=0,top=0,width=500,height=420');	
}
</script>
</head>
<body>
<?php
echo $gb_header;
?>
<div align="center"><center>
<table border="0" width="720" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#808080" width="30%"><p align="left">&nbsp;<a href="<? echo $gb_homepage; ?>"  target="_top" class=ahz><font color="#FFFFFF"><? echo $gb_homepage_title?></font></a><font
    color="#000000" class=hz> &gt;&gt;</font> <a href=<?echo $gb_url;?>   target="_top" class=ahz><font color="#FFFFFF"><? echo $gb_name;?></font></a></td> 
    <td width="70%" bgcolor="#808080" align=right class=ahz>
    <?php if(!$show_newpost):?><a href="#" class=mysl onclick="openwin('shownewpost.php','scud_gb_new');"><font color=white>签写留言</font></a> <?endif;?>
    &nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" width="100%" height="2" bgcolor="#808080"></td>
  </tr>
</table>
</center></div>
<table width=720 height=4 border=0><tr><td>&nbsp;</td></tr></table>
<?php if($show_newpost):?>
      <a name=writeme>
      <div align="center">
      <center>
      <table border="0" cellpadding="4" cellspacing="1" width="720" align=center class=hz>
      <tr  BGCOLOR=#E3E3E3>
      <td  BGCOLOR='#5D7790'>&nbsp;<b><font color=white>请留下你的只言片语:</font></b></td>
      </tr>
      </table>
      <table border="0" cellpadding="4" cellspacing="1" width="720" align=center  BGCOLOR=#F7F7F7 class=hz>
    <form method="POST" action=newpost.php>
      <tr  bgcolor=#E3E3E3>
      <td width="131">&nbsp;姓名</td>
      <td width="544"><input type="text" name="user_name" size="25" maxlength=30> <font color=red>*</font> </td>
      </tr>
      <tr  bgcolor=#E3E3E3>
      <td width="131">&nbsp;主页</td>
      <td width="544"><input type="text" name="user_url" size="25" maxlength=100></td>
      </tr>
      <tr  bgcolor=#E3E3E3>
      <td width="131">&nbsp;邮件</td>
      <td width="544"><input type="text" name="user_email" size="25" maxlength=80></td>
      </tr>
      <tr  bgcolor=#E3E3E3>
      <td width="131">&nbsp;标题</td>
      <td width="544"><input type="text" name="g_title" size="25" maxlength=30> <font color=red>*</font> </td>
      </tr>
      <tr  bgcolor=#E3E3E3>
      <td valign="top" width="131">&nbsp;留言</td>
      <td width="544"><textarea rows="6" name="g_said" cols="40"></textarea> </td>
      </tr>
      <tr  bgcolor=#E3E3E3>
      <td width="131">&nbsp;选项</td>
      <td width="544"><input type="checkbox" name="g_sendmail" value="ON">如果有回复,请寄回我的邮箱</td>
      </tr>
      </table>
      </center>
      </div>
      <p align="center"><input type="submit" value=" 写留言 " name="newpost" class=btnStyle>&nbsp;&nbsp;&nbsp; <input type="reset" value=" 清空重写 " name="B2"  class=btnStyle></p>
      </form>
<?php endif;?>
<?php

//index page

$user_id=1;

$past24time=time()-$newpost_hour*3600;
$past24=date("YmdHis",$past24time);
$now=date("YmdHi");
$todaystr=formatdate($now,'date');

$page=intval($page) or 1;
if($page<1) {$page=1;}
//if(is_int($page)){}else {$page=1;}

$thissql="select count(*) from $db_gb where g_top_id=0 and user_id=$user_id";
$query=mysql_query($thissql,$db_conn);
$array=mysql_fetch_row($query);
$all_records=$array[0];

$all_page=ceil($all_records/$records_pp);
if($page>$all_page) {$page=$all_page;}
$start_topic=($page-1)*$records_pp;

$thissql="select g_id from $db_gb where g_top_id=0 and user_id=$user_id order by g_ltime desc,g_id desc limit $start_topic,$records_pp";
//echo $thissql;
$query=mysql_query($thissql,$db_conn);

$top_ids='';

while($array=mysql_fetch_row($query))
{
	$top_ids.="$array[0],";
}

$top_ids=substr($top_ids,0,strlen($top_ids)-1);
?>
<table width=<?echo $gb_table_width;?> border=0 cellspacing=0 cellpadding=2 align=center class=ahz>
<tr><td><b>今天是<?echo $todaystr;?></b></td><td align=right><b>现在共有<?echo $all_records;?>条留言.</b></td></tr></table>	
<?php
if($top_ids=='')
{
}
else
{
	$thissql="select * from $db_gb where ( user_id=$user_id ) and ( (g_top_id in ($top_ids)) or (g_id in ($top_ids)) ) order by g_ltime desc,g_id";
	
	$old_g_top_id=-1;
	$query=mysql_query($thissql,$db_conn);
	
	while($array=mysql_fetch_array($query))
	{	
		$array[g_said]=truncate($array[g_said]);
		$array=conv_array($array,'htmlspecialchars');		
		$array=conv_array($array,'conv_space');
		$array[g_said]=conv_textsee($array[g_said]);
		$array=conv_array($array,'conv_tosee');
		
		$newicon='';
		if($array[g_time]>$past24) {$newicon="<img src=images/new.gif border=0>";} 
		if( ($old_g_top_id!=-1) and ($array[g_top_id]==0) )
		{
			echo <<<___bbb___
</td></tr></table>
</td>
</tr>
</table><br>		
___bbb___;
		}
		$user_email='';
		$user_url='';
		if($array[user_email]) { $user_email="<a href=\"mailto:$array[user_email]\"><img src=images/email.gif border=0 alt=\"$array[user_email]\"></a>";  }		
		if($array[user_url]) { $user_url="<a href=\"$array[user_url]\" target=_blank><img src=images/home.gif border=0 alt=\"$array[user_url]\"></a>";  }
		$g_time=formatdate($array[g_time]);
		
		if($array[g_top_id]==0)
		{		
			echo <<<___aaa___
\n<table width="$gb_table_width" border="0" cellspacing="0" cellpadding="2" align="center" class=hz>
<tr BGCOLOR=#E3E3E3>
<td><b>$newicon $array[g_title]&nbsp;</b> $array[user_name]&nbsp; ($g_time)&nbsp; $user_url &nbsp; $user_email &nbsp; </td>
<td align=right><a href="#" onclick="openwin('reply.php?user_id=$user_id&g_id=$array[g_id]','scud_gb_reply');"><img src=images/reply.gif border=0 alt=回复此留言></a>     	
</td>
</tr>
<tr BGCOLOR=#F7F7F7> 
<td colspan=2>     	
<hr size=1 noshade>
<table width=100% border=0 class=hz><tr><td width=35></td><td>$array[g_said] &nbsp;
___aaa___;
		}
		else
		{
			echo <<<___ccc___
<table width=100% class=hz><tr BGCOLOR=#E3E3E3><td>
<p><b>$newicon $array[g_title]&nbsp;</b> $array[user_name]&nbsp; ($g_time) &nbsp; $user_url &nbsp; $user_email</p>
</td></tr>
<tr><td><blockquote>$array[g_said]&nbsp;</blockquote></td></tr>
</table>
___ccc___;

		}	
		$old_g_top_id=$array[g_top_id];
	}

	if( ($old_g_top_id!=-1) )
	{
		echo <<<___bbb___
</td></tr></table>
</td>
</tr>
</table>		
___bbb___;
	}
}
?>
      <div align="center">
      <center>
      <table border="0" cellpadding="4" cellspacing="1" width="720" align=center class=hz>
      <tr>
      <td align=right class=hz>&nbsp;<b>
      <?php
      		if($all_records>0)
      		{
 			echo "页码:",get_pagelist($all_page,$page,$page_pp,"$gb_url?user_id=$user_id&page=");     
 		}
      ?>
      </b></td>
      </tr>
      </table>
      </center>
      </div><br>
      <br><br>
<?php
echo $gb_footer;
?>     

</body>
</html>

⌨️ 快捷键说明

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