Hi there,
I'm trying to redirect a user at login if they have logged in 3 or more times in one day. I'm pretty new to asp and cant find anything to track individual users logins that will reset at the end of every day. Let me know if you have any advice.
Thanks
5 1297
Hi there,
I'm trying to redirect a user at login if they have logged in 3 or more times in one day. I'm pretty new to asp and cant find anything to track individual users logins that will reset at the end of every day. Let me know if you have any advice.
Thanks
It might be easiest to do with cookies, using a db would be surer (cookies aren't 100% reliable) but slower and take more server power. make sure you set the cookie expire attribute to be a day, then send a cookie to the user during the log in that counts the number of logins. If that number is greater than 3, refuse the login. Let me know if this helps.
Jared
It might be easiest to do with cookies, using a db would be surer (cookies aren't 100% reliable) but slower and take more server power. make sure you set the cookie expire attribute to be a day, then send a cookie to the user during the log in that counts the number of logins. If that number is greater than 3, refuse the login. Let me know if this helps.
Jared
Depending on the environment you are in, this may not work. For example, I have 3 PC running right now. If you use cookies, I could actually get in 9 times a day. Like Jared says, db is surer because it doesn't depend on a user pc. But depending on the size of the site, that could really slow it down.
Thanks, how do i use the db to limit the page views?
Sorry... I'm pretty new to all of this
It might be easiest to do with cookies, using a db would be surer (cookies aren't 100% reliable) but slower and take more server power. make sure you set the cookie expire attribute to be a day, then send a cookie to the user during the log in that counts the number of logins. If that number is greater than 3, refuse the login. Let me know if this helps.
Jared
In pseudo-code (with a bit of real ASP code in there), you'd do it like this: -
Sub DoLogin
-
Set objDbConn = Server.CreateObject("ADODB.Connection")
-
strConn = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/youraccessdb.mdb")
-
objDbConn.Open strConn
-
-
Set rsLoginUser = Server.CreateObject("ADODB.Connection")
-
strSQL = "SELECT * FROM tbl_Users WHERE EmailAddy = " & Request.Form("login_email")
-
rsLoginUser.Open strSQL, objDbConn, 1, 1
-
-
If rsLoginUser.RecordCount > 0 Then
-
' Found a user!
-
If rsLoginUser("UserPW") = Request.Form("login_pw") Then
-
'Login OK, check daily login limit
-
If CInt(rsLoginUser("DailyCounter")) < 3 Then
-
'Login OK, add 1 to Login count
-
rsLoginUser.Update "DailyCounter", rsLoginUser("DailyCounter") + 1
-
Else
-
'Login OK but count not, kick user
-
End If
-
Else
-
'Dud password, kick user
-
End If
-
Else
-
' Dud email, kick user
-
End If
-
End Sub
-
Don't quote me on the ADO method of updating the number of logins though - normally I'd use a quick SQL Update query to do it myself but that's my personal perference.
I definitely agree with mods though - DB is much better than using cookies - imagine someone in an empty web cafe... lol. Or worse - someone that's simply disabled cookies - or clears them at end of every session.
Hope it helps!
Thanks... this seems like it'll work
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mike A |
last post by:
Hi,
I'm hoping someone can help me with this.
I have a URL for which I'd like to limit access to by time. For
example,say I have a URL that I don't want accessable on Monday mornings
between...
|
by: UnixSlaxer |
last post by:
I am wondering, is the disk limit constraint in db2advis on
a) The space of the recommended indexes and materialized views.
b) The space of the recommended indexes and materialized views, as...
|
by: Victoria Holowchak |
last post by:
I was hoping that Microsoft Access 2002 would allow users to see all
the columns of an Oracle database table that contained more than 255
columns. I noticed that my Oracle8 ODBC driver is only at...
|
by: Hannu |
last post by:
Hi.
In the ldb file you can see the users of the mdb-file. If you open the
mdb-file your machine and username will be written in the lbd- file.
Allthough you close the mdb-file your name won't...
|
by: elein |
last post by:
Yes, I vacuumed. Reproduced on both 7.3.2 and 7.5.
Brain dead java beans want order by clauses in views
that they use.
my view is:
select ....
from bigtable b left join lookuptable l
order...
|
by: freduchi |
last post by:
Hi, I need sugestions.
I need to implement the next and I donīt know how to do it:
I am developing a website in which users are signed up and share
information(Messages, Photos...).
When a...
|
by: =?Utf-8?B?YzY3NjIyOA==?= |
last post by:
Hi all,
I am thinking about doing this since I got several cases that some of our
internal users open more than one browser at the same time from our server.
When one of the transactions was not...
|
by: Nosferatum |
last post by:
I am in need of a solution on how to solve this problem:
I need to limit access to six different folders. My users are
validated in a system which check their prescence with a couple of...
|
by: Gautier |
last post by:
Hello, I try to connect directly to views of one of other users of a sid. With Oracke SQL Developer, I see that the view I need is in :
Connection -> RMSP -> Other users -> RMS -> Views.
When I do...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
| |