www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > chinese/CheckLogin.asp
<!--#include file="../opendb.asp" --> <!-- #Include File="../common/md5.asp" --> <% response.Charset = "gb2312" '在gb2312必用,UTF8可不用 select Case request("LoginAct") case "CheckLogin" response.write "<script>alert('hi');</script>" Dim plippwd,iun,ipwd,stopus plippwd="请输入用户名或密码!" iun="用户名错误!" ipwd="密码错误" stopus="对不起,您的用户名已被暂停或未通过审核!" Dim LoginUserName,Loginpassword,usercookies,userip,GetUserID LoginUserName=left(trim(Request("username")),20) Loginpassword=left(trim(Request("password")),20) usercookies=Request.Form("usercookies") LoginUserName=sqlchkchar(LoginUserName) Loginpassword=sqlchkchar(Loginpassword) Loginpassword=MD5(Loginpassword) If LoginUserName="" or Loginpassword="" Then response.write "<div class=""LoginMess_error red"">"&plippwd&"</div>" End If if usercookies="" then usercookies="0" rs.open "select UserID,UserName,UserPassword,IsLocked,isPassed,weblevel from cnk_users where UserName='"&LoginUserName&"'",conn,1,3 If rs.recordcount=0 Then response.write "<div class=""LoginMess_error red"">"&iun&"</div>" rs.close Else If rs("UserPassword")<>Loginpassword Then response.write "<div class=""LoginMess_error red"">"&ipwd&"</div>" rs.close Else If rs("IsLocked")=1 or rs("isPassed")=0 Then response.write "<div class=""LoginMess_error red"">"&stopus&"</div>" rs.close 'response.End Else'登录成功 Select Case usercookies Case "0" Response.Cookies(cookies_name)("UserID")=rs("UserID") Response.Cookies(cookies_name)("UserName")=LoginUserName Response.Cookies(cookies_name)("UserPwd")=Loginpassword Response.Cookies(cookies_name)("weblevel")=rs("weblevel") Case "1" Response.Cookies(cookies_name).Expires=Date+1 Response.Cookies(cookies_name)("UserID")=rs("UserID") Response.Cookies(cookies_name)("UserName")=LoginUserName Response.Cookies(cookies_name)("UserPwd")=Loginpassword Response.Cookies(cookies_name)("weblevel")=rs("weblevel") Case "2" Response.Cookies(cookies_name).Expires=Date+30 Response.Cookies(cookies_name)("UserID")=rs("UserID") Response.Cookies(cookies_name)("UserName")=LoginUserName Response.Cookies(cookies_name)("UserPwd")=Loginpassword Response.Cookies(cookies_name)("weblevel")=rs("weblevel") Case "3" Response.Cookies(cookies_name).Expires=Date+365 Response.Cookies(cookies_name)("UserID")=rs("UserID") Response.Cookies(cookies_name)("UserName")=LoginUserName Response.Cookies(cookies_name)("UserPwd")=Loginpassword Response.Cookies(cookies_name)("weblevel")=rs("weblevel") End Select userip=GetRealIP() conn.execute("update cnk_users set Jifen=Jifen+2,LastLoginIP='"&userip&"',LastLoginTime='"&now()&"',LoginTimes=LoginTimes+1 where UserID="&rs("UserID")) '登录加分 If isBBS=1 Then Call userjibie(LoginUserName) Dim rsjb,gc,gr set rsjb=conn.execute("select UserLevel,Jibie from cnk_users where UserName='"&LoginUserName&"'") set gc=conn.execute("select GroupRight from Cnk_Jibie where LevelName='"&rsjb(1)&"'") gr=gc(0) Response.Cookies(cookies_name)("UserGroupRight")=gr If rsjb(0)>0 Then session.timeout=60 session("GroupRight")=gr End If End If rs.close End If End If End If call closedb() case "LoginOut" Response.Cookies(cookies_name)("username")="" Response.Cookies(cookies_name)("userid")="" Response.Cookies(cookies_name)("UserLevel")="" Response.Cookies(cookies_name)("UserGroupRight")="" end select username=Request.Cookies(cookies_name)("username") '虽然重复,还得要这行 If username<>"" Then %> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1"> <form name="formu" method="post"> <tr> <td colspan="4" align="center"><div class="LoginMess_error">欢迎您,<font color="#FF9900"><b><%=UserName%></b></font></div></td> </tr> <tr> <td width="10%">>></td> <td width="43%"><a href="users.asp">用户中心</a></td> <td width="8%">>></td> <td width="39%"><a href="users.asp?action=modiinfo&subtitle=修改信息">修改信息</a></td> </tr> <tr> <td>>></td> <td><a href="users.asp?action=myorder&subtitle=我的订单">我的订单</a></td> <td>>></td> <td><a href="users.asp?action=modipwd&subtitle=修改密码">修改密码</a></td> </tr> <tr> <td>>></td> <td><a href="users.asp?action=myguestbook&subtitle=个人留言">个人留言</a></td> <td>>></td> <td><a href="users.asp?action=myfavorite&subtitle=我的收藏">我的收藏</a></td> </tr> <tr> <td colspan="4" align="center"> <% If isImgButton=0 Then %> <input type="button" name="btnb" value="退出系统" class="button" onclick="UserLoginOut();" /> <% Else %> <a href="javascript:void(0);" onclick="UserLoginOut();"><img src="<%=UpDir%>images/button_signout.gif" border="0" /></a> <% End If %> <input name="LoginAct" type="hidden" id="LoginAct" value="LoginOut" /></td> </tr> </form> </table> <% else response.write "<form name=""cmt"" method=""post"">" response.write "<div class=""leftusernamebox"">用户名:</div>" response.write "<div class=""leftinputbox""><input name=""username"" type=""text"" class=""input"" size=""13"" maxlength=""20"" /></div>" response.write "<div class=""leftusernamebox"">密 码:</div>" response.write "<div class=""leftinputbox""><input name=""password"" type=""password"" class=""input"" size=""13"" maxlength=""20"" /></div>" response.write "<div class=""clearboth""></div>" response.write "<div id=userloginMess class=LoginErMess></div>" response.write "<div align=""center"">" If isImgButton=0 Then response.write "<input type=""submit"" name=""LoginSubmit"" value=""登录"" onclick=""UserNeedLogin();"" class=""button"" /> <input type=""button"" name=""Register"" value=""注册"" onclick=""window.open('users.asp?action=register');"" class=""button"" /> <input type=""button"" name=""fgpwd"" value=""忘密码?"" onclick=""window.open('users.asp?action=forgetpwd&subtitle=取回密码');"" class=""button"" />" Else response.write "<input type=""image"" name=""imageField"" src="""&UpDir&"images/button_signin.gif"" onclick=""UserNeedLogin();"" /> <a href=""javascript:void(0);"" onclick=""window.open('users.asp?action=forgetpwd');""><img src="""&UpDir&"images/button_fgpwd.gif"" border=""0"" /></a> <a href=""javascript:void(0);"" onclick=""window.open('users.asp?action=register');""><img src="""&UpDir&"images/button_register.gif"" border=""0"" /></a>" End If response.write "<input name=""yuyan"" type=""hidden"" id=""action"" value=""0"" />" response.write "<input type=""hidden""value=""CheckLogin"" name=""LoginAct"" />" response.write "</div>" response.write "</form>" end if %>