PHPBuilder - PHP Redirector



RSS Twitter
Snippets Http

PHP Redirector

by: robert mcnutt
|
August 29, 2000

Version: 0.17

Type: Full Script

Category: HTTP

License: GNU General Public License

Description: This script redirects you to either a defined query or just a http site. It has support for custom queries and it logs all redirections to a txt file. No MySQL needed



<?php
// ReDirect Script by rmac
// redir.php
// version 0.17
// http://www.rmac2k.net
//
// to configure just 
// make $home = "yourwebsite";
// and create the file redirdata.php and allow it to be written globally
// then go down to custom queries
// -----------------
// edit these varibles
//------------------
$DATA_FILE = "redirdata.php";
$home = "http://www.rmac2k.net";

// do not edit this area
// ----------------------------------------------------------
if (strlen($QUERY_STRING) > 2) {
if (file_exists($DATA_FILE)) {
	$fp = fopen("$DATA_FILE", "a");
	flock($fp, 1);
	$count = $QUERY_STRING;
        $ip = $REMOTE_ADDR;
        $from = " from ";
        $today = gmdate("F j, Y, g:i:s a");
        $space = " -- ";
        $time = mktime();
        $newline = "<br>";
	fseek($fp,0);
        fputs($fp, $today);
        fputs($fp, $space);
	fputs($fp, $count);
        fputs($fp, $space);
        fputs($fp, $from);
        fputs($fp, $ip);
        fputs($fp, $newline);
	flock($fp, 3);
	fclose($fp);
} else {
	echo "Can't find file, check '\$file' <BR>";
}
// end do not edit area
// -----------------------------------------------------------
// BEGIN REDIRECT
// edit below
//--------------------------------------
// add custom queries, ie: http://blah.com/redir.php?packetstorm
//--------------------------------------

if ($QUERY_STRING == "securityfocus") { $url = "http://www.securityfocus.com"; }

else if ($QUERY_STRING == "packetstorm") { $url = "http://packetstorm.securify.com"; }

else if ($QUERY_STRING == "insecure") { $url = "http://www.insecure.org"; }


// Do not edit below
else { $url = $QUERY_STRING; }
} 
else { 
$url = $home; 
}
header("Location: $url");
echo "redirecting...";
?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
robert mcnutt

Comment:



Comment:

(Maximum characters: 1200). You have characters left.