Jump to content

Hiroshi

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Hiroshi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for your replies. I have turned on error reporting in the php.ini and it's not displaying anything. I have also tried putting the redirect code <?php include 'redirect.php'; ?> in the template index.php and the template header.php with no success. I also tried putting the code from the redirect.php directly into the root/index.php, template index.php and head.php with no success. I also have set the wordpress permalinks to numeric (not sure if it matters but someone else told me to try it.) Here is the code in the redirect.php file Please note I have changed the url and parameter for anonymity. <?php /** * Redirect script. * ---------------- * * How it works: * * 1. You MUST include this before ANYTHING on your page. E.g: * <?php * include 'redirect.php'; * ?> * <html> * ... * * 2. This script will redirect to an advertise url depending on which id specified. E.g: * http://yoursite.com?id=192 * ... will find ad with id "192" and then redirect to this page. * * It will only redirect if ?id= is specified as parameter, otherwise everything works like usual. */ if(isset($_POST['jviahfwagjfbvjahuiaf'])) { echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form action="http://'.htmlspecialchars($_SERVER['SERVER_NAME']).'" method="post" id="formy"> <input type="hidden" name="rfjafwofa" value="'.htmlspecialchars($_POST['jviahfwagjfbvjahuiaf']).'" /></form> <script language="JavaScript"> document.getElementById(\'formy\').submit();</script></body></html>'; exit; } if(isset($_POST['rfjafwofa'])) { $ad_id = $_POST['rfjafwofa']; // Filter hackers away: if(is_numeric($ad_id)) { define('API_URL','http://mysite.com/api.php'); // First retrive advertisement: $response = ''; // Use cUrl if it exists... if(function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, API_URL.'?ads_id='.$ad_id); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); } else // Otherwise just use this... { $response = @file_get_contents(API_URL); } // If advertisement was found: if($response != '') { // Redirect: header('Location: '.$response);exit; } } } if(isset($_GET['id'])) { echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form action="http://'.htmlspecialchars($_SERVER['SERVER_NAME']).'" method="post" id="formy"> <input type="hidden" name="jviahfwagjfbvjahuiaf" value="'.htmlspecialchars($_GET['id']).'" /></form> <script language="JavaScript"> document.getElementById(\'formy\').submit();</script></body></html>'; exit; } ?>
  2. Hello all, I would like to preface this with I really dont know that much about php and I'm in a bind pretty bad. Hopefully someone here can help Not sure if this should work with wordpress or not (or it may just be my lack of php knowledge). I got it to work on another non-wp site I built easily so I know the code is solid. It must be some sort of conflict with WP right? Here is how it should work: When a parameter is added to the url, example: http://www.mysite.com/?id=1234 it then redirects to a specific URL which is defined by "1234" on another website via a custom API. first line of code on my index.php file is <?php include 'redirect.php'; ?> which has all the info for the redirect its self. I was thinking I would put the same line in root/index.php at the top and include redirect.php in the same folder and everything would work but it's not functioning. It's just returning a blank page :-/ Could it be because the wordpress index.php already has to call other wordpress files? I'm completely lost. :-( Any help would be greatly appreciated. I would also be willing to pay someone to fix this if required. Thank you very much for your time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.