Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 4 of 4
  1. #1

    Default Random Page script?

    You know the way you can have a random image script?

    Where it selects an image at random out of the list of them which you have put into the php file, is it possible to do this, but with a page.

    So, A random Page script.

    I want this so i can have various adverts on my page for different pages on my site.

  2. #2
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    Yeah

    Code:
    <?php
    $number = rand(1, 3);
    if ($number = 1)
    header("Location: 1stpage.php");
    if ($number = 2)
    header("Location: 2ndpage.php");
    if ($number = 3)
    header("Location: 3rdpage.php");
    ?>



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  3. #3

    Default

    Thanks alot mate

  4. #4
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    If you don't have PHP support.
    HTML Code:
    <script type="text/JavaScript">
    <!--Begin
    var pages = new Array('page1.htm','page2.htm','page3.htm');
    
    function rand_page() {
      var rand_num;
      rand_num = Number(Math.floor(Math.random()*pages.length));
      return pages[rand_num];
    }
    
    document.location.href = rand_page();
    //-->
    </script>
    That should work, but I haven't tested it (I might've made a typo).

Posting Permissions

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