<%
'Function login(byref username,byref password)
dim con,sql,rec
set con= Server.CreateObject("ADODB.Connection")
con.open "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root;pwd=admin;database=med;option=16384;"
sql= "Select * from officer where of_username='" & request.Form("username") & "' and of_password='" & request.Form("password") & "' "
set rec=con.execute(sql)
if not rec.EOF then
Session("user")=rec.fields("of_username").value
%>
<input name="user" type="hidden" value="<%=rec.fields("of_username")%>" />
<input name="pass" type="hidden" value="<%=rec.fields("of_password")%>" />
<%
response.Redirect("user/index.asp")
'response.Write(sql)
else
response.write("<script language='JavaScript'>")
response.write("alert('username or password ไม่ถูกต้อง');")
response.write("</script>")
end if
'end function
%>