<% '*************************************************************** ' OM ' PROJECT: ISPAT COLLEGE ROURKELA : Online Library ' DOCUMENT: user_login.asp ' Description: User Login Page (Entry point to the System using Active Directory Login...) ' AUTHOR: Amitav Mohanty ' E-MAIL: amitav@hitsindia.com ' Developed By: Hi Technology & Services, India. ' Last Update: September 22, 2008 '**************************************************************/ If connectDBWeb() <> 1 then Response.Write("Could not connect to database") Response.End() End IF If connectDBLib() <> 1 then Response.Write("Could not connect to database") Response.End() End IF Dim user_login_type, user_name, user_password, member_id, member_password, stud_stream, stud_roll, stud_full_roll Dim rs, SQL Dim i Dim arrStreams(6) arrStreams(1) = "+2ARTS" arrStreams(2) = "+2COM" arrStreams(3) = "+2SC" arrStreams(4) = "BA" arrStreams(5) = "BCOM" arrStreams(6) = "BSC" '---- Check if Form is submitted ---- if Request.Form("logUser") = "" then '--- Form is not posted '--- Do nothing 'admin = "" Elseif Request.Form("logUser") = "Y" then '--- Form is posted call readFormData() If validateFormData() = 0 then '--- do nothing Else call processLogin() End IF End if %> <% '==== Read Form Data ==== Function readFormData() With Request user_login_type = ReplaceChars(.Form("user_login_type"), 0) user_name = ReplaceChars(.Form("user_name"), 0) user_password = ReplaceChars(.Form("user_password"), 0) member_id = ReplaceChars(.Form("member_id"), 0) member_password = ReplaceChars(.Form("member_password"), 0) stud_stream = ReplaceChars(.Form("stud_stream"), 0) stud_roll = ReplaceChars(.Form("stud_roll"), 0) 'admin = ReplaceChars(.Form("ADMIN"), 0) End With End Function '==== Validate Form Data (Returns: 1 / 0) ==== Function validateFormData() Dim myerr myerr = "" If user_login_type = "ADMIN" Then If user_name = "" then myerr = "User Login Name is not specified" ElseIf user_password = "" then myerr = "User Password is not specified" End IF ElseIf user_login_type = "FACULTY" Then If member_id = "" then myerr = "User Member ID is not specified" ElseIf member_password = "" then myerr = "User Member Password is not specified" End IF ElseIf user_login_type = "STUDENT" Then If stud_stream = "" then myerr = "Student Stream is not specified" ElseIf stud_roll = "" then myerr = "Student Roll No. is not specified" End IF End If If myerr = "" Then If user_login_type = "STUDENT" Then 'If len(stud_roll) <= 4 Then ' stud_full_roll = stud_stream & "-%-" & lngVal(stud_roll, 0) 'Else ' stud_full_roll = stud_roll 'End If If len(stud_roll) <= 4 Then stud_full_roll = stud_stream & "-%-" & lngVal(stud_roll, 0) Else stud_full_roll = stud_stream & "-" & lngVal(stud_roll, 0) End If End If End If If myerr <> "" Then Session.Contents("app_error") = myerr validateFormData = 0 Else validateFormData = 1 End IF End Function '==== Process Login ==== Function processLogin() If user_login_type = "ADMIN" Then '--- For Administrator SET rs=Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM admin_users WHERE admin_login_name = '" & user_name & "' AND admin_password = '" & user_password & "'" Set rs = connWeb.Execute(SQL) If rs.EOF = True Then Session.contents("app_error") = "Incorrect User Id or Password. Please retry..." Else user_name = rs("admin_login_name") Session.contents("user_type") = "ADMIN" Session.contents("user_full_name") = "Web Administrator" Session.contents("user_id") = user_name Session.contents("user_slno") = rs("admin_id") Session.contents("user_permissions") = "" Session.contents("app_message") = "Welcome " & Session.contents("user_full_name") & ", Login ID: " & user_name & " [" & user_login_type & "]" & "!!" Call disconnectDBWEB() response.redirect "user_home.asp" response.end End If ElseIf user_login_type = "FACULTY" Then '--- For Faculty & Others SET rs=Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM member_login WHERE member_id = '" & member_id & "' AND member_password = '" & member_password & "'" Set rs = connWeb.Execute(SQL) If rs.EOF = True Then Session.contents("app_error") = "Incorrect Member Id or Password. Please retry..." ElseIf getDataFromTable("member_master",connLib,"category","","member_id = '" & rs("member_id") & "'") = "STUDENT" Then Session.contents("app_error") = "It seems like you are a Student" ElseIf existsInTable("MEMBER_MASTER",connLib," member_id = '" & rs("member_id") & "' AND member_status = 1") <> 1 Then Session.contents("app_error") = "Your Membership Status is not Active. Please consult Web Administrator..." Else Session.contents("user_type") = getDataFromTable("member_master",connLib,"category","","member_id = '" & rs("member_id") & "'") Session.contents("user_full_name") = getDataFromTable("member_master",connLib,"(f_name+' '+l_name) as member_full_name","","member_id = '" & rs("member_id") & "'") 'Session.contents("user_type") = "FACULTY" Session.contents("user_id") = rs("member_id") Session.contents("user_slno") = 0 Session.contents("user_permissions") = "" Session.contents("app_message") = "Welcome " & Session.contents("user_full_name") & ", Login ID: " & rs("member_id") & " [" & user_login_type & "]" & "!!" Call disconnectDBWEB() response.redirect "user_home.asp" response.end End If ElseIf user_login_type = "STUDENT" Then '--- For Students SET rs=Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM member_login WHERE member_id LIKE '" & stud_full_roll & "'" Set rs = connWeb.Execute(SQL) If rs.EOF = True Then Session.contents("app_error") = "This Roll Number was not found in member list. Please retry..." ElseIf getDataFromTable("member_master",connLib,"category","","member_id = '" & rs("member_id") & "'") <> "STUDENT" Then Session.contents("app_error") = "It seems like you are not a Student" ElseIf existsInTable("MEMBER_MASTER",connLib," member_id = '" & rs("member_id") & "' AND member_status = 1") <> 1 Then Session.contents("app_error") = "Your Membership Status is not Active. Please consult Web Administrator..." Else Session.contents("user_type") = getDataFromTable("member_master",connLib,"category","","member_id = '" & rs("member_id") & "'") Session.contents("user_full_name") = getDataFromTable("member_master",connLib,"(f_name+' '+l_name) as member_full_name","","member_id = '" & rs("member_id") & "'") 'Session.contents("user_type") = "STUDENT" Session.contents("user_id") = rs("member_id") Session.contents("user_slno") = 0 Session.contents("user_permissions") = "" Session.contents("app_message") = "Welcome " & Session.contents("user_full_name") & ", Login ID: " & rs("member_id") & " [" & user_login_type & "]" & "!!" Call disconnectDBWEB() response.redirect "user_home.asp" response.end End If End If End Function '==== Create Personal Documents Folder (if not created) ==== Function createPersonalFolder(ByVal folderName) Dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") If fso.FolderExists(Server.MapPath("./" & DOCS_ROOT & folderName)) = False Then fso.CreateFolder(Server.MapPath("./" & DOCS_ROOT & folderName)) End If Set fso = Nothing End Function %> ISPAT COLLEGE ROURKELA : Online Library
<% call displayErrMsg() %>
 
Login As:*
display:none;<%End If%>">
User ID:*
Password:*
display:none;<%End If%>">
Member ID:*
Password:*
display:none;<%End If%>">
Stream:*
Roll No.:*
[Old Students: 4 digits, New Students: Full Roll No.]
display:none;<%End If%>">
Copyright 2009, All Rights Reserved with Ispat college Rourkela, Website Powered by Hi Technology & Services HITS
<% call disconnectDBWEB() %>