View Single Post
Old 03-09-2008, 06:56 PM  
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
In the long run, the ionic method is far better from an updating standpoint when you run a ton of sites on many different servers... here's another tip on how to use this (been doing this myself for 3 years now)... If you have multiple sites on one server, create a common directory somewhere...

example.

/www/domain1.com/html
/www/domain2.com/html
/www/domain3.com/html
/www/domain4.com/html
/www/links <- create this one.

Now put that links.php file in that directory. i.e.:
/www/links/links.php

Now for each of your sites, you simple put a links.php file in there that includes that core file (as well as the .htaccess file). i.e.
/www/domain1.com/html/links/links.php
/www/domain2.com/html/links/links.php
/www/domain3.com/html/links/links.php
/www/domain4.com/html/links/links.php
/www/links/links.php <- core file

the links.php file for each domain just has the following in it:
<?php @include('/www/links/links.php'); ?>

Now you only have to update one file per server and ALL your sites are updated at once.

That code can be expanded like crazy to add in campaign tracking per site, log the clicks or whatever... the only issue is that you will end up with 1000s of links in that file which will make it very big.. At that point you need to start breaking it up into sections. Could be done per sponsor. eg:

these ones contain all the links:
/www/links/nastydollars.php
/www/links/bangbros.php
/www/links/topbucks.php

then each site could be
/www/domain1.com/html/links/nd/links.php
/www/domain1.com/html/links/bbo/links.php
/www/domain1.com/html/links/tb/links.php

And those links files include the approriate sponsor core link file. You'll need to adjust the .htaccess file for the correct path.

Couple other things.. You should send a proper 404 if the script fails etc. So I'd mod it like this and also do a couple things to try and cut down on the size of the file when you start adding more and more links..

Code:
<?php
	$key = (isset($_GET['id']) ? trim($_GET['id']) : '');
	if( $key == '' ){
		do404();
	}
	$links = array(
		'reality-kings' => 'www.realitykings.com/main.htm?id=fapgallery&p=clean',
		'college-fuckfest' => 'signupsb.triplexcash.com/cgi/click?account=560307&site=2&program=2'
	);
	if( isset($links[$key]) ){
		$url = (substr($links[$key], 0, 4) == 'http' ? $links[$key] : 'http://'.$links[$key]);
		header("Location: $url");
		exit;
	}
	do404();

function do404(){
	header('HTTP/1.1 404 Not Found');
?><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL was not found on this server.
</BODY></HTML>
<?php
	exit;
}
?>
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote