The Source Posted February 23, 2009 Share Posted February 23, 2009 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 Quote Link to comment Share on other sites More sharing options...
jackpf Posted February 23, 2009 Share Posted February 23, 2009 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. Quote Link to comment Share on other sites More sharing options...
php_east Posted March 8, 2009 Share Posted March 8, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.