%@ Language=VBScript %>
<%
Response.Buffer = true
Response.Expires = -1
'/////////////////////////////////////////////////////////////////////////////////////
'/
'/ Functions
'/
'/////////////////////////////////////////////////////////////////////////////////////
Function GetClientInfo()
strConn = ";DRIVER={SQL Server};UID=BetUser;PWD=12NewYorkcitY2006;DATABASE=Betrci;SERVER=localhost;"
Set oConn = server.CreateObject("adodb.connection")
oConn.Open strConn
sSql = "Select * from vwClientInfo where upper(userid) = '" & ucase(txtUserCode) & "' "
Set RS = Server.CreateObject("ADODB.Recordset")
RS.CursorType = 3
RS.CursorLocation = 3
RS.ActiveConnection = oConn
RS.Open sSql
Set GetClientInfo= RS
End Function
'/////////////////////////////////////////////////////////////////////////////////////
'/
'/ Main Section
'/
'/////////////////////////////////////////////////////////////////////////////////////
Dim txtUserCode
Dim txtPassword
Dim oRS
Dim iResult
Dim strConn
Dim oConn
Dim sSQL
'On Error goto ErrorHandler
'User name is uppercased in c/s program. Password is not.
'Projectid is number so no upper.
txtUserCode = UCase(Trim(Request.Form("txtUserCode")))
txtPassword = Trim(Request.Form("txtPassword"))
Application("gConnectString") = ";DRIVER={SQL Server};UID=BetUser;PWD=12NewYorkcitY2006;DATABASE=Betrci;SERVER=localhost;"
'Response.Write "Name=" & txtUserCode & "
"
'Response.Write "Password=" & txtPassword & "
"
'Set oRS = Server.CreateObject("ADODB.Recordset")
Set oRS = GetClientInfo
'Response.write "Recordcount is: " & oRS.recordcount & "
"
Response.Write(oRS.RecordCount)
if oRS.RecordCount <> 0 then
Session("Usercode") = ucase(txtUserCode)
Session("ValidUser") = 1
Session("LastPage") = Session("CurrentPage")
Session("CurrentPage") = "CheckLogin.asp"
Session("ClientTypeID") = oRS.Fields("Client_Type_ID").value & ""
Session("ClientNickname") = oRS.Fields("Nickname").value & ""
Session("Credit_Limit") = oRS.Fields("Credit_Limit").value & ""
Session("JuiceDiscount") = oRS.Fields("JuiceDiscount").value & ""
Session("Agent_ID") = oRS.Fields("Agent_ID").value & ""
Response.Redirect "mainmenu.asp"
else
Session("Usercode") = ""
Session("ValidUser") = 0
Session("ClientTypeID") = ""
Session("ClientNickname") = ""
Session("Credit_Limit") = ""
Session("JuiceDiscount") = ""
Session("Agent_ID") = ""
Response.Redirect "login.asp"
end if
Response.Flush
set oRS = nothing
set oConn = nothing
Response.end
%>