Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

something wrong with page.. but what??

Status
Not open for further replies.

UnfitElf

Programmer
Dec 3, 2002
24
NZ
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(&quot;BUTTON&quot;)=&quot;Submit&quot; & Request.Form(&quot;LodAdmin&quot;)=&quot;&quot; Then

sSQL = &quot;select username from users where username = '&quot; & request(&quot;Username&quot;) & &quot;' and password = '&quot; & request(&quot;Password&quot;) & &quot;';&quot;

Set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn.Open &quot;DSN=myDatabase155245&quot;
Set rsValidation = oConn.execute (sSQL)
If rsValidation.EOF Then
Response.Write &quot;Invalid Username/Password!&quot;
%>
<META http-equiv=&quot;refresh&quot; content=&quot;2; URL=login.asp&quot;>
<%
Response.End 'stops outputting here if invalid

Else Session(&quot;permission&quot;)=&quot;yes&quot;
Session(&quot;username&quot;)=Request.Form(&quot;Username&quot;)
username = Session(&quot;username&quot;)
Response.Write &quot;Welcome &quot; & username & &quot;. You have been loged in and this page will now refresh.&quot;

oConn.Close
Set oConn = Nothing
Set rsValidation = Nothing
%>
<META http-equiv=&quot;refresh&quot; content=&quot;2; URL=members.asp&quot;>
<%
End If


Else If request(&quot;BUTTON&quot;)=&quot;Submit&quot; & Request.Form(&quot;LogAdmin&quot;)<>&quot;&quot; Then

sSQL = &quot;select username from admin where username = '&quot; & request(&quot;Username&quot;) & &quot;' and password = '&quot; & request(&quot;Password&quot;) & &quot;';&quot;

Set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn.Open &quot;DSN=myDatabase155245&quot;
Set rsValidation = oConn.execute (sSQL)
If rsValidation.EOF Then
Response.Write &quot;Invalid Username/Password! num2&quot;
%>
<META http-equiv=&quot;refresh&quot; content=&quot;2; URL=login.asp&quot;>
<%
Response.End 'stops outputting here if invalid

Else Session(&quot;permission&quot;)=&quot;yes&quot;
Session(&quot;admin&quot;)=&quot;yes&quot;
Session(&quot;username&quot;)=Request.Form(&quot;Username&quot;)
username = Session(&quot;username&quot;)
Response.Write &quot;Welcome Admin &quot; & username & &quot;. You have been loged in and this page will now refresh.&quot;

oConn.Close
Set oConn = Nothing
Set rsValidation = Nothing
%>
<META http-equiv=&quot;refresh&quot; content=&quot;2; URL=members.asp&quot;>
<%
End If

Else
%>

<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body>
<form name=&quot;form&quot; method=&quot;post&quot; action=&quot;login.asp&quot;>
<p>Please login...</p>
<p>Username:
<input type=&quot;text&quot; name=&quot;Username&quot;>
Admin
<input type=&quot;checkbox&quot; name=&quot;LogAdmin&quot;>
<br>
Password:
<input type=&quot;password&quot; name=&quot;Password&quot;>
<br>
<input type=&quot;submit&quot; name=&quot;BUTTON&quot; value=&quot;Submit&quot;>
</p>
</form>
</body>
</html>

<%
End If
End If
%>

</body>
</html>
 
first line
If request(&quot;BUTTON&quot;)=&quot;Submit&quot; & Request.Form(&quot;LodAdmin&quot;)=&quot;&quot; Then

that's not looking to good, are you trying to say
If request(&quot;BUTTON&quot;)=&quot;Submit&quot; AND Request.Form(&quot;LodAdmin&quot;)=&quot;&quot; Then
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top