hi all..
I have made a login page and added a admin thing but it sin't working the way i thought. I have looked at it carefully but cannot see the prob. its prob something simple..
any help??
<html>
<head>
<title>Login Page</title>
<%
If request("BUTTON"
="Submit" & Request.Form("LodAdmin"
="" Then
sSQL = "select username from users where username = '" & request("Username"
& "' and password = '" & request("Password"
& "';"
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN=myDatabase155245"
Set rsValidation = oConn.execute (sSQL)
If rsValidation.EOF Then
Response.Write "Invalid Username/Password!"
%>
<META http-equiv="refresh" content="2; URL=login.asp">
<%
Response.End 'stops outputting here if invalid
Else Session("permission"
="yes"
Session("username"
=Request.Form("Username"
username = Session("username"
Response.Write "Welcome " & username & ". You have been loged in and this page will now refresh."
oConn.Close
Set oConn = Nothing
Set rsValidation = Nothing
%>
<META http-equiv="refresh" content="2; URL=members.asp">
<%
End If
Else If request("BUTTON"
="Submit" & Request.Form("LogAdmin"
<>"" Then
sSQL = "select username from admin where username = '" & request("Username"
& "' and password = '" & request("Password"
& "';"
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN=myDatabase155245"
Set rsValidation = oConn.execute (sSQL)
If rsValidation.EOF Then
Response.Write "Invalid Username/Password! num2"
%>
<META http-equiv="refresh" content="2; URL=login.asp">
<%
Response.End 'stops outputting here if invalid
Else Session("permission"
="yes"
Session("admin"
="yes"
Session("username"
=Request.Form("Username"
username = Session("username"
Response.Write "Welcome Admin " & username & ". You have been loged in and this page will now refresh."
oConn.Close
Set oConn = Nothing
Set rsValidation = Nothing
%>
<META http-equiv="refresh" content="2; URL=members.asp">
<%
End If
Else
%>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form" method="post" action="login.asp">
<p>Please login...</p>
<p>Username:
<input type="text" name="Username">
Admin
<input type="checkbox" name="LogAdmin">
<br>
Password:
<input type="password" name="Password">
<br>
<input type="submit" name="BUTTON" value="Submit">
</p>
</form>
</body>
</html>
<%
End If
End If
%>
</body>
</html>
I have made a login page and added a admin thing but it sin't working the way i thought. I have looked at it carefully but cannot see the prob. its prob something simple..
any help??
<html>
<head>
<title>Login Page</title>
<%
If request("BUTTON"
sSQL = "select username from users where username = '" & request("Username"
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN=myDatabase155245"
Set rsValidation = oConn.execute (sSQL)
If rsValidation.EOF Then
Response.Write "Invalid Username/Password!"
%>
<META http-equiv="refresh" content="2; URL=login.asp">
<%
Response.End 'stops outputting here if invalid
Else Session("permission"
Session("username"
username = Session("username"
Response.Write "Welcome " & username & ". You have been loged in and this page will now refresh."
oConn.Close
Set oConn = Nothing
Set rsValidation = Nothing
%>
<META http-equiv="refresh" content="2; URL=members.asp">
<%
End If
Else If request("BUTTON"
sSQL = "select username from admin where username = '" & request("Username"
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN=myDatabase155245"
Set rsValidation = oConn.execute (sSQL)
If rsValidation.EOF Then
Response.Write "Invalid Username/Password! num2"
%>
<META http-equiv="refresh" content="2; URL=login.asp">
<%
Response.End 'stops outputting here if invalid
Else Session("permission"
Session("admin"
Session("username"
username = Session("username"
Response.Write "Welcome Admin " & username & ". You have been loged in and this page will now refresh."
oConn.Close
Set oConn = Nothing
Set rsValidation = Nothing
%>
<META http-equiv="refresh" content="2; URL=members.asp">
<%
End If
Else
%>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form" method="post" action="login.asp">
<p>Please login...</p>
<p>Username:
<input type="text" name="Username">
Admin
<input type="checkbox" name="LogAdmin">
<br>
Password:
<input type="password" name="Password">
<br>
<input type="submit" name="BUTTON" value="Submit">
</p>
</form>
</body>
</html>
<%
End If
End If
%>
</body>
</html>