' . join('|', $known) . ')[/ ]+(?[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $u_agent, $matches)) { // we have no matching number just continue } // see how many we have $i = count($matches['browser']); if ($i != 1) { //we will have two since we are not using 'other' argument yet //see if version is before or after the name if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) { $version = $matches['version'][0]; } else { $version = $matches['version'][1]; } } else { $version = $matches['version'][0]; } // check if we have a number if ($version == null || $version == "") { $version = "?"; } return array( 'userAgent' => $u_agent, 'name' => $bname, 'version' => $version, 'platform' => $platform, 'pattern' => $pattern ); } $UA = getBrowser(); $CF = ""; if (!$isCloudFlare) { $IP = @$_SERVER['REMOTE_ADDR']; } else { $IP = @$_SERVER["HTTP_CF_CONNECTING_IP"] or $IP = @$_SERVER['REMOTE_ADDR']; $CF = "-> Cloudflare possible"; } if ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_X_FORWARDED'] || $_SERVER['HTTP_FORWARDED_FOR'] || $_SERVER['HTTP_VIA'] || in_array($_SERVER['REMOTE_PORT'], array( 8080, 80, 6588, 8000, 9000, 9090, 3128, 553, 554 )) || @fsockopen($IP, 80, $errno, $errstr, 1)) { $proxy = "detected"; } $ref = @$_SERVER['HTTP_REFERER'] or $ref = "Unknown"; $vID = sha1(session_id() . $IP . $UA['name'] . $UA['version'] . $UA['platform'] . $proxy); // Unique visistor ID $visit_data = "Visistor $vID from IP $IP -> Browser: $UA[name] $UA[version] | OS: $UA[platform] | Proxy: $proxy $CF\n"; class xzlog { public $file = "log_file.log"; public $swch = false; public function file($file) { $this->file = $file; } public function status($eod) { $this->swch = $eod; } public function write($data = "This is log comment") { if ($this->swch) { $log_data = date("[d/M/Y H:i:s]") . " $data"; if (file_put_contents($this->file, $log_data, FILE_APPEND)) { return true; } } return false; } } $log = new xzlog; $log->file($log_file); $log->status($log_enabled); $log->write($visit_data); $log->write("Visistor referred by $ref\n"); if (isset($_GET['id'])) { $ID = preg_replace('/\D/', '', $_GET['id']); $log->write('$_GET[\'id\'] parameter detected -> ' . $ID . "\n"); if (array_key_exists($ID, $URLs)) { $URL = trim(preg_replace('/\s+/', ' ', $URLs[$ID])); $log->write('$_GET[\'id\'] parameter -> ' . $ID . " has found in database -> $URL\n"); $RDR = true; } } else { $URL_count = count($URLs) - 1; $ID = mt_rand(0, $URL_count); $URL = trim(preg_replace('/\s+/', ' ', $URLs[$ID])); $log->write("ID selected by random -> $ID -> $URL\n"); $RDR = true; } if ($RDR) { $log->write("Visistor $vID redirected to it's location.\n" . str_repeat("_", 148) . "\n"); header("location: $URL"); // Just in case if browser ignore redirect header $eHTML = "\n\n\n\n\n

CLICK HERE

\n\n"; die($eHTML); } else { $log->write('$_GET[\'id\'] parameter -> ' . $ID . " has not found in database\n" . str_repeat("_", 148) . "\n"); echo "\nID Not found\nThe URL ID you have selected is not available in database.
\n"; echo "Check one of the exist URLs:
\n"; foreach ($URLs as $key => $URL) { echo "$key -> $URL
\n"; } echo "\n"; exit; } ?>