+ Reply to Thread
Results 1 to 3 of 3

Thread: view only once php block

  1. #1
    wolfster is offline x10Hosting Member wolfster is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    23

    view only once php block

    hi all,
    What I am after is a block or page (preferably the block) that displays only once per registered user.
    I wish to start running little puzzle competitions on my site when i make it active.

    the block should only be displayed to registered users and after a certain time period it should redirect to a different page, if the registered user tries to view the block again they should be redirected immediately bypassing the block so its no viewable again by that user..

    I have very limited php experience and have not got a clue where to start...
    Im using PHP Version5.2.12
    and MySQL Version5.0.87

    Im now off to do some research myself, just thought Id post here cos posts generally get an answer here where other php specailist sites posts sometimes get ignored...

    TIA
    Wolfster

  2. #2
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: view only once php block

    If you do some more general research on php and build a login system you'll notice it's easy.
    1. Check (in the database) whether the user can see the block.
    2a. If allowed: display the block (*)
    3a. Update the database
    2b. If not allowed: display something else

    (*) redirecting after a certain amount of time is possible in theory. In practice, you'll notice it won't always work. Two methods I can think of to redirect after a certain period are meta redirects and javascript, which both can be blocked by the client. Secondly, if you get redirected, you can just press "previous" and see the previous page... (although you might be able to fix that with some cache control headers)
    Last edited by marshian; 01-29-2010 at 02:16 PM.
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

  3. #3
    daman371 is offline x10 Sophmore daman371 is an unknown quantity at this point
    Join Date
    Nov 2006
    Location
    Louisiana
    Posts
    130

    Re: view only once php block

    Quote Originally Posted by marshian View Post
    If you do some more general research on php and build a login system you'll notice it's easy.
    1. Check (in the database) whether the user can see the block.
    2a. If allowed: display the block (*)
    3a. Update the database
    2b. If not allowed: display something else

    (*) redirecting after a certain amount of time is possible in theory. In practice, you'll notice it won't always work. Two methods I can think of to redirect after a certain period are meta redirects and javascript, which both can be blocked by the client. Secondly, if you get redirected, you can just press "previous" and see the previous page... (although you might be able to fix that with some cache control headers)
    Pretty spot on.

+ Reply to Thread

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  3. My 2cents on Ruby vs PHP.
    By jwillia in forum Programming Help
    Replies: 0
    Last Post: 03-15-2008, 11:18 PM
  4. Replies: 3
    Last Post: 03-10-2008, 12:22 PM
  5. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers