<%
' ===========================================================
' PROJECT Thai Toys Create 05/12/2005..
' ===========================================================
' This program is license by Wiwat
'===========================================================
' MODULE: login.asp
' APP: Authentication
' AUTHOR: www.mangkhud.com
' CREATED:
' MODIFIED:
'============================================================
' COMMENT: This file will check authen by connect DB and set session
'
'============================================================
' ROUTINES:
'
'
'============================================================
'============================================================
If Request.Form("Action")<>"" Then
chkLogin=Request.Form("txt_login")
chkPassword=Request.Form("txt_password")
If chkLogin="" Then
Error_Login=" <img border=0 src=images/fail.gif width=16 height=16> กรุณาระบุชื่อ"
ElseIf chkPassword="" Then '------------------------------------------------------------------------------------------ ตรวจชื่อ userName
Error_Password=" <img border=0 src=images/fail.gif width=16 height=16> กรุณาระบุรหัสผ่าน"
Else
'==========================
' ตรวจสอบทั้งหมด ผ่านฐานข้อมูล
'==========================
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("main.mdb")
'======Open Recordset===================
SQL="SELECT * FROM staff WHERE username='"&chkLogin&"' and password='"&chkPassword&"'"
Set RS=Conn.Execute(SQL)
If RS.EOF Then '<< === ตรวจสอบเปรียบเทียบ ฐานข้อมูลไม่พบ
Error_User="<img border=0 src=images/fail.gif width=16 height=16> ไม่ผ่านการตรวจสอบกรุณาทดลองใหม่"
Else
If RS("lock")=true Then '<< === ตรวจสอบว่ามีการ lock user นี้หรือไม่
Error_User="<img border=0 src=images/fail.gif width=16 height=16> ไม่ผ่านการตรวจสอบ บัญชีคุณถูกระงับ "
Else
Session("userlevel")=RS("userlevel")
Session("username")=RS("username")
Response.Redirect "manage/main.asp"
End If
End If
RS.Close
Conn.Close
Set RS=Nothing
Set Conn=Nothing
End If
End If
%>