473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Limit Users page views per day

4
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
Aug 17 '07 #1
5 1297
jhardman
3,406 Expert 2GB
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
Aug 20 '07 #2
ilearneditonline
130 Expert 100+
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.
Aug 20 '07 #3
dnleeb
4
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
Aug 22 '07 #4
JamieHowarth0
533 Expert 512MB
In pseudo-code (with a bit of real ASP code in there), you'd do it like this:

Expand|Select|Wrap|Line Numbers
  1. Sub DoLogin
  2.      Set objDbConn = Server.CreateObject("ADODB.Connection")
  3.      strConn = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/youraccessdb.mdb")
  4.      objDbConn.Open strConn
  5.  
  6.      Set rsLoginUser = Server.CreateObject("ADODB.Connection")
  7.      strSQL = "SELECT * FROM tbl_Users WHERE EmailAddy = " & Request.Form("login_email")
  8.      rsLoginUser.Open strSQL, objDbConn, 1, 1
  9.  
  10.      If rsLoginUser.RecordCount > 0 Then
  11.          ' Found a user!
  12.          If rsLoginUser("UserPW") = Request.Form("login_pw") Then
  13.                  'Login OK, check daily login limit
  14.                  If CInt(rsLoginUser("DailyCounter")) < 3 Then
  15.                        'Login OK, add 1 to Login count
  16.                        rsLoginUser.Update "DailyCounter", rsLoginUser("DailyCounter") + 1
  17.                  Else
  18.                        'Login OK but count not, kick user
  19.                  End If
  20.          Else
  21.                'Dud password, kick user
  22.          End If
  23.      Else
  24.           ' Dud email, kick user
  25.      End If
  26. End Sub
  27.  
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!
Aug 23 '07 #5
dnleeb
4
Thanks... this seems like it'll work
Sep 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

17
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...
2
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...
3
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...
6
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...
2
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...
9
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...
6
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...
5
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...
1
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...
0
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,...
0
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$) { } ...
0
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...
0
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...
0
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
1
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...
0
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...
0
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,...
0
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...

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.