国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
檢查用戶是否登錄
一般檢查用戶是否登錄都不用cookie,因為存在不安全的因素,最好用session先檢測用戶合法性,合法之后給當(dāng)前會話頒發(fā)一個令牌,然后檢驗令牌即可。具體代碼如下1:檢測授權(quán)if(合法用戶)//具體檢驗代碼略{session("flag")="true"session("user_name")=當(dāng)前用戶}else{Response.write("用戶名或密碼錯誤!");}2、檢測是否登錄if(session("flag") != null && session("flag") ="true"){Response.write("歡迎您:"&session("user_name"));}else{Response.write("請登錄");}更多請登錄左雷工作室網(wǎng)站:drawnet.cn 
最好用session<%Username=request.form("Username")Password=request.form("Password")set rs=server.CreateObject("adodb.recordset")rs.Open "select * from UserRegInfo where Username='"&Username&"' and Password='"&Password&"' " ,conn,1,1if not rs.eof and not rs.bof thensession("loginstat")="true"elseresponse.Write "<script LANGUAGE='javascript'>alert('對不起,用戶名及密碼不正確,登錄失??!');history.go(-1);</script>"response.endend if%><%if session("loginstat")="true" then%>讓成功登錄的用戶看些什么內(nèi)容,或者能做些什么東西。<%end if%> 
using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Configuration;using System.Web;using NafusenModels;namespace NafusenBLL{public class CheckCookieExits{public static void LoginUserExits(){//判斷cookie中是否有數(shù)值if (System.Web.HttpContext.Current.Request.Cookies["UserCookie"] == null){System.Web.HttpContext.Current.Response.Redirect("~/UpdateMessage.aspx");}else{string username = System.Web.HttpContext.Current.Request.Cookies["UserCookie"]["Username"];string pwd = System.Web.HttpContext.Current.Request.Cookies["UserCookie"]["Upwd"];bool Exits = UsersManager.UserNameExists(username);if (Exits){Users user = UsersManager.UsersLogin(username, pwd);if (user != null){response.write("<script>alert('您已登錄!')</script>");}else{System.Web.HttpContext.Current.Session["message"] = "['" + username + "'],您輸入的密碼有誤,請仔細(xì)核查";System.Web.HttpContext.Current.Response.Redirect("~/Error.aspx");}}else{System.Web.HttpContext.Current.Session["message"] = "['" + username + "'],對不起,沒有此用戶名,請您注冊后登錄!";System.Web.HttpContext.Current.Response.Redirect("~/Error.aspx");}}}}} 
一齊用吧<?phpsession_start();$session_id = session_id();$ck = 'abcd1234'; //加密串$username = $_POST['username'];  //登陸名setcookie('user',$username,time()+86400,'/');setcookie('ckuser',substr(md5($username.$session_id.$ck),0,16),time()+86400,'/');?>檢查是否登陸的時候,判斷三個地方,三個地方都通過則代表登陸存在$_COOKIE['user']存在$_COOKIE['ckuser']$_COOKIE['ckuser']的值等于substr(md5($_COOKIE['user'].$session_id.$ck),0,16) 
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
c#中cookies的存取操作
index.aspx.cs 02/admin/登錄模塊
FormsAuthentication.SignOut() 會刪除所有登錄憑證
ASP內(nèi)建對象Application 和 Session和cookie的用法
asp防止同時登陸的問題
跨域讀取Cookie和session之HttpWebRequest另類方法(網(wǎng)站API開發(fā)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服