hi guys...i want to do a 2 level Log- in page....(Admin and normal User) ...I am using 
SQL SERVER and ASP.

below is my code for login..........

<HTML><HEAD>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function form1_onsubmit() {
if (form1.txtusername.value == "" || form1.txtpassword.value == "")
return false;
}

//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM action="ProcessLogin.asp" method=post 
LANGUAGE=javascript onsubmit="return form1_onsubmit()">

Username:
<INPUT id=text1 name=txtusername size="20" >&nbsp;&nbsp;&nbsp;&nbsp;

<p>Password:</b><INPUT type="password" name=txtpassword size="20" ></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


<INPUT type="submit" value="Login" name="login"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p>&nbsp;</p>
</FORM>
</BODY></HTML>

ASP file:

<title>CheckUser</title>
<%
'Dimension variables
Dim adoCon   'Database Connection Variable
Dim strCon  'Holds the Database driver and the path and name of the database
Dim rsNew_User   'Database Recordset Variable
Dim strSQLDB  'Holds the Access Database Name
Dim strSQL   'Database query sring
Dim strUser_Name  'Holds the user name

'Initalise the strUserName variable
strUserName = Request.Form("User_Name")

'Check the database to see if user exist and read in the password

strSQLDB = "ASFTS"

 'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
    
 'Database connection info and driver
strCon = "Provider=SQLOLEDB; Database=ASFTS; Server=mkzsa018.ap.infineon.com; User 
ID=; Password="

'Set an active connection to the Connection object
adoCon.Open strCon

'Create a recordset object
Set rsNew_User = Server.CreateObject("ADODB.Recordset")

'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT New_User.User_Pass, New_User.User_Mail FROM New_User WHERE 
New_User.User_Name ='" & strUser_Name & "'"

'Query the database
rsNew_User.Open strSQL, strCon

'If the recordset finds a record for the username entered then read in the password 
for the user
If NOT rsNew_User.EOF Then
 
 'Read in the password for the user from the database
 
If Request.Form("User_Pass") = rsNew_User("User_Pass") Then
  
Response.Redirect "main2.htm" 
  
  'If the password is correct then set the session variable to True
  Session("blnIsUserGood") = True
  
  'Close Objects before redirecting
  Set adoCon = Nothing
  Set strCon = Nothing
  Set rsNew_User = Nothing
  
  End If
 
 
End If
  
'Close Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsNew_User = Nothing
 
'If the script is still running then the user must not be authorised
Session("blnIsUserGood") = False

'Redirect to the unautorised user page
Response.Redirect"login.htm"
%>

thanks for all the help

 

                
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!

[Non-text portions of this message have been removed]




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to