PHP Redirect plugin suddenly stopped working

Discussion in 'PHP' started by Soamelt, Nov 25, 2008.

  1. #1
    Help! I'm was running a WP Plugin that redirect my affiliate links. All of a sudden it has stopped working- I'm getting a blank page when I try out the links. The links show up as:
    http://mysite.com/og.php?url=http://affiliatelink.com
    which is correct, but instead of redirecting, it's blank.

    Here's the redirect part of the code for the plugin script...I've uninstalled and reinstalled it to no avail and I'm pretty sure I haven't made any other changes to my site other than a post since it stopped working. Help please!

    $OutGoingURL =   "/og.php";
    
    function ConvertURLs($aText)
    {
    	global $OutGoingURL;
    
    	$st_aal_before = get_option('st_aal_before');
    	$searchfor = explode("\r\n", trim($st_aal_before));
    
    	for($i = 0; $i < count($searchfor); $i++)
    	{
    		$searchfor[$i] = "|href=['\"](" . $searchfor[$i] . ".*)/?['\"]|Ui";
    	}
    
    	get_option('siteurl');
    	$aText = preg_replace($searchfor, "href='" . get_option('siteurl'). "$OutGoingURL?url=$1" ."'", $aText);	
    	return $aText;
    }
    
    
    if(strstr( $_SERVER['REQUEST_URI'], $OutGoingURL))
    {
    	$st_aal_after = get_option('st_aal_after');
    	$replacewith = explode("\r\n", trim($st_aal_after));
    
    	$st_aal_before = get_option('st_aal_before');
    	$searchfor = explode("\r\n", trim($st_aal_before));
    	for($i = 0; $i < count($searchfor); $i++)
    	{
    		$searchfor[$i] = "|(" . $searchfor[$i] . ").*|Ui";
    	}
    	
    	$lURL = $_SERVER['QUERY_STRING'];
    	// Bit of a hack, the query string may have multiple ? and & so just knock the url= bit off the querystring
    	$lURL = substr($lURL, 4, strlen($lURL));
    	$lNewURL = preg_replace($searchfor, $replacewith, $lURL);	
    	$lNewURL = str_replace("%TARGET%", $lURL, $lNewURL);;
    	$lNewURL = str_replace("%ENCODED_TARGET%", urlencode($lURL), $lNewURL);;
    
    	header("location: $lNewURL"); 
    	exit;
    }
    Code (markup):

     
    Soamelt, Nov 25, 2008 IP
  2. kallell

    kallell Peon

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    by chance, is there any blank space at the bottom or top of the php? If there is, remove it. Php is retarded sometimes. Also, is this your own website?
     
    kallell, Nov 26, 2008 IP