<!--#include file=conn.asp-->
<!--#include file=const.asp -->
<!--#include file=md5.asp -->
<% dim rs , exec %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=sitetitle%></title>
<META name="Author" content="木鸟">
<link rel="stylesheet" href="style/<%=skin%>.css" type="text/css">
</head>

<body>
<!--#include file="head.asp"-->
<br>
<table border="0" width="400" cellspacing="0" cellpadding="10" bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center" class="table004">
 <tr> 
  <td class=table003 align=center>用户登陆
  </td>
  </tr>
  <tr>
  
  <td class="table001" align="center"> 
<%
main()
connclose()

sub main()
	dim backInput, homeInput
	backInput= "<br><br><input type=button value=返回前页 onClick=history.back() class=input2 name=button ><br>"
	homeInput="<br><br><input type=button value=进入留言本首页 onClick=""location.href='index.asp?' "" class=input2><br>"
	if request.form="" then
%>

   <form name="form" method="post">
	<table width="80%" border="0">
	 <tr> 
	  <td width="30%">用 户 名：</td>
	  <td width="70%"> 
	   <input type="text" name="name" size="20" class="input1" value="" maxlength="20">
	  </td>
	</tr>
	 <tr> 
	  <td>密　　码：</td>
	  <td> 
	   <input type="password" name="pass" size="20" class="input1" value="" maxlength="20" >
	  </td>
	 </tr>
	 <tr align="center"> 
	  <td colspan="2" height="40">
	  登陆保留：<input type=radio name="expTime" value="" checked>不保留
	  <input type=radio name="expTime" value="<%=dateAdd("d",1,now)%>">1天
	  <input type=radio name="expTime" value="<%=dateAdd("ww",1,now)%>">1周
	  <input type=radio name="expTime" value="<%=dateAdd("m",1,now)%>">1月
	  <input type=radio name="expTime" value="<%=dateAdd("yyyy",1,now)%>">1年
	  <br>
	   <input type="submit" value=" 登 陆 " class="input2" name="Submit" >
	  </td>
	</tr>
   </table>
   </form>
<%
	else
		dim name, pass, expTime
		name=Encodestr(request.form("name"))
		pass=Encodestr(request.form("pass"))
		expTime=request.form("expTime")
		'response.write expTime
		'response.end
		if name="" or pass="" then
			response.write "<font color=red>发生错误</font><br><br>请输入用户名和密码！！！"
			response.write backInput
			exit sub
		end if

		pass=MD5(pass)
		
		exec="select * from [user] where username='"&name&"' "
		set rs=server.createobject("adodb.recordset")
		rs.open exec,conn,1,1
		if rs.eof then
			rsclose()
			response.write "<font color=red>发生错误</font><br><br>用户名不存在！！！"
			response.write backInput
			exit sub
		elseif (StrComp(name,rs("username"),0) <>0 or StrComp(pass,rs("userpassword"),0)<>0) then
			rsclose()
			response.write "<font color=red>发生错误</font><br><br>密码错误！！！"
			response.write backInput
			exit sub
		end if

		rsclose()
		response.write "<font color=red>登陆成功！！！</font>"
		response.write homeInput
		
		if cookiePath<>"" then
			response.cookies("gbook").Path=cookiePath
		end if
		response.cookies("gbook")("username")=vbescape(name)
		response.cookies("gbook")("password")=pass
		if expTime<>"" then
			expTime=Cdate(expTime)
			response.cookies("gbook").expires=expTime
		end if
	end if
end sub %>
   </td>
 </tr>
</table>
<!--#include file="foot.asp"-->

</body>

</html>
