Please check this code?!

Discussion in 'PHP' started by martyn11post, Mar 21, 2008.

  1. #1
    <?php  $rnd = rand(1, 10);
    $filename = "ads" . $rnd;
       
    $url = $HTTP_SERVER_VARS['SERVER_NAME'] . $HTTP_SERVER_VARS['REQUEST_URI'];
    
    
    
    switch ($url) {
    case "www.moneymakingstudent.co.uk/index.php":
        include ("http://www.purplesunset.co.uk/main/basic/matchedindex.php");
        break;
    case "www.moneymakingstudent.co.uk/":
        include ("http://www.purplesunset.co.uk/main/basic/matchedindex.php");
        break;
    default:
        include ("http://www.purplesunset.co.uk/main/basic/$filename.php");
        break;
    };
     ?>
    PHP:

    For some reason only the default is being shown, I am using wordpress, not sure if that is causing the problem?

    Any help or suggestions would be great,

    Many thanks
    Martyn:confused:
     
    martyn11post, Mar 21, 2008 IP
  2. Cybernaut

    Cybernaut Peon

    Messages:
    408
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this:

    $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    Code (markup):
     
    Cybernaut, Mar 21, 2008 IP
  3. martyn11post

    martyn11post Guest

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Cybernaut, that worked! :)
     
    martyn11post, Mar 21, 2008 IP