Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Jsp Pages Visited
kvarnerexpress
post Jul 7 2005, 01:22 AM
Post #1


Super Member
*********

Group: Members
Posts: 407
Joined: 13-December 04
Member No.: 2,696



Hi all,

I want to keep track of how often certain pages are visited but I don't want to have it such that someone can keep refreshing a page to increment the number of times a page is visited.

What would be the best way to keep track of visiters on my site so I can know what pages they are going to.

I'm going to database this data so I can generate a little "most visited" list for my page of, say, the top 5 most visited pages.

I imagine using a cookie or something but I would like to have a time frame on it, such that, if the same person re-visits the site after, x amount of time (an hour/day), the page 'hit' will increment.

Go to the top of the page
 
+Quote Post
Tyssen
post Jul 7 2005, 02:50 AM
Post #2



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



You should Google 'session variables'.
Go to the top of the page
 
+Quote Post
cse-icons
post Jul 19 2005, 05:28 AM
Post #3


Super Member
*********

Group: Members
Posts: 351
Joined: 19-October 04
From: India
Member No.: 1,824



hi kvarnerexpress,

yeah you can use session in this case.

When someone visits the page, use the session id to identify which session is requesting the page and put it in a hashmap with the count. and/or time. Now when the page is requested again. check whether it is from the same session, if it is, then compare the time of last visit and update the count if sufficient time has elapsed else just serve the page.

You need to run a cleanup routine at regular intervals so that the sessions in the hashmap that have not been used for a long time are removed so as to free up the space..

Cheers.
Go to the top of the page
 
+Quote Post
vitrus
post Oct 10 2005, 04:21 PM
Post #4


Newbie [Level 3]
***

Group: Members
Posts: 42
Joined: 8-October 05
From: Haarlem, The Netherlands
Member No.: 12,672



I started a class that should mesure hits, visits, etc per day (in a servlet) today...

I will post the result soon!
Go to the top of the page
 
+Quote Post
dul
post Oct 19 2005, 12:36 AM
Post #5


Member [Level 1]
****

Group: Members
Posts: 73
Joined: 21-September 05
Member No.: 12,113




Use session variables. But good idea is save the session variable in a database. (such as IP address etc..). After that you can control you counter as much as you want.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Create Dynamic Html/php Pages Using Simple Vb.net Code(1)
  2. Simple Javascript And Password System(6)
  3. Test Your Php Pages W/o Upload/internet(57)
  4. How To: Make A Simple Php Site(21)
  5. Problem With Firefox, Latest Version, Not Loading Pages(4)
  6. Protect Pages(20)
  7. Php--> Content-only Pages(9)
  8. Dynamic Php Pages(5)
  9. Pagination(3)
  10. Site Error For Php Pages(6)
  11. Some Pages On My Site Won't Even Load..(6)
  12. 2 Pages Into One(10)
  13. What Is C++ Server Pages?(1)
  14. Php Pages Problem [resolved](5)
  15. Custom 404 Error Pages(17)
  1. Pages Url Set Up Problem(5)
  2. Please Do Not Upload Adult Images - Accounts Will Be Banned(5)
  3. Php An Js Window.open Pages Trouble.(3)
  4. Data Access Pages ?(1)
  5. How To Get All Pages To Be Indexed(3)
  6. Php Pages Permission On Apache Server(1)
  7. Making Custom Error Pages With Cpanel(4)
  8. Still Getting Old Pages(6)
  9. Pages Not Found?(2)
  10. How Do I View My Site?(4)
  11. Adding Accessibility Features To Your Pages(0)
  12. Do You Want To Use Php Code In Your Html Pages?(9)
  13. Putting Data Of 2 Pages In Mysql At Once(1)
  14. Advantages Of Using Tableless Designs For Web Pages(17)
  15. Making A Dynamic Page On Blogspot(5)


 



- Lo-Fi Version Time is now: 6th September 2008 - 05:23 PM