1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Double Meta Refresh code help!

Discussion in 'Making Money' started by johnny2, Aug 24, 2010.

  1. johnny2

    johnny2 Newbie

    Joined:
    Aug 18, 2010
    Messages:
    1
    Likes Received:
    0
    Hi I am trying to redirect to pages on my blog with this code:
    <?php
    $page1 = "myblog/wordpress/?p=22";
    $page2 = "myblog/wordpress/?p=20";
    $page3 = "myblog/wordpress/?p=18";
    $page4 = "myblog/wordpress/?p=15"; $referer =
    $_SERVER['HTTP_REFERER']; $mypages = array($page1,
    $page2, $page3, $page4); $myrandompage =
    $mypages[mt_rand(0, count($mypages) -1)]; if($referer ==
    "") { echo "<meta http-equiv=\"refresh\"
    content=\"0;url=$myrandompage\">"; } else { echo "<meta
    http-equiv=\"refresh\" content=\"0;url=x.php\">"; } ?>

    Is there anything wrong with it? (apart from the URLS) because it just returns an error. Could anyone here give me the correct code for me to insert my URLS?
     
  2. μελαγχολία

    μελαγχολία Junior Member

    Joined:
    Jul 16, 2010
    Messages:
    198
    Likes Received:
    25
    Location:
    Somewhere over the rainbow
    Home Page:
    Please be more specific: what's the error? A PHP syntax error or what?
     
  3. Tcm9669

    Tcm9669 Regular Member

    Joined:
    Dec 30, 2007
    Messages:
    369
    Likes Received:
    26
    Doesnt return an error for me.. although I doubt this works.. coz for meta refresh to blank referrer you need 2 files I think.
     
  4. nesterdwarf

    nesterdwarf Regular Member

    Joined:
    May 30, 2008
    Messages:
    276
    Likes Received:
    539
    Location:
    State of Misery...er, Missouri...
    Code:
    
    <?php
    $page1 = "myblog/wordpress/?p=22";
    $page2 = "myblog/wordpress/?p=20";
    $page3 = "myblog/wordpress/?p=18";
    $page4 = "myblog/wordpress/?p=15";
    $referer =$_SERVER['HTTP_REFERER'];
    $mypages = array($page1,$page2, $page3, $page4);
    $myrandompage =$mypages[mt_rand(0, count($mypages) -1)];
    if($referer =="")
    	{
    		echo "<meta http-equiv=\"refresh\" content=\"0;url=$myrandompage\">";
    	} else {
    		echo "<meta http-equiv=\"refresh\" content=\"0;url=x.php\">"; 
    } ?>