Help with this script please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mhende6600
    Confirmed User
    • Nov 2002
    • 740

    #1

    Help with this script please

    I am not a newbie, but I am not very good at scripts. I was searching for a random url script and ran a cross this script

    <?php

    // Go to a random URL

    $url[0] = "http://google.com/";
    $url[1] = "http://altavista.com/";
    $url[2] = "http://lycos.com/";

    srand ((double)microtime()*1000000);
    $randomnum = rand(0, count($url)-1);
    header ("Location: $url[$randomnum]");
    ?>


    When I add it to a file it does not work, can someone help me.
    Top Tier Traffic Every Niche
    Phone Sex Still Makes Money $$$
  • Cloak
    Registered User
    • Jul 2003
    • 56

    #2
    It works fine, you might be missing the <?php at the top. Make sure your file name is whatever.php (assuming your server handles that).

    Edit #5, damn thing won't properly parse the [ c o d e ] or the < ? p h p for some reason. Do the following

    Remove the spaces for the first line.

    < ? p h p
    $url[0] = "http://google.com/";
    $url[1] = "http://altavista.com/";
    $url[2] = "http://lycos.com/";

    srand ((double)microtime()*1000000);
    $randomnum = rand(0, count($url)-1);
    header ("Location: $url[$randomnum]");
    ?>
    Last edited by Cloak; 08-14-2003, 03:26 PM.
    Good cheap webhosting
    Post your homegrown pics here

    Comment

    • idle
      Confirmed User
      • Jun 2003
      • 100

      #3
      it's a PHP script. First your server has to support PHP.

      second add < ? p h p (without the spaces) to the top of your script.

      last, you need to rename your html file. eg, if your html file is called index.html or index.htm, rename it to index.shtml or index.php.

      this depends on your server settings. you will want to check with the admin.
      Last edited by idle; 08-14-2003, 03:31 PM.
      Cafe Hooters

      Comment

      Working...