Random help!

Discussion in 'HTML & Website Design' started by Fisix, May 29, 2010.

  1. #1
    Im trying to make a simple website fuction, I want a button that displays 1 of 6 random phrases but can only be used once an hour by anyone visiting the site? It must display the same phrase to all who views it?
     
    Fisix, May 29, 2010 IP
  2. digital29

    digital29 Peon

    Messages:
    462
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?
    $num = Rand (1,6);
    switch ($num)
    {
    case 1:
    echo "Relax ... Listen To The Sound Of Your Heartbeat";
    break;
    case 2:
    echo "Celebrate ... Life's Special Moments";
    break;
    case 3:
    echo "Connect ... Let Two Become One";
    break;
    case 4:
    echo "Remember ... Create Memories That Last A Lifetime!";
    break;
    case 5:
    echo "Remember ... Create Memories That Last A Lifetime!";
    break;
    case 6:
    echo "Remember ... Create Memories That Last A Lifetime!";
    break;
    }
    ?>

    Replace those phrases with your own
    This is the only thing I can do...but it will put a random phrase to every refresh...not every hour
     
    digital29, May 30, 2010 IP
  3. dipenrique

    dipenrique Peon

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    dude u want that one visitor to refresh it only a hour at max..then u need to save their ip address info too.. search for some similar phps like people can vote only once a day,change it to once a hour and instead of the voting code,put the code that the above person has written,for phrase according to your need
     
    dipenrique, May 31, 2010 IP