www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Login.asp

    <!--#include file="include/conn.asp" -->
<!--#include file="include/char.asp" -->
<!--#include file="include/md5.asp" -->
<!--#include file="include/cb_main.asp" -->
<!--#include file="include/function.asp" -->
<%
If Caluoob.Com=true Then Response.Redirect "./"
Dim action,uname,uword,gourl,cookietm,emails,friends,UserFr
action=Request.Form("action")
emails=Replace(CheckStr(Request.Form("emails")),"'","''")
uword=Replace(md5(CheckStr(Request.Form("password"))),"'","''")
cookietm=ValidInteger(Request.Form("cookietm"))
gourl=Replace(Request.ServerVariables("http_referer"),"'","''")
if gourl="" then gourl="./"
Select Case Action
Case "checklogin"
	If Not Caluoob.ChkPost Then Response.end
	If emails="" then Caluoob.ShowErr("邮件地址不能为空!")
	If IsValidEmail(emails)=False then Caluoob.ShowErr("邮件地址格式不正确!")
	If uword="" then Caluoob.ShowErr("密码不能为空!")
	Dim Cookies_Path_S,Cookies_Path_D,Cookies_Path,i
	    Cookies_Path_S=Split(Request.ServerVariables("PATH_INFO"),"/")
	    Cookies_Path_D=ubound(cookies_path_s)
	    Cookies_Path="/"
	For i=1 to cookies_path_d-1
	    cookies_path=cookies_path&cookies_path_s(i)&"/"
	Next
	If Caluoob.CookiePath<>Cookies_Path Then
	   Caluoob.Execute("update [cb_system] set cookispath='"&cookies_path&"'")
	   Application(CachesName&"loadSystem")=False
	End If
	Cookies_Path=Caluoob.SysData(2,0)
	Dim myrs:Set myrs=Caluoob.Execute("select top 1 id,nicknames,passwords,display,locks,emails,friends from [cb_user] where emails='"&emails&"' and passwords='"&uword&"'")
	If not(myrs.eof and myrs.bof) then
	If myrs(4)=1 Then Caluoob.ShowErr("该帐户已被系统锁定。如有问题请与管理员联系。")
	Response.Cookies(CookieName).path=cookies_path
	If cookietm>0 then Response.Cookies(CookieName).Expires=Date+3600
	Response.Cookies(CookieName)("UserID") = myrs(0)
	Response.Cookies(CookieName)("NickName") = myrs(1)
	Response.Cookies(CookieName)("UserPW")= left(myrs(2),16)
	Response.Cookies(CookieName)("UserDisp")= myrs(3)
	If myrs(6)<>"" then Response.Cookies(CookieName)("UserFr")= myrs(6)
	Caluoob.Execute("update cb_user set lastlogin='"&now()&"',lastloginip='"&Caluoob.UserTrueIP&"' where id="&myrs(0)&"")
	Session("IndexHtml")=False
	Session("Deafult_Display")=False
	   response.Redirect("home.asp")
	Else
	   Caluoob.ShowErr("请确认用户数据是否正确!")
	End if
	myrs.close:set myrs=nothing

Case else
	Caluoob.OtherHerder Caluoob.SystemName&" |  登录"
	Caluoob.Login
	Dim StrHtml
	Response.Write StrHtml
	Caluoob.Footer
	Response.Flush()
End Select
%>