Jump to content

Recommended Posts

I currently have a website I am developing in Joomla 1.5.8

 

I need to limit the article views to 1 hit/User/Day eg

 

1:  User 1 views Article A and it records 1 hit in the DB

2:  User 1 views Article B and it records 1 hit in the DB

3:  User 1 views Article A again but it records no hit in DB because he already viewed it

 

I imaging this can be done by setting a cookie in the code that calls the content page and letting it expire the session after 24 hours.

 

I am just not sure how to go about this in Joomla

The only problem with using cookies is if the person deletes them.

 

I'd personally record each user's IP address in a mysql table, and the date they last viewed the article.

 

Then each time someone comes to view an article, check they haven't already seen it in the last 24 hours.

  • 2 weeks later...

just tag the username to the article, do a strpos scan for the username ( which is required to be unique ) and flush periodically as required.

 

Note that IP isn't reliable for this purpose, user may use another computer/location, but username remain a constant.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.