SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile putting a constraint on user

    i am developing a website where i want every registered user must be able to view only one profile per day
    how can i achieve this?
    could anyone guide me with the code plz
    Last edited by sneha24; May 11, 2009 at 23:08.

  2. #2
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is pretty vague. View one profile? Do you have some code we can help you with?

  3. #3
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you could have a column in the users table such as "last_profile_viewed_at" where you would store a datetime of the last time the user viewed any profile.

    Then on the profile page - just fetch user from the table and check if 24 hours has already passed since his last profile view. If not, redirect him back to homepage, if yes, allow him to see the profile and update the "last_profile_viewed_at" column in the database.

  4. #4
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To add to risoknop's suggestion...

    When the user logs in, you could pull the timestamp from the db then, and set it to a session var.

    Then compare that with the current time to disable any link that would allow them to view a profile.
    No, I REALLY dislike having to use Joomla.

  5. #5
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    thanks a lot
    ll work it out and reply soon


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •