username=Request.form("uname")
password=Request.form("passwd")
'response.Write(username&" "&password)
If Request.Form("uname") = "" Then
Conn.Close
Set Conn=Nothing
Response.Redirect "mainlogin.asp"
Else
select case request("login")
case "1"
Set Rs2 = Server.CreateObject("ADODB.RecordSet")
sSQL2 = "select * from passwd WHERE username='" & username & "' AND passwd='" & password & "'"
Rs2.Open sSQL2, Conn, 3, 3, 1
If Rs2.RecordCount <> 0 Then
select case username
case "admin"
Session("Username") = username
Session("Password") = password
Session("yy") = year(date)+543
sdate=formatdatetime(date,2)
stime=time
Set Rs =Server.CreateObject("ADODB.Recordset")
Sql="Select * from login order by id desc"
Rs.open Sql,Conn,1,3
if rs.recordcount=0 then
id_=1
else
id_=rs("id")+1
end if
Rs.Addnew
Rs("id")=id_
Rs("timein")=stime
Rs("datein")=sdate
Rs("username")=username
Rs("logstatus")="OK"
Rs("ipaddress")=request.ServerVariables("REMOTE_ADDR")
Rs.update
Rs.Close
Response.Redirect "mis/admin/subpage.asp"
If Request.Form("uname") = "" Then ' บรรทัดนี้พอได้
Conn.Close ' บรรทัดนี้พอได้
Set Conn=Nothing ' บรรทัดนี้พอได้
Response.Redirect "mainlogin.asp" ' บรรทัดนี้พอได้
Else
select case request("login") 'บรรทัดนี้ไป ช่วยทำเป็น case แบบ php หน่อย อิอิ
case "1"
Set Rs2 = Server.CreateObject("ADODB.RecordSet")
sSQL2 = "select * from passwd WHERE username='" & username & "' AND passwd='" & password & "'"
Rs2.Open sSQL2, Conn, 3, 3, 1
If Rs2.RecordCount <> 0 Then
select case username
case "admin"
Session("Username") = username
Session("Password") = password
Session("yy") = year(date)+543
sdate=formatdatetime(date,2)
stime=time
Set Rs =Server.CreateObject("ADODB.Recordset")
Sql="Select * from login order by id desc"
Rs.open Sql,Conn,1,3
if rs.recordcount=0 then
id_=1
else
id_=rs("id")+1
end if
Rs.Addnew
Rs("id")=id_
Rs("timein")=stime
Rs("datein")=sdate
Rs("username")=username
Rs("logstatus")="OK"
Rs("ipaddress")=request.ServerVariables("REMOTE_ADDR")
Rs.update
Rs.Close
Response.Redirect "mis/admin/subpage.asp"