//''' 登出 public void LogOut() { //'加到session及cookie context.Session["UsrCde"] = ""; context.Session["UsrNme"] = ""; context.Session["UsrUid"] = ""; context.Session["UsrEml"] = ""; IZCls.Cookie CookieVar = new IZCls.Cookie(); CookieVar.AddValue("UsrCde", ""); CookieVar.AddValue("UsrNme", ""); CookieVar.AddValue("UsrUid", ""); CookieVar.AddValue("UsrEml", ""); CookieVar.SetCookieValue(context.Response, CookieName, CookieVar.GetStr(), 1); //'寫入cookie context.Session.Abandon(); WebFormBase.SetCookieValue(context.Response, CookieName, "", -1); WebFormBase.ShowJavaScriptMsgBack(context.Response, "謝謝您的光臨", "../" + AdminDefPath + "Login.aspx"); }
// ''' <summary> //''' 檢查帳號密碼 //''' </summary> //''' <param name="UID"></param> //''' <param name="PWD"></param> //''' <remarks></remarks> public void chkUidPwd(String UIDt, String PWDt) { if (UIDt == "") { WebFormBase.ShowJavaScriptMsgBack(context.Response, "請填帳號", ""); } if (PWDt == "") { WebFormBase.ShowJavaScriptMsgBack(context.Response, "請填密碼", ""); } IzDataSource IzDataSource = new IzDataSource(); IzDataSource.SelectString = "select * from tbUsr where tbUsrFlg=1 and tbUsrStu=1 and tbUsrUid=@tbUsrUid and tbUsrPwd=@tbUsrPwd"; IzDataSource.ParametersAdd("tbUsrUid", UIDt); IzDataSource.ParametersAdd("tbUsrPwd", PWDt); System.Data.DataTable tbUsr = IzDataSource.SelectDataTable(); if (tbUsr.Rows.Count > 0) { //'加到session及cookie context.Session["UsrCde"] = tbUsr.Rows[0]["tbUsrCde"].ToString(); context.Session["UsrNme"] = tbUsr.Rows[0]["tbUsrNme"].ToString(); context.Session["UsrUid"] = tbUsr.Rows[0]["tbUsrUid"].ToString(); context.Session["UsrEml"] = tbUsr.Rows[0]["tbUsrEml"].ToString(); IZCls.Cookie CookieVar = new IZCls.Cookie(); CookieVar.AddValue("UsrCde", context.Session["UsrCde"].ToString()); CookieVar.AddValue("UsrNme", context.Session["UsrNme"].ToString()); CookieVar.AddValue("UsrUid", context.Session["UsrUid"].ToString()); CookieVar.AddValue("UsrEml", context.Session["UsrEml"].ToString()); CookieVar.SetCookieValue(context.Response, CookieName, CookieVar.GetStr(), 3); //'寫入cookie //'寫入登入紀錄 //IzDataSource.ExecuteSQLNoneQuery("insert into tbLog(tbUsrCde,tbLogLdt,tbLogLip) values('" & context.Session("UsrCde") & "',getdate(),'" & context.Request.UserHostAddress & "')") //Dim tbUsrLcn As System.Data.DataTable = IzDataSource.GenDataTable("select count(*) from tbLog where tbUsrCde='" & context.Session("UsrCde") & "'") //IzDataSource.ExecuteSQLNoneQuery("update tbUsr set tbUsrLcn=" & tbUsrLcn.Rows(0).Item(0) & " where tbUsrCde='" & context.Session("UsrCde") & "'") //tbUsrLcn.Dispose() } else { WebFormBase.ShowJavaScriptMsgBack(context.Response, "帳號密碼錯誤!", ""); } tbUsr.Dispose(); IzDataSource.Dispose(); }