www.gusucode.com > 25175 学生成绩管理查询系统码程序 > POPbook.asp
<!--#include file="config.asp"--> <!--#include file="conn.asp"--> <!--#include file="admin/inc.asp"--> <!--#include file="inc/Ubbadd.asp"--> <!--#include file="inc/Ubb.asp"--> <!--#include file="inc/Ubbshow.asp"--> <% '==================================================================== '25175成绩查询管理系统 'powered by 25175 '=------------------------------------------------------------------- '= 文件名称:guestbook.asp '= 摘 要:用户留言列表 cj_webtit="网站留言" cj_webmap="网站留言" '= 最后日期:2006-3.1 '==================================================================== %> <script language=javascript> ie = (document.all)? true:false if (ie){ function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.form1.submit();}} } </script> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin maxLen = 255; function checkMaxInput(form) { if (form.content.value.length > maxLen) form.content.value = form.content.value.substring(0, maxLen); else document.all.bodyLen.innerText=form.content.value.length; } // End --> </script> <script language=javascript> ie4=(document.all)?true:false; ns4=(document.layers)?true:false; function toExit(){ var args=toExit.arguments; var visible=args[0]; if(ns4){ theObj=eval("document.layers[\'"+args[1]+"\']"); if(theObj)theObj.visibility=visible; } else if(ie4){ if(visible=='show')visible='visible'; if(visible=='hide')visible='hidden'; theObj=eval("document.all[\'"+args[1]+"\']"); if(theObj)theObj.style.visibility=visible; } } </script> <!-- #include file="inc/top.asp" --> <%if request.QueryString("action")="" Then %> <div style="position: absolute; width: 61px; height: 45px; z-index: 1; left: 300px; top: 160px" id="layer1"> <center><img src="images/new_add.jpg" onClick="javascript:window.location.href = 'popbook.asp?action=addbook'" alt="添加新留言"> <br><a href="popbook.asp?action=addbook">添加新留言</a></center></div> <div id="nifty1" align="right"> <div class="rtop1"> <div class="r1"></div> <div class="r2"></div> <div class="r3"></div> <div class="r4"></div> </div> 系统留言板 ● <div class="rtop1"> <div class="r4"></div> <div class="r3"></div> <div class="r2"></div> <div class="r1"></div> </div> </div> <table width="85%" border="0" align="center" cellspacing="0" cellpadding="0"> <tr align="center" height="25"> <td class="tabtitle" width="10%"><span class="BODY">NO</span></td> <td width="3"> </td> <td class="tabtitle" width="45%"><span class="BODY">TITLE</span></td> <td width="3"> </td> <td class="tabtitle" width="15%"><span class="BODY">NAME</span></td> <td width="3"> </td> <td class="tabtitle" width="15%"><span class="BODY">DATE</span></td> <td width="3"> </td> <td class="tabtitle" width="10%"><span class="BODY">REP</span></td> </tr> <% page = CLng(request("page")) '利用CLng函数把page值转换为Long型 judge=request("judge") judge2=request("judge2") judge3=0 sql="select * from Bkye_book order by intime desc" rs.Open sql,conn,1,1 if rs.eof and rs.bof then response.Write("<tr><td colspan='9' align='center'><Br>当前还没有留言<br><a class=""m_0"" href=""?action=addbook"">点击这里添加留言</a></td></tr>") else rs.MoveFirst rs.PageSize = 13 '每页显示的条数 If page < 1 Then page = 1 If page > rs.PageCount Then page = rs.PageCount rs.AbsolutePage = page For ipage = 1 To rs.PageSize %> <tr height="25"> <td class="tabtd1" align="center"> <%=rs("id")%></td> <td class="tabtd1"> </td> <td class="tabtd2"> <%If DateDiff("d",rs("intime"),now)<3 Then response.write "<img src='images/new.gif' alt='最新留言'>"%><a style='cursor:hand' onclick="oSelect.style.display='none';javascript:toExit('show','boysoft<%=rs("id")%>')" title="标题:<%=Htmlencode(rs("title"))%> 发布人:<%=Htmlencode(rs("username"))%> 发布时间:<%=rs("intime")%>"><%=strvalue(Htmlencode(rs("title")),26)%></a><%if rs("booktype")=1 Then response.Write "<img src=""images/fals.GIF"" alt='只有管理员可见'>"%></td> <td class="tabtd1"> </td> <td class="tabtd1"><%if rs("sex")="靓妹" then response.Write("<img src=""images/female.gif"" alt="""&Htmlencode(rs("username"))&"是靓妹"">") else response.Write("<img src=""images/male.gif"" alt="""&Htmlencode(rs("username"))&"是帅哥"">") end if%> <b><%=strvalue(Htmlencode(rs("username")),6)%></td> <td class="tabtd1"> </td> <td class="tabtd2" align="center"> <%arrs=split(rs("intime")," ") response.write arrs(0)%></td> <td class="tabtd1"> </td> <td class="tabtd1" align="center"> <% if rs("reply")<>"" then response.Write "<img src=""images/yes.gif"" alt='管理员已回复'>" Else response.Write "<img src=""images/no.gif"" alt='管理员还没有回复'>" end if %> <div id="boysoft<%=rs("id")%>" style=" LEFT: 280px; POSITION: absolute; TOP: 260px; VISIBILITY: hidden; WIDTH: 400px; Z-INDEX: 0"> <table bgcolor="#ffffff" width='550' height='420' border="0" align="center" cellspacing="0" cellpadding="0"> <tr> <td valign="top" align="center"> <div id="nifty"> <div class="rtop1"> <div class="r1"></div> <div class="r2"></div> <div class="r3"></div> <div class="r4"></div> </div> <br><%=rs("username")%>的留言<br> <br> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" style="border-collapse: collapse;table-layout: fixed;"> <tr> <td width="119" height="28" bgcolor="#f3f7fd"> <%if rs("sex")="靓妹" then response.Write("<img src=""images/female.gif"" alt="""&Htmlencode(rs("username"))&"是靓妹"">") else response.Write("<img src=""images/male.gif"" alt="""&Htmlencode(rs("username"))&"是帅哥"">") end if%> <b><%=Htmlencode(rs("username"))%></td> <td width="248" bgcolor="#f3f7fd">主题:<%=Htmlencode(rs("title"))%></td> <td width="89" align="center" bgcolor="#f3f7fd"> <%if rs("email")<>"" then response.Write("<a href=""mailto:"&Htmlencode(rs("email"))&""" title=""给"&Htmlencode(rs("username"))&"发邮件""><img src=""Images/email.gif"" width=""15"" height=""15"" border=""0""></a> ") else response.Write("<img src=""Images/email.gif"" width=""15"" height=""15"" border=""0"" alt="""&Htmlencode(rs("username"))&"没有填写邮件""> ") end if%> <%if rs("oicq")<>"0" then response.Write("<img src=""Images/oicq.gif"" width=""15"" height=""15"" border=""0"" alt="""&Htmlencode(rs("username"))&"的QQ是"&rs("oicq")&"""> ") else response.Write("<img src=""Images/oicq.gif"" width=""15"" height=""15"" border=""0"" alt="""&Htmlencode(rs("username"))&"没有填写QQ""> ") end if%> <%if rs("homepage")<>"" then response.Write("<a href="""&Htmlencode(rs("homepage"))&""" title=""访问"&Htmlencode(rs("username"))&"的个人主页"" target=""_blank""><img src=""Images/homepage.gif"" width=""15"" height=""15"" border=""0""></a>") else response.Write("<img src=""Images/homepage.gif"" width=""15"" height=""15"" border=""0"" alt="""&Htmlencode(rs("username"))&"没有填写个人主页"">") end if%> </td> </tr> <tr bgcolor="#f3f7fd"> <td align="center" style="padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:5px;"><img src="<%=rs("userface")%>" border="0" width="100" height="100"> <br> 来自:<%=Htmlencode(rs("comefrom"))%></td> <td width="380" colspan="2" valign="top" style="padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:5px;"> <% if rs("booktype")=0 then response.Write(""&Ubbcode(rs("content"))&"") elseif rs("booktype")=1 and session("password")="" then response.Write("<font color=""#ff0000"">Sorry,这是秘密留言,只有管理员才能看到哈!~</font>") else response.Write(""&Ubbcode(rs("content"))&"") end if %> <Br><Br><Br><div align="right" valign="bottom">发表时间:<%=rs("intime")%> </div> <% if rs("reply")<>"" then response.Write("<hr width=""98%"" size=""1""><font color=""#ff0000"">管理员回复:[回复时间:"&rs("Replytime")&"]</font><Br>"&Ubbcode(rs("reply"))&"") end if %></td> </tr> </table> <center> <input type="button" class="bluebuttoncss" onclick="oSelect.style.display='inline';javascript:toExit('hide','boysoft<%=rs("id")%>')" name="Submit2" value=" 返 回 留 言 列 表 "> <div class="rtop1"> <div class="r4"></div> <div class="r3"></div> <div class="r2"></div> <div class="r1"></div> </div> </div> </td> </tr> </table> </div> </td> </tr> <% rs.MoveNext If rs.EOF Then Exit For Next %> <tr align="center"> <td colspan=9 style="border-top-style: solid; border-top-width: 3px"></td> </tr> <% End If %> </table> <table border="0" align="center" cellpadding="0" cellspacing="0" width="80%"> <tr> <td align="center" height="25"> 共有:<%=rs.recordCount%>条公告 <% If page = 1 Then Response.Write "<font class='white'>首页 上一页</font>" End If If page <> 1 Then Response.Write "<a href=popbook.asp?page=1 class='yellow'>首页</a>" Response.Write " <a href=popbook.asp?page=" & (page - 1) & " class='yellow'>上一页</a>" End If If page <> RS.PageCount Then Response.Write " <a href=popbook.asp?page=" & (page + 1) & " class='yellow'>下一页</a>" Response.Write " <a href=popbook.asp?page=" & RS.PageCount & " class='yellow'>最后一页</a>" End If If page = RS.PageCount Then Response.Write " <font class='white'>下一页 最后一页</font>" End If %> 页次:<strong><font color=red><%=page%></font>/<%=rs.PageCount%></strong> 跳转:<select id="oSelect" onchange="location=this.options[this.selectedIndex].value"> <% For pags=1 To rs.PageCount %> <option value="popbook.asp?page=<%=pags%>" <%If pags=page Then response.write " selected" %>><%=pags%></option> <% Next %> </select> </td> </tr> </table> <% end if if request.QueryString("action")="addbook" then if Sitebook=1 and Request.Cookies("POPArticle")("Username")="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>网站需要注册后才能发表留言<br>请先<a class=""m_0"" href=""Userreg.asp"">注册</a>或是<a class=""m_0"" href=""Userlogin.asp"">登陆</a>后再发表留言<Br><br></div></div>") else %> <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" align="center" class="tabtitle"><b>发表留言</td> </tr> <form name="form1" method="post" action="?action=savebook"> <tr> <td width="20%" class="tabtd1">【您的昵称】</td> <td class="tabtd2"><input class=smallInput name="username" type="text" value="<%=session("xm")%>" size="30" maxlength="12"> <font color="#FF0000">*(2-12)</font> </td> </tr> <tr> <td class="tabtd1">【留言标题】</td> <td class="tabtd2"><input class=smallInput name="title" type="text" size="40" maxlength="20"> <font color="#FF0000">*(1-20)</font> </td> </tr> <tr> <td class="tabtd1">【电子邮件】</td> <td class="tabtd2"><input class=smallInput name="email" type="text" value="" size="30" maxlength="30"> <font color="#FF0000">*</font></td> </tr> <tr> <td class="tabtd1">【个人主页】</td> <td class="tabtd2"><input class=smallInput name="homepage" type="text" value="<%=cj_weburl%>" size="30" maxlength="30"></td> </tr> <tr> <td class="tabtd1">【 Q I C Q】</td> <td class="tabtd2"><input class=smallInput name="oicq" value="00000" type="text" maxlength="9" size="20"></td> </tr> <tr> <td class="tabtd1">【从哪里来】</td> <td class="tabtd2"> <select name="comefrom" 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=澳门>澳 门 <option value=其它地区>其它地区</option> </select> </td> </tr> <tr> <td class="tabtd1">【选择性别】</td> <td class="tabtd2"><input name="sex" type="radio" value="帅哥" checked> 帅 哥 <input type="radio" name="sex" value="靓妹"> 靓 妹</td> </tr> <tr> <td class="tabtd1">【留言选项】</td> <td class="tabtd2"><input name="booktype" type="radio" value="0" checked> 公开留言<input type="radio" name="booktype" value="1">秘密留言</td> </tr> <tr> <td class="tabtd1">【选择头像】</td> <td class="tabtd2"> <select name="userface" onChange="document.images['face'].src=options[selectedIndex].value;" size=6> <option selected value=Images/face/01.gif select> 头像1 <option value=Images/face/02.gif> 头像2 <option value=Images/face/03.gif> 头像3 <option value=Images/face/04.gif> 头像4 <option value=Images/face/05.gif> 头像5 <option value=Images/face/06.gif> 头像6 <option value=Images/face/07.gif> 头像7 <option value=Images/face/08.gif> 头像8 <option value=Images/face/09.gif> 头像9 <option value=Images/face/10.gif> 头像10 <option value=Images/face/11.gif> 头像11 <option value=Images/face/12.gif> 头像12 <option value=Images/face/13.gif> 头像13 <option value=Images/face/14.gif> 头像14 <option value=Images/face/15.gif> 头像15 <option value=Images/face/16.gif> 头像16 <option value=Images/face/17.gif> 头像17 <option value=Images/face/18.gif> 头像18 <option value=Images/face/19.gif> 头像19 <option value=Images/face/20.gif> 头像20 </option> </select> <img alt=个人形象代表 height=90 id=face src="Images/face/01.gif" width=90> </td> </tr> <tr> <td class="tabtd1">【留言内容】<b> <font color="#FF0000"><span id="bodyLen">0</span><</font>255</td> <td class="tabtd2"><%'call ubbshow()%><textarea name="content" cols="50" rows="6" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" style="overflow-y:auto;height:120"><% If session("user")<>"" Then response.write "我的学号是:"&session("user") End If %></textarea> </td> </tr> <tr> <td colspan="2" align="center" class="tabtd2"> <input class="bluebuttoncss" type="submit" name="Submit" value="提交"> <input class="bluebuttoncss" type="reset" name="Submit2" value="重置"></td> </tr> </form> </table> <% end if end If if request.QueryString("action")="savebook" then username=trim(POP_sqlin(request.Form("username"))) title=trim(POP_sqlin(request.Form("title"))) email=trim(POP_sqlin(request.Form("email"))) homepage=trim(POP_sqlin(request.Form("homepage"))) oicq=trim(request.Form("oicq")) comefrom=POP_sqlin(request.Form("comefrom")) sex=POP_sqlin(request.Form("sex")) booktype=POP_sqlin(request.Form("booktype")) Userface=POP_sqlin(request.Form("Userface")) content=trim(POP_sqlin(request.Form("content"))) IP = Request.ServerVariables("REMOTE_ADDR") if username="" or len(username)<2 or strlen(username)>12 then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>用户呢称为空或不为4-12字符<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif title="" or strlen(title)>20 then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>主题为空或多于40个字符<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif instr(Request.Form("email"),"@")=0 or instr(Request.Form("email"),"@")=1 or instr(Request.Form("email"),"@")=len(email) then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>电子邮件填写不正确<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif not(isnumeric(oicq)) or oicq="" or len(oicq)<5 then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>QQ号码填写有误<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif content="" or len(content)>255 then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>内容为空或多余255个字符<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") else set rs=server.CreateObject("ADODB.RECORDSET") sql="select * from Bkye_book" rs.open sql,conn,1,3 rs.addnew rs("username")=Server.HTMLEncode(username) rs("title")=Server.HTMLEncode(title) rs("email")=Server.HTMLEncode(email) rs("homepage")=Server.HTMLEncode(homepage) rs("oicq")=Server.HTMLEncode(oicq) rs("comefrom")=Server.HTMLEncode(comefrom) rs("sex")=sex rs("booktype")=booktype rs("Userface")=Userface rs("content")=content rs("userip")=IP rs.update 'sql="update Bkye_site set bookcount=bookcount+1 where id=1" 'conn.execute(sql) response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>恭喜您,留言成功,谢谢您的支持^_^<br><a class=""m_0"" href=""POPbook.asp"" title=""返回留言本"">点击这里查看留言,或3秒后自动返回留言本</a><meta http-equiv=""refresh"" content=""3;URL=POPbook.asp""><Br><br></div></div>") rs.close set rs=nothing end if end If if request.QueryString("action")="delbook" then id=request("id") if session("password")="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>您不是管理员或是登陆超时<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif id="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>错误的ID参数<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") else set rs=server.CreateObject("adodb.recordset") sql="delete * from Bkye_book where id="&id rs.open sql,conn,1,3 'rs.update response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>恭喜您,删除留言成功^_^<br><a class=""m_0"" href=""POPbook.asp"" title=""返回留言本"">点击这里查看留言,或3秒后自动返回留言本</a><meta http-equiv=""refresh"" content=""3;URL=POPbook.asp""><Br><br></div></div>") 'rs.close set rs=nothing end if end If if request.QueryString("action")="replybook" then id=request("id") if session("password")="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>您不是管理员或是登陆超时<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif id="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>错误的ID参数<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") else set rs=server.CreateObject("adodb.recordset") sql="select * from Bkye_book where id="&id rs.open sql,conn,1,3 if rs.eof and rs.bof then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>错误的ID参数<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") else %> <br><div align="center" class="m_0">回复留言</div><br> <table width="96%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse;table-layout: fixed;"> <tr> <td><%=Ubbcode(rs("content"))%></td> </tr> </table> <table width="96%" border="0" cellspacing="0" cellpadding="0"> <form action="?action=reply" method="post"> <tr> <td height="40" align="center"><textarea name="reply" cols="50" rows="10"><%=rs("reply")%></textarea></td> </tr> <tr> <td height="40" align="center"> <input class=popinput type="submit" name="Submit3" value=" 回 复 "> <input class=popinput type="reset" name="Submit4" value=" 重 置 "> <input class=popinput type="hidden" name="id" value="<%=id%>"> </td> </tr> </form> </table> <% end if end if end If if request.QueryString("action")="reply" then id=request("id") reply=trim(request("reply")) if session("password")="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>您不是管理员或是登陆超时<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") elseif id="" then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>错误的ID参数<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") else set rs=server.CreateObject("adodb.recordset") sql="select * from Bkye_book where id="&id rs.open sql,conn,1,3 if rs.eof and rs.bof then response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>错误的ID参数<br><a class=""m_0"" href=""javascript:history.go(-1);"">点击这里返回上一页</a><Br><br></div></div>") else rs("reply")=server.HTMLEncode(reply) rs.update sqlbook="update Bkye_book set Replytime=Now(),bookflag=1 where ID="&id conn.execute(sqlbook) response.Write("<Br><div align=""center""><div class=""Infotitle"">系统提示信息</div><div class=""Infocontent""><Br>恭喜您,回复留言成功^_^<br><a class=""m_0"" href=""POPbook.asp"" title=""返回留言本"">点击这里查看留言,或3秒后自动返回留言本</a><meta http-equiv=""refresh"" content=""3;URL=POPbook.asp""><Br><br></div></div>") rs.close set rs=nothing end if end if end if %> <!-- #include file="inc/Bottom.asp" -->