Forum Moderators: open
Welcome (#*$!x)!
xxxx being their name which I got from the namefield in my database that was in the record of the username and password of the user that is logged in. Any ideas?
Create a page with a .asp extension, with just the following line of code...
<%Response.write("hello world")%>
Tell me what you see when you view it.
There's not much anyone can do unless you post the source code and the actual error. Just saying "It doesn't work" isn't really enough information.
Code for verify.asp page
<% @LANGUAGE = VBSCRIPT %>
<% Option Explicit %>
<% 'chk_login.asp %>
<% Dim connection, check, info
'Open a database connection
Set connection = Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
server.MapPath("data/hemicustreg.mdb")
connection.Open
' Call connection.open("ecommerce")
'Build the SQL query
check="SELECT * From customer WHERE username = '"_
& CStr(Request("Username")) & "'"_
& " AND pwrd='"_
& CStr(Request("Pwrd"))& "'"
'Open the record set
Set info= Server.CreateObject("ADODB.RecordSet")
Call info.Open(check, connection)
On Error Resume Next
If info.EOF THEN
'The user's login is incorrect
Call info.Close()
Call connection.Close()
Call Response.Redirect("badlogin.html")
Else
'The user's login is correct
Session("fname") = username
Session("username") = Request("Username")
Session("loggedIn") = True
Call info.Close()
Call connection.Close()
Call Response.Redirect("custarea.asp")
End If
%>
Clip of Code for custarea.asp page
<!--body of text-->
<br />
<div align="center">
<h1>Welcome <%=Session("fname")%>!</h1>
</div>
<p class="main2">Thank you for registering with us and utilizing our customer
support page. Our goal is to make your job as easy as possible when it comes
to working with your communications. If you have any questions at any time feel
free to contact us.</p>
I am not getting any error however when I view my custarea.asp page it just says:
Welcome!
And what do you see in the HTML source (right click -> view source)?
Did you try the hello world script? What happened.
You need to assign username to the value for the username field in your database.
eg.
username = info("username_field")
And get rid of that On Error Resume Next, It'll only cause headaches for you if you come in to problems.
You also want to be closing your connection outside of the if loop. At the moment anyone who gets their password wrong will cause your server to leak memory.