473,948 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about login script

Joe
Hi,

I have a login page. Where user enters an email and password. Then I;m
checking if user account is active or not. Before a user can login, he needs
to activate his account. If the account is active then Active field is set
to yes (1) otherwise to no (0).

If the user’s account is active then I check whether this is user’s first
visit or not. If it is user’s first visit then I redirect user to
‘newuser.aspâ €™ page otherwise to ‘returnuser.a sp’.

If the user’s account is not active then I send the user to login page with
‘default.asp? pw=0’

For some reason the SQL statement

strSQL = "SELECT * FROM testusers " & "WHERE E_Mail='" &
Request.Form("t xtEmail") & "' AND Password = '" & Request.Form("t xtUserPass")
& "' AND Active = 1 ;"

is not working because I can see that the user’s account is active, email
and password all exist in the database but the script keeps directing the
user to loginpage as if the record doesn’t exist.

The SQL query that above statemtn produces is,

SELECT * FROM testusers WHERE E_************* **@canada.com' AND Password =
'joegreen' AND Active = 1 ;

I am not able to find the mistake I am making. Can someone help me please.

Thanks,

Joe
<%
'Using a DSN connection.
Dim objConn
Dim objRS

Set objConn = Server.CreateOb ject("ADODB.Con nection")
'objConn.Connec tionString = "DSN=PKMSolutio nEval"
objConn.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=E:\ databases\test. mdb;"

Set objRS=Server.Cr eateObject("ADO DB.Recordset")
'objRS.Open "testusers" , objConn
strSQL = "SELECT * FROM testusers " & "WHERE E_Mail='" &
Request.Form("t xtEmail") & "' AND Password = '" & Request.Form("t xtUserPass")
& "' AND Active = 1 ;"
objRS.Open strSQL, objConn, adOpenForwardOn ly, adLockReadOnly, adCmdText

If Not objRS.EOF And Not objRS.BOF Then

If objRS.Fields("F irst_Visit") = "True" Then
'first time visitor
strSQL = "UPDATE dndusers SET First_Visit = 0 WHERE E_Mail='" &
Request.Form("t xtEmail") & "' AND Password = '" & Request.Form("t xtUserPass")
& "';"
Set updateCmd = Server.CreateOb ject("ADODB.Com mand")
With updateCmd
.ActiveConnecti on = objConn
.CommandText = strSQL
.Execute
End With
objRS.Close()

objConn.Close()
Set objConn = Nothing

Response.Redire ct("newuser.asp ")
Else
'retruning user
objRS.Close()

objConn.Close()
Set objConn = Nothing

Response.Redire ct("returnuser. asp")
End If
Else
'user don't exisit
objRS.Close()
objConn.Close()
Set objConn = Nothing

Response.Redire ct("default.asp ?pw=0")

End If

objConn.Close()
Set objConn = Nothing

%>

Aug 5 '05 #1
0 1179

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2940
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
3
4121
by: Jerry Rhodes | last post by:
When I run the code below, the web server tells me that I need to enable cookies. Can anyone tell me what might be causing that? I'm trying to POST userid and password to their login web page. Thanks! Dim CookieJar As CookieContainer = New CookieContainer() Dim WebReq As HttpWebRequest Dim WebResp As HttpWebResponse Dim StrmRdr As StreamReader Dim StrmWrtr As StreamWriter Dim PostParms As String
1
1641
by: Kevin Blount | last post by:
Background: My script is designed to only allow the downloading of a file if a cookie exists to say that someone is logged into my companies site. A colleague set up a test area the extension .EXE is associated with the aspnet_isapi.dll. This means that if anyone tries to access a .EXE file in this area, web.config is run and web.config contains the code: <authentication mode="Forms"> <forms name="myCookie2" loginUrl="login.aspx" />
2
1523
by: Victor | last post by:
I'm doing screen scraping by retrieving data from one site and entering into another site. I have a problem with logging into the site. User name and password field contain 'name' property, and therefore I can easily do assign statement to them. "userid=uidTest&password=pwTest" However, submit button represented on page via hyper link: <A href="javascript:login()" onBlur ="foc()"><IMG align=middle border=0 height=15...
4
1346
by: Jon | last post by:
All, I have a question regarding include files. I'm currently wanting to secure all of the pages within a directory by having a login script that queries a MySQL DB, and writes a session variable confirming the user is successfully logged in. Now, I've done this many times before, however I'm getting kind of sick of putting the include file to check the session variable on EVERY page within a directory. This is especially irritating...
5
992
by: mouac01 | last post by:
I'm new to javascript. I have a form with 2 buttons. I want an alert to show what button was clicked. Also, is there a way to prevent the text fields from disappearing after submitting a form? Thanks... CM <SCRIPT LANGUAGE="JavaScript"> function picked() { if(login.value=="1") { alert("Yes");
4
15657
by: BD | last post by:
Hi all. Running SQL2K SP4 on W2K3 Standard, SP4. I have just refreshed a database on one server with a backup from another. The database had existed previously on the target server, and I am just refreshing its contents. I used the following approach 1) From the target server, create a SQL script with users and roles 2) From the source server, back up the db
3
1407
by: Anthony | last post by:
<!-- Begin function Login(){ var done=0; var username=document.login.username.value; username=username.toLowerCase(); var password=document.login.password.value; password=password.toLowerCase(); if (username=="member1" && password=="password1") { window.location="page1.html"; done=1; } if (username=="member2" && password=="password2") {
5
2101
by: DavidPr | last post by:
I'm using sessions now but I've just realized a potential problem. It's a small job board and the employers have to register and login to post ads, and the job seekers have to register, login and post a resume in order to respond to certain ads. The employers and the job seekers register their information into their own database table. I don't fully understand how sessions work. This that I'm using came from a book by Larry Ullman (chapter...
3
6236
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it has to tell then them its wrong information but currently it takes then to a next page and then tells them its incorrect information. This is tedious as every time they enter wrong they will be redirected to a different page and then they have to...
0
10165
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9987
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11579
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11353
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10694
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8256
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6337
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4540
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.