<!--#include file="../../conn.asp" -->
<%
if wishopen<>"sys" then
uid=request("uid")
user=request("user")
else
uid=0
user="sys"
end If
Mitoo="23,53,654,dfd,la,erz,ye,8978,xvcw,134,75d,oid,qev,5143,zcc,087,414,04,14,tct,624,96,zrq,988,41f,ere,9fke,13478,14zde,5778,d,14df,cfq,5134,adfd,1434,8783,dr4,43q,7256,dreq3434,15gqre8,ad438,zd870,1343,34zdrf,561087,414adrfk,76776,zdrer,976734df,134gfe,3y7a,4adv,543967cdr,34daecc,134dfuy7,1345434fvva,96786,134cfe"
mitoos=Split(Mitoo,",")
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
'if mid(server_v1,8,len(server_v2))<>server_v2 then
'response.write "你提交的路径有误，禁止从站点外部提交数据！"
'response.end
'end if

wishopen=request("wishopen")
if wishopen="yes" or wishopen="sys" then
wishopenword="状态:访客可用"
else
wishopenword="状态:主人专用"
end if
userid="admin"			'管理员名称
userpass="admin"			'管理用密码
use_img="OFF"			'不用改
use_html="ON"		        'HTML使用 (ON/OFF)
show=36			        '不用改
time_ctrl="+0"		        '时差
title="日记人愿望小寺"		        '祈愿板标题
bggif="pic/bg.gif"		'背景图
titlegif="pic/wish.gif" 	'标题图
tdcolor="#808080"		'表框颜色 (建议深色,前方必须加"#")
trcolor="#ececec"		'表格颜色 (建议浅色,前方必须加"#")
trcolor1="#FFFFFF"		'背景颜色 (建议浅色,前方必须加"#")
trcolor2="#000000"		'文字颜色 (建议深色,前方必须加"#")

Select case Request("action")
case "click"
   Call SLIGHTBOY_Click
case "post" 
   Call SLIGHTBOY_Post
case "add"
   Call SLIGHTBOY_Add
case "super" 
   Call SLIGHTBOY_Super
case "admin"
   Call SLIGHTBOY_Admin
case "del"
   Call SLIGHTBOY_Del
case Else
   Call SLIGHTBOY_Look
end Select

Function SLIGHTBOY_Look
Call HtmlStart
if wishopen="sys" then
Sql = "Select id,name,birth,counter From wish Order BY id DESC"
else
Sql = "Select id,name,birth,counter From wish where userid="&uid&" Order BY id DESC"
end if
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open Sql,conn,1,1
TotalRecord=Rs.RecordCount
Rs.PageSize=Show
MaxPage=Rs.pagecount

OrderPage=Clng(Request("page"))

IF OrderPage="" or OrderPage=0 then
   OrderPage=1
ElseIF OrderPage > MaxPage Then
   OrderPage=MaxPage
End IF
%> 

<%
IF Session("ProwerAdmin")=True Then
Response.Write "<form method=""post"" action=""wish.asp?action=del"">"
End IF
%>
<table border="0"cellpadding="0" cellspacing="0" align="center">
  <tr> 
          <td valign="bottom" colspan="3"><img src="pic/st01.gif" width="382" height="76"></td>
        </tr>
        <tr> 
          <td valign="top" width="41"><img src="pic/st02.gif" width="41" height="180"></td>
          
    <td valign="top" width="300" background="pic/st04.gif" style="font-size:2pt"> 
      <%
IF not Rs.eof Then
IF OrderPage <> 1 Then
Rs.Move (OrderPage-1)*Show
End IF
i=1
maxid=Rs("id")
Do While not Rs.eof and i<=Show
IF Session("ProwerAdmin")=True Then
Response.Write "<input type=""checkbox"" name=""Del"&Rs("id")&""">"
End IF
Response.Write "<a href=""wish.asp?action=click&wishopen="&wishopen&"&uid="&uid&"&user="&user&"&number="&Rs("id")&""" ONMOUSEOVER=""pop('"&Rs("name")&"许了一个愿...有"&Rs("counter")&"人看过','"&trcolor&"')"";  ONMOUSEOUT=""kill()""><img src=""pic/c"&Rs("birth")&".gif"" width=48 border=0></a>"&chr(13)
minid=Rs("id")
i=i+1
Rs.MoveNext
Loop
End IF
Rs.Close
Set Rs=Nothing
%>
    </td>
          <td valign="top" width="41"><img src="pic/st03.gif" width="41" height="180"></td>
        </tr>
        <tr>
          <td valign="top" width="41">&nbsp;</td>
          <td valign="top" width="294" style="font-size:2pt">
            <table border="0" cellpadding="2" cellspacing="0" width="100%">
              <tr> 
                
          <td align="center" width="80"> <a href="wish.asp?uid=<%=request("uid")%>&user=<%=request("user")%>&wishopen=<%=request("wishopen")%>">愿望小寺</a> 
            <a href="wish.asp?action=post&uid=<%=request("uid")%>&user=<%=request("user")%>&wishopen=<%=request("wishopen")%>">许愿</a></td>
                <td>
            <select name="SLIGHTBOY" onChange="location.href=this.options[this.selectedIndex].value;">
              <%
Response.Write "<option value='wish.asp?page="&OrderPage&"' selected>第"&OrderPage&"页*</option>"
 For i= 1 TO MaxPage
  Response.Write "<option value='wish.asp?uid="&request("uid")&"&user="&request("user")&"&wishopen="&request("wishopen")&"&page="&i&"'>第"&i&"页</option>"
 Next
%>
            </select>
            共<%=TotalRecord%>笔 <%=wishopenword%></td>
              </tr>
            </table>
          </td>
          <td valign="top" width="41">&nbsp;</td>
        </tr>
      </table>
      <%
IF Session("ProwerAdmin")=True Then
Response.Write "<input type=hidden name=maxid value="&maxid&">"&chr(13)
Response.Write "<input type=hidden name=minid value="&minid&">"&chr(13)
Response.Write "<input type=""submit"" value="" 删除 "" style=""HEIGHT:22PX;BACKGROUND-COLOR:"&trcolor&";BORDER:1 SOLID BLACK"">"&chr(13)
Response.Write "</form>"
End IF
%>
<%
Call HtmlEnd
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SLIGHTBOY_Click
Call HtmlStart
if wishopen="sys" then
Sql = "Select * From wish Where id="&Clng(Request.Querystring("number"))
else
Sql = "Select * From wish Where userid="&uid&" and id="&Clng(Request.Querystring("number"))
end if
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open Sql,conn,1,3
birth=Rs("birth")
msg=Rs("msg")
info= Rs("name")&" 于 "&Rs("wishdate")&" 留下此愿"
Rs("counter")=Rs("counter")+1
Rs.Update
Rs.Close
Set Rs=Nothing
%>
    <table border="0"cellpadding="0" cellspacing="0" align="center">
      <tr> 
        <td valign="bottom" colspan="3"><img src="pic/st01.gif" width="376" height="76"></td>
      </tr>
      <tr> 
        <td valign="top" width="41"><img src="pic/st02.gif" width="41" height="180"></td>
    <td valign="top" width="294" background="pic/st04.gif" style="font-size:2pt" align="center"> 
      <table border="0" cellpadding="0" cellspacing="0" width="290" style="border:1px solid #CEB068; " height="175">
        <tr> 
<td background="pic/b<%=birth%>.gif"> 
                
            <table border="0" width="100%" cellspacing="0" cellpadding="4" height="100%">
              <tr> 
                    
                <td valign="top" colspan="2" height="150"><font color="#A08034"><%=msg%></font></td>
                  </tr>
                  <tr> 
                    <td></td>
                    <td align="center"><font color="#A08034"><%=info%></font></td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
    </td>
        <td valign="top" width="41"><img src="pic/st03.gif" width="41" height="180"></td>
      </tr>
      <tr> 
        <td valign="top" width="41">&nbsp;</td>
        
    <td valign="top" width="294">
      <table border="0" cellpadding="2" cellspacing="0" width="100%">
        <tr> 
          <td align="center" width="80"> <a href="wish.asp?uid=<%=request("uid")%>&user=<%=request("user")%>&wishopen=<%=request("wishopen")%>">愿望小寺</a> 
            <a href="wish.asp?action=post&uid=<%=request("uid")%>&user=<%=request("user")%>&wishopen=<%=request("wishopen")%>">许愿</a></td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </td>
        <td valign="top" width="41">&nbsp;</td>
      </tr>
    </table>
<%
Call HtmlEnd
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SLIGHTBOY_Admin
IF Request.Form("id")="" Then Error("您忘了填写名字")
IF Request.Form("passid")="" Then Error("您忘了填写密码")
IF Instr("'",Request.Form("id"))<>"0" or Instr("""",Request.Form("id"))<>"0" or Instr("'",Request.Form("passid"))<>"0" or Instr("""",Request.Form("passid"))<>"0" Then Error("名字或密码中含有非法字符")
IF Request.Form("id")<>userid or Request.Form("passid")<>userpass Then
Error("密码错误")
Else
Session("ProwerAdmin")=True
Response.Redirect "wish.asp"
End IF
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SLIGHTBOY_Add
o=Request.QueryString("o")
if InStr(mitoo,o)>0 Then
else
Response.write("<script language='javascript'>alert('禁止非法提交数据！');history.back(-1);</script>")
response.end
end if
IF Request.Form("name")="" Then 
Response.write("<script language='javascript'>alert('您忘了填写名字!');history.back(-1);</script>")'Error("您忘了填写名字")
response.End
End if
IF Request.Form("birth")="" Then 
Response.write("<script language='javascript'>alert('您忘了选择愿望类别');history.back(-1);</script>")'Error("您忘了选择愿望类别")
response.End
End if
IF Request.Form("msg")="" Then 
Response.write("<script language='javascript'>alert('您忘了填写愿望!');history.back(-1);</script>")'Error("您忘了填写愿望")
response.End
End if

IF use_html="ON" Then
msg=HTMLcode(Request.Form("msg"))
Else
msg=HTMLEncode(Request.Form("msg"))
End IF

Sql = "Select TOP 1 * From wish Order BY id DESC"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open Sql,conn,1,3
IF Rs.Eof Then
Rs.AddNew
Rs("name")=Trim(Replace(Request.Form("name"),"'",""))
Rs("birth")=Request.Form("birth")
Rs("msg")=msg
Rs("userid")=uid
Rs("username")=user
Rs("wishdate")=now+time_ctrl
Rs.Update

Else
 IF Rs("msg")=msg Then
 Error("请勿重覆登录")
 Else
 Rs.AddNew
 Rs("name")=Request.Form("name")
 Rs("birth")=Request.Form("birth")
 Rs("userid")=uid
Rs("username")=user
 Rs("msg")=msg
 Rs("wishdate")=now+time_ctrl
 Rs.Update
 End IF 
End IF
Rs.Close
Set Rs=Nothing
Response.Write "<html><head><title>"&title&"</title>"&_
               "<META HTTP-EQUIV=REFRESH CONTENT=1;URL=wish.asp?wishopen="&wishopen&"&uid="&uid&"&user="&user&">"&_
               "</head><body scroll=no bgcolor="&trcolor1&" text="&trcolor2&"><center><br><br>诚心祈求...</center></body></html>"
End Function

Function HTMLEncode(fString)
IF not isnull(fString) then
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")

    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(34), "&quot;")
    fString = Replace(fString, CHR(39), "&#39;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
    fString = Replace(fString, CHR(10), "<BR> ")
    HTMLEncode = fString
End IF
End Function

Function HTMLcode(fString)
IF not isnull(fString) then
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
    fString = Replace(fString, CHR(10), "<BR>")
    HTMLcode = fString
End IF
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SLIGHTBOY_Del
IF Session("ProwerAdmin")<>True Then Error("不要捣乱奥")
maxid=Cint(Request.Form("maxid"))
minid=cint(request.form("minid"))
for i= minid to maxid step 1
  IF Request.Form("del"&i) = "on" Then
       Sql="delete from wish where id="&i
       conn.execute(Sql)
  End IF
Next
conn.close
Set conn=Nothing
Response.Redirect"wish.asp"
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SLIGHTBOY_Post
Call HtmlStart
%>
<form method="post" action="wish.asp?o=<%=mitoos(Minute(now()))%>&action=add&wishopen=<%=request("wishopen")%>&uid=<%=request("uid")%>&user=<%=request("user")%>" style="margin:0px;">
  <table border="0"cellpadding="0" cellspacing="0" align="center">
    <tr> 
      <td valign="bottom" colspan="3"><img src="pic/st01.gif" width="376" height="76"></td>
    </tr>
    <tr> 
      <td valign="top" width="41"><img src="pic/st02.gif" width="41" height="180"></td>
      <td valign="middle" width="294" background="pic/st04.gif" style="font-size:2pt"> 
        <table border="0" cellpadding="0" cellspacing="0" width="294" align="center" bgcolor="#FFFFFF" height="180">
          <tr> 
            <td align=center width="50" height="30">姓名:</td>
            <td> 
              <input maxlength="12" size="12" name="name" style="color:BLUE;width:100px;border:1px dashed #ccc">
            </td>
            <td align=center width="50">类别:</td>
            <td> 
              <select name="birth">
                <option value="" selected>请选择</option>
                <option value="love">爱 情</option>
                <option value="study">学 习</option>
                <option value="health">健 康</option>
                <option value="family">家 庭</option>
				<option value="friend">朋友</option>
                <option value="work">事 业</option>
                <option value="future">未 来</option>
                <option value="wealth">财 富</option>
                <option value="life">生 活</option>
                <option value="sorry">道 歉</option>
              </select>
            </td>
          <tr> 
            <td colspan="4" align="center" height="120"> 
              <textarea name="msg" style="width:290px;height:120px;overflow-y:auto;border:1px dashed #ccc"></textarea>
            </td>
          </tr>
          <tr> 
            <td align=center colspan=4 height="30"> 
<%if wishopen="yes" or wishopen="sys" then%>
              <input type="submit" value="确定送出" style="HEIGHT:22PX;BACKGROUND-color:<%=tdcolor%>;border:1px SOLID FFFFFF;color:FFFFFF" name="submit"><input type="reset" value="清除重来" style="HEIGHT:22PX;BACKGROUND-color:<%=tdcolor%>;border:1px SOLID FFFFFF;color:FFFFFF" name="reset">
              <%else%>
              当前状态:主人未开放访客使用.
              <%end if%>
              <input type="button" value="回上一页" onClick="history.back()" style="HEIGHT:22PX;BACKGROUND-color:<%=tdcolor%>;border:1px SOLID FFFFFF;color:FFFFFF" name="button">



            </td>
          </tr>
        </table>
</td>
      <td valign="top" width="41"><img src="pic/st03.gif" width="41" height="180"></td>
    </tr>
    <tr> 
      <td valign="top" width="41">&nbsp;</td>
      <td valign="top" width="294"> 
        <table border="0" cellpadding="2" cellspacing="0" width="100%">
          <tr> 
            <td align="center" width="80"> <a href="wish.asp?uid=<%=request("uid")%>&user=<%=request("user")%>&wishopen=<%=request("wishopen")%>">愿望小寺</a> 
              <font color="#666666">许愿</font></td>
            <td>&nbsp; </td>
          </tr>
        </table>
      </td>
      <td valign="top" width="41">&nbsp;</td>
    </tr>
  </table>
  <span style="width:100%;height:23;Filter:Shadow(color=#d9d9d9,direction=125)"> 
  <br>
  <br>
  </span> 
</form>
</BODY>
</html>

<%
End Function
Function HtmlStyle%>
<style type="text/css">
<!--
body, td, input, select   {font-family:宋体;font-size: 9pt;}
textarea, input, button  {font-family:宋体;font-size: 9pt;}
a:hover { font-family:宋体;text-decoration:none; color:red;}
a { font-family:宋体;text-decoration:none; color:#666;}
-->
</style>
<style type="text/css">
<!--
body{
overflow:scroll;overflow-x:hidden
}
.popper
{
  position : absolute;
  visibility : hidden;
}
//-->
</style>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<%End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function HtmlStart%>
<html>
<head>
<title><%=title%></title>
<%Call HtmlStyle%>
</head>
<body scroll=no bgcolor="<%=trcolor1%>" text="<%=trcolor2%>" background="<%=bggif%>">
<DIV ID="topdeck" CLASS="popper">　</DIV>
<SCRIPT>
var nav = (document.layers); 
var iex = (document.all);
var skn = (nav) ? document.topdeck : topdeck.style;
if (nav) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = get_mouse;
function pop(msg,bak) 
{
var content ="<table width=130 border=0 cellpadding=2 cellspacing=2 bgcolor=<%=tdcolor%>><tr><td><font color=#FFFFFF>"+msg+"</center></font></td></tr></table>";
  if (nav) 
  { 
    skn.document.write(content); 
	  skn.document.close();
	  skn.visibility = "visible";
  }
    else if (iex) 
  {
	  document.all("topdeck").innerHTML = content;
	  skn.visibility = "visible";  
  }
}

function get_mouse(e) 
{
	var x = (nav) ? e.pageX : event.x+document.body.scrollLeft; 
	var y = (nav) ? e.pageY : event.y+document.body.scrollTop;
	skn.left = x - 60;
  skn.top  = y+20;
}

function kill() 
{
  skn.visibility = "hidden";
}

</SCRIPT>

<%End Function
Function HtmlEnd
Response.Write "</BODY></html>"
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function Error(msg)
Call HtmlStart
Response.Write "<p align=center><br><br><font color=RED>"&msg&"</font></p>"
Call HtmlEnd
Response.End
End Function
%>
