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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please check code and help

Status
Not open for further replies.

GaryC123

Programmer
Sep 10, 2002
1,041
NO
I have a problem with the following, sometimes it works, othertimes i get a 'problem with the page you are trying to reach'. I'm bemuddled
<SCRIPT language=JavaScript></SCRIPT>
<SCRIPT language=JavaScript src=&quot;dscript98/menu_array.js&quot; type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src=&quot;dscript98/mmenu.js&quot; type=text/javascript></SCRIPT>
<FORM METHOD=&quot;post&quot; action=&quot;inhouse.html&quot;><BODY><BR><BR>
<%
if request.form(&quot;display&quot;)=&quot;checklogin&quot; then
set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.provider=&quot;Microsoft.Jet.OLEDB.4.0&quot;
conn.open(server.mappath(&quot;allocation.mdb&quot;))
set rs=Server.CreateObject(&quot;ADODB.Recordset&quot;)
if request.form(&quot;display&quot;) = &quot;checklogin&quot; then
username=request.form(&quot;username&quot;)
password=request.form(&quot;password&quot;)
rs.open &quot;SELECT * FROM agents&quot;,conn
rs.movefirst
do until rs.eof
if rs(&quot;user&quot;) = username then
if rs(&quot;pass&quot;)= password then%>
<center><p></p><%
response.write &quot;Logged on as &quot; & rs(&quot;name&quot;)
session(&quot;agentname&quot;)=rs(&quot;name&quot;)
session(&quot;user&quot;)=rs(&quot;user&quot;)
session(&quot;logged&quot;)=1
logged=&quot;1&quot;
end if
end if
rs.movenext
loop
end if
end if
%>

<center><font color=&quot;#FF0000&quot;>
<%if session(&quot;logged&quot;)<>1 then
%>
<INPUT TYPE=&quot;text&quot; NAME=&quot;display&quot; SIZE=&quot;20&quot; VALUE=&quot;checklogin&quot; STYLE=&quot;visibility: hidden&quot;>
<P ALIGN=&quot;center&quot;>User Name : <input type=text name=username SIZE=&quot;20&quot;></P>
<P ALIGN=&quot;center&quot;>&nbsp;&nbsp;Password : <input type=password name=password SIZE=&quot;20&quot;><BR>
</P><P ALIGN=&quot;center&quot;><INPUT TYPE=&quot;submit&quot; VALUE=&quot;Click Here To Login&quot;></P>
<% end if%>
<input type=&quot;hidden&quot; name=&quot;logged&quot; value=&quot;<%=logged%>&quot;></BODY>
 
One thing I notice, you have got no code to write a response should the username and password not be verified, maybe you/users are simply not putting in valid details??

only a thought

Andy

 
Some slight amendments. I've stripped the code down to see if I could work out where the problem was. The problem is the page sometimes loads and sometimes I just get a 500 error. But always works fine on my local host.

<FORM METHOD=&quot;post&quot; action=&quot;inhouse.asp&quot;><BODY><BR><BR>
<%
if request.form(&quot;display&quot;)=&quot;checklogin&quot; then
set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.provider=&quot;Microsoft.Jet.OLEDB.4.0&quot;
conn.open(server.mappath(&quot;allocation.mdb&quot;))
set rs=Server.CreateObject(&quot;ADODB.Recordset&quot;)
username=request.form(&quot;username&quot;)
password=request.form(&quot;password&quot;)
rs.open &quot;SELECT * FROM agents&quot;,conn
rs.movefirst
do until rs.eof
if rs(&quot;user&quot;) = username and rs(&quot;pass&quot;)= password then%>
<center><p></p><%
response.write &quot;Logged on as &quot; & rs(&quot;name&quot;)
session(&quot;agentname&quot;)=rs(&quot;name&quot;)
session(&quot;user&quot;)=rs(&quot;user&quot;)
session(&quot;logged&quot;)=1
logged=&quot;1&quot;
end if
rs.movenext
loop
end if

%>

<center><font color=&quot;#FF0000&quot;>
<%if session(&quot;logged&quot;)<>1 then
%>
<INPUT TYPE=&quot;text&quot; NAME=&quot;display&quot; SIZE=&quot;20&quot; VALUE=&quot;checklogin&quot; STYLE=&quot;visibility: hidden&quot;>
<P ALIGN=&quot;center&quot;>User Name : <input type=text name=username SIZE=&quot;20&quot;></P>
<P ALIGN=&quot;center&quot;>&nbsp;&nbsp;Password : <input type=password name=password SIZE=&quot;20&quot;><BR>
</P><P ALIGN=&quot;center&quot;><INPUT TYPE=&quot;submit&quot; VALUE=&quot;Click Here To Login&quot;></P>
<% end if%>
<input type=&quot;hidden&quot; name=&quot;logged&quot; value=&quot;<%=logged%>&quot;></BODY>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top