Hello, I am having trouble getting unique user information on my account page. Currently, once the user logs in, it will only display "Welcome...(then the same name pops up no matter who logs in)".
After the login.html page, the form redirects the user to the loggedin.asp page which verifies the users email and password are in the database. Here's the loggedin.asp code:
loggedin.asp: - <%@ Language=VBScript %>
-
<% Option Explicit %>
-
<!--#include virtual="/adovbs.inc"-->
-
-
<%
-
-
Dim oConn
-
Dim connectstr, sDSNDir, tablename
-
Dim db_name, db_username, db_userpassword
-
Dim dsn_name
-
-
dsn_name = "access_table.dsn"
-
tablename = "tblRegister"
-
db_username = "$$$$$"
-
db_userpassword = "$$$$"
-
-
sDSNDir = Server.MapPath("/_dsn")
-
connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
-
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open connectstr
-
-
Dim objRS, bolFound, strEmail
-
strEmail = Request.Form("email")
-
-
If strEmail = "" Then
-
oConn.Close
-
Set oConn = Nothing
-
Response.Write "<a href='login.html'>"
-
Response.Write "You must enter a email address"
-
Response.Write "</a>"
-
Response.End
-
End If
-
-
Set objRS = Server.CreateObject("ADODB.Recordset")
-
objRS.Open "tblRegister", oConn, , , adCmdTable
-
bolFound = False
-
-
Do While Not (objRS.EOF OR bolFound)
-
If (StrComp(objRS("Email"), strEmail, vbTextCompare) = 0) Then
-
BolFound = True
-
Else
-
objRS.MoveNext
-
End If
-
Loop
-
-
If Not bolFound Then
-
objRS.Close
-
Set objRS = Nothing
-
oConn.Close
-
Set oConn = Nothing
-
Response.Write "<a href='login.html'>"
-
Response.Write "Invalid Email Address.<p>"
-
Response.Write "</a>"
-
Response.End
-
End If
-
-
If Not (StrComp(objRS("Password"), Request.Form("password"), _
-
vbBinaryCompare) = 0) Then
-
objRS.Close
-
Set objRS = Nothing
-
oConn.Close
-
Set oConn = Nothing
-
Response.Write "<a href='login.html'>"
-
Response.Write "Invalid password.<p>"
-
Response.Write "</a>"
-
Response.End
-
Else
-
session("email") = objRS("email")
-
Response.Redirect("accountpage.asp")
-
Response.End
-
End If
-
-
objRS.Close
-
Set objRS = Nothing
-
oConn.Close
-
Set oConn = Nothing
-
%>
This page verifies the user information and then loads the accountpage.asp. The code is:
accountpage.asp - <%@ Language=VBScript %>
-
<% Option Explicit %>
-
<!--#include virtual="/adovbs.inc"-->
-
-
<%
-
If session("email") = "" Then
-
Response.Redirect "login.html"
-
Response.End
-
Else
-
Response.Write "You are logged in as " & session("email") & "<br>"
-
End If
-
-
Dim oConn
-
Dim connectstr, sDSNDir, tablename
-
Dim db_name, db_username, db_userpassword
-
Dim dsn_name
-
-
dsn_name = "access_table.dsn"
-
tablename = "tblRegister"
-
db_username = "$$$$"
-
db_userpassword = "$$$$$"
-
-
sDSNDir = Server.MapPath("/_dsn")
-
connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
-
-
Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open connectstr
-
-
Dim objRS
-
-
Set objRS = Server.CreateObject("ADODB.Recordset")
-
objRS.Open "tblRegister", oConn, , , adCmdTable
-
%>
-
-
<html>
-
<head><title>Account Page</title></head>
-
<h1>
-
<b><font face="castellar">Welcome <%=objRS("FirstName" )%><%=objRS("LastName")%></font></b></center></h1>
-
-
</body>
-
</html>
-
<%
-
objRS.Close
-
Set objRS = Nothing
-
oConn.Close
-
Set oConn = Nothing
-
%>
The problem is, it doesn't matter who logs in. When the accountpage.asp loads, it always says "Welcome .....(and the name always comes up as the name of the first user in the access database, not the user logged in).
Any ideas why this is occurring? Thank you
1 1805
I figured out my problem. I had to query the database. I put the following code in: - Dim strSQL, strEmail
-
Dim bolFound
-
-
strEmail = session("email")
-
-
strSQL = "SELECT * From tblRegister"
-
-
Dim objRS
-
Set objRS = Server.CreateObject("ADODB.Recordset")
-
objRS.Open strSQL, oConn
-
bolFound = False
-
-
Do While Not (objRS.EOF OR bolFound)
-
If (StrComp(objRS("Email"),strEmail, vbTextCompare) = 0) Then
-
BolFound = True
-
Else
-
objRS.MoveNext
-
End If
-
Loop
-
-
If Not bolFound Then
-
objRS.Close
-
Set objRS = Nothing
-
oConn.Close
-
Set oConn = Nothing
-
Response.Write "<a href='login.html'>"
-
Response.Write "Invalid Email Address.<p>"
-
Response.Write "</a>"
-
Response.End
-
End If
I put this code in right after: - Set oConn = Server.CreateObject("ADODB.Connection")
-
oConn.Open connectstr
And it works. Thanks to everyone at this forum. You have allowed me to successfully create my first website.
Jerry
Sign in to post your reply or Sign up for a free account.
Similar topics
by: jach |
last post by:
How can I get the domain, username and PC network name (Win 2000 Pro & Win
XP Pro PC's) of the current logged on user (logged onto a domain and access
an intranet page, Window 2000 server running...
|
by: Wayne Gibson |
last post by:
Hi all,
Please ignore the other post.. The cat jumped on the machine and sent it
before I could stop it!!
Was wondering if anybody has expericence this problem..
I am writting an application...
|
by: Frank Rizzo |
last post by:
I've got a number of user controls on the web page. How can I pass some
data to it? I don't see where the user control is instantiated in the
page code-behind page.
Thanks.
|
by: mg |
last post by:
The following .exe and its parameters work correctly from the command prompt
(it prints x.pdf without prompting the user.
acrord32.exe /t "c:\exportfiles\x.pdf" "HP LaserJet 3300 Series PCL 6"...
|
by: Siobhan |
last post by:
Hi
What is the recommended way to store a user's database credentials across
the pages of a web application so that each time the database is accessed the
system doesn't have to ask them for their...
|
by: TCORDON |
last post by:
I have a user control that contains 2 image buttons, when you click one of
them, both must change the image source, the thing is that the first time
you click any one of them the page appears to do...
|
by: sheldonlg |
last post by:
I don't think my last attempt posted so here it is again.
This is a bit off-topic, but it does relate to php. This is the most
active related group that I can find, so even if it is off-topic I...
|
by: JamesB |
last post by:
I am writing a service that monitors when a particular app is started.
Works, but I need to get the user who is currently logged in, and of course
Environment.UserName returns the service logon...
|
by: shapper |
last post by:
Hello,
On my web site I have a property, Visitor, which is available for
Anonymous users:
public class Visitor {
public CultureInfo Culture { get; set; }
public List<GuidPolls { get; set;...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |