我检查管理员是否有许可证所以我按月检查登录我现在使用系统日期检查但管理员更改系统日期所以我想要日期BIOS日期
string crt_val = "",crt_mont = "",crt_year = ""; dt_v = objdata.select_upload(); if (dt_v.Rows.Count > 0) { crt_val = dt_v.Rows[0]["val"].ToString(); crt_mont = dt_v.Rows[0]["mon"].ToString(); crt_year = dt_v.Rows[0]["yer"].ToString(); //yy = Convert.ToInt32(crt_year); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true); return; } if (Verification.Trim() != "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true); return; } string fin=""; string oyear = ""; oyear = DateTime.Now.Year.ToString(); int nyear = DateTime.Now.Year + 1; int smonth = Convert.ToInt32(DateTime.Now.ToString("MM")); fin = oyear + "-" + nyear.ToString(); int num; switch (crt_mont) { case ("January"): num = 1; break; case ("February"): num = 2; break; case ("March"): num = 3; break; case ("April"): num = 4; break; case ("May"): num = 5; break; case ("June"): num = 6; break; case ("July"): num = 7; break; case ("August"): num = 8; break; case ("September"): num = 9; break; case ("October"): num = 10; break; case ("November"): num = 11; break; default: num = 12; break; } if ((num < smonth) || (num == smonth)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true); } else { if (crt_val == "0") { Session["UserId"] = txtusername.Text.Trim(); objuser.UserCode = txtusername.Text.Trim(); objuser.Password = s_hex_md5(txtpassword.Text.Trim()); string pwd = s_hex_md5(txtpassword.Text); objuser.Ccode = ddlCode.SelectedValue; objuser.Lcode = ddlLocation.SelectedValue; DataTable dt = new DataTable(); dt = objdata.UserLogin(objuser); if (dt.Rows.Count > 0) { if ((dt.Rows[0]["UserCode"].ToString().Trim() == txtusername.Text.Trim()) && (dt.Rows[0]["Password"].ToString().Trim() == pwd) && (dt.Rows[0]["CompCode"].ToString().Trim() == ddlCode.SelectedValue) && (dt.Rows[0]["LocationCode"].ToString().Trim() == ddlLocation.SelectedValue)) { Session["Isadmin"] = dt.Rows[0]["IsAdmin"].ToString().Trim(); Session["Usernmdisplay"] = txtusername.Text.Trim(); Session["Ccode"] = dt.Rows[0]["CompCode"].ToString().Trim(); Session["Lcode"] = dt.Rows[0]["LocationCode"].ToString().Trim(); if (Session["Isadmin"].ToString() == "1") { Session["RoleCode"] = "1"; } else { Session["RoleCode"] = "2"; } Response.Redirect("Dashboard.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('User Name and Password Wrong');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true); } } else { } }
Piotr Stapp.. 6
获取BIOS日期不会改变任何内容,因为如果有人更改了系统日期,硬件实时时钟也会发生变化.
更好的选择是检查客户端计算机之外的日期,例如检查一些URL.
获取BIOS日期不会改变任何内容,因为如果有人更改了系统日期,硬件实时时钟也会发生变化.
更好的选择是检查客户端计算机之外的日期,例如检查一些URL.