function encode($encode_str) { $iv = mcrypt_create_iv(mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $encode_str = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, 'x787sdds7', $encode_str, MCRYPT_MODE_ECB, $iv); return $encode_str; } $driverId = $_REQUEST['driverid']; $currentdate = date("j M Y"); //print "MMMMM $driverId"; // get ServerName $serverName = $_SERVER["HTTP_HOST"]; if (!$serverName) { $serverName = $_SERVER["SERVER_NAME"]; } $redirectUrl = "http://" . $serverName . "/drivers/" . floor($_REQUEST['driver_id']/1000) . "/{$_REQUEST['driver_id']}.htm"; header("HTTP/1.1 301 Moved Permanently"); // permanent redirect header("Location: ".$redirectUrl); exit; require_once("./../icx/thirdparty/solvemedia/solvemedialib.php"); $error = NULL; // validate if submitted if ($_REQUEST["validate_solvemedia"]) { $privatekey = "LeXkZIKAswmEI3XNxRJSM7IH1OVU.sgc"; $resp = solvemedia_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], $hashkey); // print "
{$_POST["adcopy_challenge"]}, {$_POST["adcopy_response"]}
"; // print_r($resp); if (!$resp->is_valid) { $error = "The question wasn't answered correctly. Please try again."; } else { // determine the correct x-drivers site $xServerName = str_replace("drivers","Drivers",ucfirst(str_replace("www.","",$serverName))); // get expire time for md5 encoding $encodedArray = array(); $now = date('U'); $expireMins = 20; // user has 20 minutes to download their driver $expireTime = $now + ($expireMins*60); $encodedArray['expireTime'] = $expireTime; $encodedArray['driverid'] = $driverId; $encodedArray['xs'] = $xServerName; $cc = serialize($encodedArray); $encodedCode = urlencode(base64_encode(encode(base64_encode($cc)))); $url = "http://www.driverguide.com/driver/detail.php?driverid={$driverId}&xdl=1&action=download&expcode={$encodedCode}"; header("Location: ".$url); exit; } } // determine the correct site name for header title $xServerNameTitle = str_replace("-drivers"," Driver",ucfirst(str_replace("www.","",str_replace(".com","",$serverName)))); $xServerShortName = str_replace("-drivers","",strtolower(str_replace("www.","",str_replace(".com","",$serverName)))); $body = <<< EOT{$xServerNameTitle} Download
$currentdate
{$error}To Download the file, please prove that you are human by solving the puzzle below.
You are not signing up for anything by doing this.