Forum Moderators: open

Message Too Old, No Replies

Asp form input

how to access it from multiple .html pages

         

Blelisa

3:48 pm on May 11, 2005 (gmt 0)

10+ Year Member



I feel really silly asking this question, but it is one of those that I just can't think of.
I have a web site that has a login page. When you enter your username and password it them redirects you to the welcome page.
I want on the welcom page that is simply .html to have a header that says - Welcome XXXX, XXX being their first name that I have gathered on their registration page when they first registered and now sits in my database. I also have another page where my cust's can schedule a service call. Now on this page I want to be able to automaticlly have their name address phone and such on the page. Again this is all info they have provided when they first registered with the site and sits in our database.
How would I do this? In the .html page I know I would put it in <% %> brackets but do I need to switch the .html to an .asp page?

mrMister

4:14 pm on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



do I need to switch the .html to an .asp page?

You can either do that or map .html to asp.dll in IIS.

Blelisa

5:29 pm on May 11, 2005 (gmt 0)

10+ Year Member



I dont understand what you typed. A little too over my head. However, I have changed my .html page to an .asp page. Still doesn't work.
Basiclly I want my header to read to the visitor:

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?

mrMister

5:53 pm on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Which web server are you using?

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.

Blelisa

6:09 pm on May 11, 2005 (gmt 0)

10+ Year Member



Okay, web server is IIS

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>

Blelisa

6:10 pm on May 11, 2005 (gmt 0)

10+ Year Member



Sorry forgot to add the error code:

I am not getting any error however when I view my custarea.asp page it just says:
Welcome!

mrMister

6:15 pm on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




server.MapPath("data/hemicustreg.mdb")

You're storing all your customer details below the web root?!

Buy a security book and read it.

mrMister

6:20 pm on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

dotme

12:49 pm on May 12, 2005 (gmt 0)

10+ Year Member



Session("fname") = username

Try

Session("fname") = Request("username") instead

mrMister

1:08 pm on May 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Session("fname") = username

Try

Session("fname") = Request("username") instead

No, that will display the username. He doesn't want that, he wants to display the full name of the user.

My code is right.