 <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<%
Dim ExComm
Set ExComm=new Ex_CommonCls
ExComm.GetConfigCache("runmode,ShowName,CmtPageSize,IsCheckCode,cmtmsgcheckre,iscmtmsgcheck,LogNum,blogname,BlogDescription,BlogKeyWord,IndexAddWord,blogurl,logourl,DefaultSkin")
ExComm.CheckInstall
ExComm.IsIpAllow
Dim Title,Show_logids,show_blogKeyword
dim action
action=request.QueryString("action")
select case action
case "login"
call login()
case else
call loginf()
end select
Function loginf()
if request.Cookies(Md5(sn))("uname")="" and session("user")="" Then
Dim temp
temp=temp&"<form name=""form1"" method=""post"" action=""userlogin.asp?action=login"">"
temp=temp&"<table width=""60%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"
temp=temp&"  <tr>"
  temp=temp&"  <td height=""22"" colspan=""2""><div align=""center"">用户登陆</div></td>"
  temp=temp&"</tr>"
  temp=temp&"<tr>"
    temp=temp&"<td width=""39%""><div align=""right"">用户名:&nbsp;</div></td>"
    temp=temp&"<td width=""61%""><label>"
      temp=temp&"<input name=""username"" type=""text"" id=""username"">"
    temp=temp&"</label></td>"
  temp=temp&"</tr>"
  temp=temp&"<tr>"
  temp=temp&"<td><div align=""right"">密码:&nbsp;</div></td>"
   temp=temp&"<td><label>"
   temp=temp&"<input name=""userpwd"" type=""password"" id=""userpwd"">"
    temp=temp&"</label></td>"
  temp=temp&"</tr>"
  temp=temp&"<tr>"
   temp=temp&" <td><div align=""right"">记住密码:&nbsp;</div></td>"
   temp=temp&" <td><label>"
    temp=temp&"<input name=""remember"" type=""checkbox"" id=""remember"" value=""1"">"
    temp=temp&"&nbsp;&nbsp;<a href=""UserReg.asp"">用户注册</a>&nbsp;<a href=""UserEditINFO.asp?action=FIndPwd"">忘记密码</a> </label></td>"
  temp=temp&"</tr>"
  temp=temp&"<tr>"
   temp=temp&" <td colspan=""2""><label>"
    temp=temp&"<div align=""center"">"
      temp=temp&"  <input type=""submit"" name=""Submit"" value=""登陆"">"
       temp=temp&" <input type=""reset"" name=""Submit2"" value=""取消"">"
      temp=temp&"</div>"
    temp=temp&"</label></td>"
    temp=temp&"</tr>"
temp=temp&"</table>"
temp=temp&"</form>"
Else 
session("user")=request.Cookies(Md5(sn))("uname")
temp=temp&"<p>&nbsp;</p>"
temp=temp&"<table width=""60%"" border=""0"" align=""center"" cellpadding=""1"" cellspacing=""1"">"
 temp=temp&" <tr>"
    temp=temp&"<td height=""22"" colspan=""2""><div align=""center"">用户管理</div></td>"
  temp=temp&"</tr>"
 temp=temp&" <tr>"
   temp=temp&" <td width=""49%""><div align=""center"">&nbsp;</div></td>"
    temp=temp&"<td width=""51%""><label>"
     temp=temp&" <div align=""center"">&nbsp;&nbsp;&nbsp;</div>"
    temp=temp&"</label></td>"
  temp=temp&"</tr>"
  temp=temp&"<tr>"
  temp=temp&"  <td><div align=""center""><a href=""UserEditInfo.asp"">修改资料</a></div></td>"
  temp=temp&"  <td><label>"
     temp=temp&" <div align=""center""><a href=""UserEditINFO.asp?action=loginout"">注销登陆</a></div>"
   temp=temp&"</label></td>"
  temp=temp&"</tr>"
  temp=temp&"<tr>"
   temp=temp&" <td>&nbsp;</td>"
    temp=temp&"<td><label></label></td>"
  temp=temp&"</tr>"
temp=temp&"</table>"
End If 
loginf=temp
end Function
sub login()
dim username,userpwd,remember,userSql,userRs
username=ExComm.G(request.form("username"))
userpwd=ExComm.G(request.form("userpwd"))
remember=CInt(request.form("remember"))
userSql="select userpwd,lock,homepage from Ex_user where username='"&username&"'"
set userRs=server.createobject("adodb.recordset")
userRs.open userSql,Conn,1,1
if not userRs.eof and not userRs.bof then
	if Trim(userRs("userpwd"))=md5(trim(userpwd)) then
		if userRs("lock")=true then
			ExComm.ShowMsg "账号被锁定",request.ServerVariables("HTTP_REFERER")
		end If
		response.Cookies(Md5(sn))("uname")=ExComm.DeCode(username)
		response.Cookies(Md5(sn))("upwd")=ExComm.DeCode(md5(userpwd))
		response.Cookies(Md5(sn))("homepage")=ExComm.DeCode(userRs("homepage"))
		session("user")=username
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
		if remember=1 then
			response.Cookies(sn).Expires=date+365
		end If
	else
		ExComm.ShowMsg "密码不正确",request.ServerVariables("HTTP_REFERER")
	end if
else
	ExComm.ShowMsg "用户名不存在",request.ServerVariables("HTTP_REFERER")
end if
end sub

'主模板标记替换开始
Dim ExSkin,Head,Body,Bottom,Skin1
Set ExSkin=new Ex_SkinCls
Skin1=ExSkin.GetTxtSkin("default.html")
Body=Replace(Skin1,"$show_log$",loginf)
Body=Replace(Body,"$show_info$",ExSkin.Info)
Body=Replace(Body,"$show_login$",ExSkin.Login)
Body=Replace(Body,"$show_calendar$",ExSkin.calendar("","",""))
Set ExSkin=Nothing    
Bottom=ExComm.BottomInfo
Title="用户登陆"
'输出内容
Head=Head&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&vbcrlf
Head=Head&"<head>"&vbcrlf
Head=Head&"<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">"&vbcrlf
Head=Head&"<meta name=""generator"" content=""易心博客"">"&vbcrlf
Head=Head&"<meta name=""Description"" content="""&Application(sn&"BlogDscription")&""">"&vbcrlf
Head=Head&"<meta name=""Keywords"" content="""&Application(sn&"BlogKeyWord")&""">"&vbcrlf
Head=Head&"<title>"&Title&Application(sn&"IndexAddWord")&"</title>"&vbcrlf
Head=Head&"<script src=""inc/Main.js""></script>"
Head=Head&"<script src=""inc/UserInfo.js""></script>"
Head=Head&"<script src=""inc/jquery.js""></script>"
Head=Head&"<link href=""inc/OblogSkin.Css"" rel=""stylesheet"" type=""text/css"" />"&vbcrlf
Head=Head&"</head>"&vbcrlf
Head=Head&"<body>"&vbcrlf
If ExComm.IsOblogSkin Then 
	Response.Write Head
	Response.Write Body
	Response.Write "</body></html>"
Else
	Body=Replace(Body,"$show_blogtitle$",Title&Application(sn&"IndexAddWord"))
	Body=Replace(Body,"$show_blogkeyword$",Application(sn&"blogkeyword"))
	Body=Replace(Body,"$show_blogdescription$",Application(sn&"blogdescription"))
	Response.Write Body
End If 
If request.querystring("action")="add" Then
Call add()
End if
If Application(Sn&"Runmode")<>"静态" Then 
	ExComm.visitorCount
End If
Set ExComm=Nothing 
%>