<!--#include file="conn.asp"-->
<%
id=Request.QueryString("id")
If Request.QueryString("Page") = "" or Request.QueryString("Page") <= 0 then
Page = 1
Else
Page = CINT(Request.QueryString("Page"))
End If
user=Request.QueryString("user")
if user="" then
response.redirect "default.asp"
end if
set rs=server.createobject("adodb.recordset")
sql="select * from user where username='" & user &"'"
rs.Open SQL,conn,1,2
if rs.BOF or rs.EOF then
response.redirect "default.asp"
else
webname=rs("web")
web=rs("wwwhttp")
master=rs("webmaster")
kind=rs("kind")
  if session("user")=rs("username") and session("pwd")=rs("password") then
   adminok="ok"
  end if 
%>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>::<%=webname%>::的留言板</title>
<link rel="stylesheet" type="text/css" href="style/<%=kind%>.css">
<script language="JavaScript">
<!--

function Juge(theForm)
{
  if (theForm.name.value == "")
  {
    alert("请输入您的姓名!");
    theForm.name.focus();
    return (false);
  }
	if (checktext(theForm.name.value))
	{
		alert("请您输入有效姓名!");
		theForm.name.select();
		theForm.name.focus();
		return (false);
	}


	
	if (theForm.email.value == "")
	{
		alert("请您输入\"email\"!");
		theForm.email.focus();
		return (false);
	}
	if (theForm.ly.value == "")
	{
		alert("请您输入内容!");
		theForm.ly.focus();
		return (false);
	}

	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
	var checkStr = theForm.email.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}

	if (theForm.email.value.length < 6)
	{
			allValid = false;
	}

	if (!allValid)
	{
		alert("您输入的 \"电子邮件地址\" 无效!");
		theForm.email.focus();
		return (false);
	}

	address=theForm.email.value;
    if(address.length>0)
	{
        i=address.indexOf("@");
        if(i==-1)
		{
			window.alert("对不起！您输入的电子邮件地址是错误的！")
			theForm.email.focus();
			return false
        }
       ii=address.indexOf(".")
        if(ii==-1)
		{
			window.alert("对不起！您输入的电子邮件地址是错误的！")
			theForm.email.focus();
			return false
        }

    }
	if (checktext(theForm.email.value))
	{
		alert("请您输入有效的\"email\"!");
		theForm.email.select();
		theForm.email.focus();
		return (false);
	}
	
}


function checktext(text)
{
			allValid = true;

		for (i = 0;  i < text.length;  i++)
		{
			if (text.charAt(i) != " ")
			{
				allValid = false;
				break;
			}
		}

return allValid;
}

//-->
</script>
</head>
<table width="600" align="center" cellspacing="0" cellpadding="1"  border="0" bgcolor=#000000>
  <tr >
    <td >
      <table width="600" cellspacing="0" cellpadding="4" border="0" class="table002">
        <tr>
          <td valign="middle" align=left class="jnfont7"> <b>>> </b> <a href="<%=web%>"><acronym title="返回主页">主页</acronym></a> 
            | <a href="modify.asp?user=<%=user%>"><acronym title="编辑你的个人资料">修改资料</acronym></a>    
            | <%if  adminok="ok" then%><a href="usermanager.asp?user=<%=user%>&exit=ok"><acronym title="退出管理">退出管理</acronym></a><%else%><a href="usermanager.asp?user=<%=user%>"><acronym title="回复或删除留言">留言管理</acronym></a><%end if%>    
            | <a href="default.asp"><acronym title="免费申请留言本">免费申请</acronym></a>    
            | <a href="top.asp"><acronym title="留言排行榜">留言排行</acronym></a> </td>   
<td  valign="middle" align=right class="jnfont7"><b><%=webname%></b></td>
            </tr>
        </table>
        </td>
    </tr>
</table>
<br>
<div align="center"> 
<form method="post" action="savebook.asp" onSubmit="return Juge(this)">
    <table width="600"  cellpadding="3" cellspacing="1" border="0" bgcolor="#000000" >
      <tr> 
        <td width="300" height="170" valign="top" class="table001"> 
          <table cellpadding="2" width="95%" cellspacing="2" border="0"  >
            <tr> 
              <td width="9%"><img src="images/nc.gif" width="24" height="24"></td>
              <td width="14%" class="jnfont3">姓名</td>
              <td width="77%"> 
                <input type="text" name="name" maxlength="20" size="20" class="input1" >
                <input name="user" value="<%=user%>" type="hidden">
              </td>
            </tr>
            <tr> 
              <td width="9%"><img border=0 src=images/email.gif width="24" height="24"></td>
              <td width="14%" class="jnfont3">Email</td>
              <td width="77%"> 
                <input type="text" name="email" maxlength="100" size="20" class="input1" >
              </td>
            </tr>
            <tr> 
              <td width="9%"><img src="images/from.gif" width="16" height="16"></td>
              <td width="14%" class="jnfont3">来自</td>
              <td width="77%"> 
                <select name="area" size="1">
                  <option selected value="北京">北京 
                  <option value="广东">广东 
                  <option value="上海">上海 
                  <option value="新疆">新疆 
                  <option value="辽宁">辽宁 
                  <option value="广西">广西 
                  <option value="海南">海南 
                  <option value="湖南">湖南 
                  <option value="甘肃">甘肃 
                  <option value="河北">河北 
                  <option value="湖北">湖北 
                  <option value="江西">江西 
                  <option value="江苏">江苏 
                  <option value="西藏">西藏 
                  <option value="山东">山东 
                  <option value="浙江">浙江 
                  <option value="安徽">安徽 
                  <option value="福建">福建 
                  <option value="吉林">吉林 
                  <option value="黑龙江">黑龙江 
                  <option value="山西">山西 
                  <option value="云南">云南 
                  <option value="贵州">贵州 
                  <option value="四川">四川 
                  <option value="陕西">陕西 
                  <option value="重庆">重庆 
                  <option value="天津">天津 
                  <option value="河南">河南 
                  <option value="青海">青海 
                  <option value="宁夏">宁夏 
                  <option value="台湾">台湾 
                  <option value="香港">香港 
                  <option value="澳门">澳门 
                  <option value="其它地区">其它地区 
                </select>
              </td>
            </tr>
            <tr> 
              <td width="9%"><img border=0 src=images/homepage.gif width="24" height="24"></td>
              <td width="14%" class="jnfont3">主页</td>
              <td width="77%"> 
                <input type="text" name="http" maxlength="100" size="30" class="input1" >
              </td>
            </tr>
            <tr> 
              <td width="9%"><img border=0 src=images/oicq.gif width="24" height="24" ></td>
              <td width="14%" class="jnfont3">oicq</td>
              <td width="77%"> 
                <input type="text" name="oicq" maxlength="20" size="20" class="input1" >
              </td>
            </tr>
            <tr> 
              <td width="9%"><img border=0 src=images/icq.gif width="18" height="18" ></td>
              <td width="14%" class="jnfont3">icq</td>
              <td width="77%"> 
                <input type="text" name="icq" maxlength="20" size="20" class="input1" >
              </td>
            </tr>
            <tr> 
              <td width="9%"><img id=idface src="images/1.gif" alt=个人形象代表 width="24" height="24"></td>
              <td width="14%" class="jnfont3">头像</td>
              <td width="77%"> 
                <select name="face" size=1 onChange="document.images['idface'].src=options[selectedIndex].value;" >
                  <option selected value="images/1.gif">头像1 <%dim i                  
                  for i=1 to 100%>
                  <option select value="images/<%=I%>.gif">头像<%=I%> <%
                  next%>
                   
                </select>
              </td>
            </tr>
          </table>
        </td>
        <td width="300" height="170" valign="top" class="table001" > 
          <table width="250" cellpadding="2" cellspacing="2" border="0" align="center">
            <tr> 
              <td width="10"><img src='images/post.gif' width="24" height="24"></td>
              <td width="240" class="jnfont3">内容</td>
            </tr>
            <tr> 
              <td colspan="2"> 
                <textarea  type="text" name="ly" rows="5" cols="30" class="testarea1"></textarea>
              </td>
            </tr>
            <tr> 
              <td colspan="2" class="jnfont3">1）留言者不能发布任何不符合当地法规、国家法律和国际法律的资料； </td>
            </tr>
            <tr> 
              <td colspan="2" class="jnfont3">2）留言者不得发布任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的，淫秽等信息资料； 
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr class="table003"> 
        <td colspan="2" > 
          <div align="center"> 
            <input type="submit" name="Submit" value="提交" class="input2">
            <input type="reset" name="Submit2" value="重填" class="input2">
          </div>
        </td>
      </tr>
    </table>
    </form>
  <%
set rs1=server.createobject("adodb.recordset")
sql="select * from book where user='" & user &"' order by addtime desc"
rs1.Open SQL,conn,1,2
if not (rs1.EOF or rs1.BOF) then
rs1.PageSize=10
	Dim TotalPages             
        TotalPages = RS1.PageCount
        if page>rs1.pagecount then page=rs1.pagecount
	dim scount 
        scount=INT(Rs1.recordcount)
	rs1.absolutepage=page
	
	StartPageNum=1 
do while StartPageNum+10<=Page 
StartPageNum=StartPageNum+10 
Loop 
     
EndPageNum=StartPageNum+9
 
If EndPageNum>RS1.Pagecount then EndPageNum=RS1.Pagecount 
i=0
do while (not rs1.EOF) and (i<RS1.PageSize)

%> 
  <table width="600" cellspacing="1" cellpadding="3" bgcolor="#000000">
    <tr bgcolor="#ffffff"> 
      <td width="20%" rowspan="2" valign="top" class="table001"> 
        <div align="center">作者</div><br>
        <center>
          <img border="0" src="<%=rs1("face")%>">
          <br>
          <table class="jnfont6" ><%=rs1("name")%>
        </table><br>
          <br>
          来自-<%=rs1("area")%> 
        </center>
        <br>
      </td>
      <td width=80% valign=top class="table002" height="109"> 
        <table cellpadding=0 cellspacing=0 width=100% >
          <tr> 
            <td width="19"><img src='images/post.gif' width="24" height="24"></td>
            <td width="332">留言内容: <%if rs1("email")<>"" then%><a href=mailto:<%=rs1("email")%> title="给<%=rs1("name")%>发信"><img border=0 src=images/email.gif width="24" height="24"></a><%end if%> 
              <%if rs1("http")<>"" then%><a href=<%=rs1("http")%> target=_blank title="访问<%=rs1("name")%>的主页"><img border=0 src=images/homepage.gif width="24" height="24"></a><%end if%> 
              <%if rs1("oicq")<>"" then%><a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs1("oicq")%>" target="_blank" ><img src=images/oicq.gif width="24" height="24" alt="<%=rs1("oicq")%>" border="0"></a><%end if%><%if rs1("icq")<>"" then%><img
    src="http://online.mirabilis.com/scripts/online.dll?icq=<%=rs1("icq")%>&amp;img=5" width="18" height="18" alt="<%=rs1("icq")%>"><%end if%></td>
            <td width="117" align="right">&nbsp; </td>
          </tr>
        </table>
        <hr size="1">
        <%=rs1("ly")%></td>
    </tr>
    <tr class="table001"> 
      <td height="20"> 
        <div align="right">发表于:<%=rs1("addtime")%>　　<%if rs1("rely")<>"" then%>回复于:<%=rs1("retime")%>　<%end if%><img src=images/ip.gif alt="<%=rs1("ip")%>" width="13" height="15"> 
          <%if adminok="ok" then%><a href=manage.asp?id=<%=rs1("id")%>><img src=images/re.gif border=0 height=16 width=16 alt="回复或修改回复"></a> 
          <a href=manage.asp?id=<%=rs1("id")%>&kind=del><img src=images/del.gif border=0 height=16 width=16 alt="删除"></a><%end if%></div>
      </td>
    </tr>
    <%if rs1("rely")<>"" then%>
    <tr class="table002"> 
      <td width="20%" valign="top" ><div align="center">版主回复<br><img border="0" src="images/repost.gif"><br>          
          <table class="jnfont5" ><%=master%></table></div></td>
      <td><table class="jnfont5" ><%=rs1("rely")%></table></td>
    </tr>
    <%end if%>
  </table>

  <%i=i+1
rs1.MoveNext
loop
%> 
  <table width="600" cellspacing="1" cellpadding="3" bgcolor="#000000">
    <tr class="table003"> 
      <td colspan="2" valign="top" > 
        <div align="center"><table class="jnfont7" > 共<b><%=scount%></b>条 [<% if StartPageNum>1 then %><a href="guestbook.asp?user=<%=user%>&Page=<%=StartPageNum-1%>"><<</a> 
          <%end if%> <% For I=StartPageNum to EndPageNum   
      if I<>Page then %> <a href="guestbook.asp?user=<%=user%>&Page=<%=I%>"><%=I%></a> 
          <% else %> <b><%=I%></b> <% end if %> <% Next %> <% if EndPageNum<RS1.Pagecount then %> 
          <a href="guestbook.asp?user=<%=user%>&Page=<%=EndPageNum+1%>">>></a>
          <%end if%>  ]</table></div>
        </td>
    </tr>
    
  </table>
  <p align="left"><%else%> </p>
  <table align=center ><td class="jnfont3">对不起，还没有记录</td></table>
<%end if%>

</div>
<%end if%>
<div align="center">
  <table border="0" width="560" cellpadding="0">
    <tr> 
      <td width="100%"> 
        <hr size="1" width="80%">
      </td>
    </tr>
    <tr> 
      <td width="100%" class="jnfont3"> 
        <p align="center"><a href="http://www.5151.cn"><acronym title="免费留言本提供">免费留言本由[中泰科技]提供</acronym></a><br>
                </td>
    </tr>
  </table>
</div>
</html>
