/**
$Id: MH-Media_PS5_redirect.php,v 1.5 2012/07/02 20:57:08 tmmjeff Exp $
** Notes:
-- Client: MH-Media (id: 668)
-- Original Ticket: 0668-11173-0004
-- Filename: MH-Media_PS5_redirect.php
-- Redirect old PS5 (PartnerSoft V5) links to NATS links
-- Overall Project Plan:
-- Client needs to duplicate their tour pages and FHGs. These copies will use the "proper" NATS links.
-- Sample link code
http://www.crazybeauties.com/t1/revs=mikertd/videos_recent.php
http://www.crazybeauties.com/t1/REVS=mikertd/videos_recent.php
http://www.crazybeauties.com/t1/REVS=mikertd/join.html
http://www.crazybeauties.com/t1/NoProg=NoAdvert/videos_recent.php
http://www.crazybeauties.com/t1/
** Rules:
-- TMM will redirect all traffic from their t1/ directory to the redirect script that was created within the appropriate t2/ directory
-- Within this example URL, the Prog is rev, and the affiliate is "mikertd" - crazybeauties.com/t1/revs=mikertd/videos_recent.php
-- When a program is not in the t1/ URL, OR an affiliate is not in the t1/ URL, I remove the affiliate and program completely. Instead, I connect the traffic to type in traffic, without any program or affiliate connection to the surfer.
-- When a Program and Affiliate are both sent in the t1/ URL, I send the surfer through a NATS redirect, connecting that surfer to that affiliate, and a program. The program is based on the following:
-- If the affiliate is crakmedia, ffmihai, pornhub, or yooprndotcom, I will connect them to the "60% Revshare" (NATS id: 2), for ALL sites and ALL tours. They will never get traffic through the redirect for "50% Revshare" (NATS id: 1).
-- Traffic with all other affiliates will be connected to "50% Revshare" (NATS id: 1)
** Domain -> NATS mapping:
Amateur18.tv, join.amateur18.tv, am18, MC4wLjQuNC4wLjAuMC4wLjA in PS5 "am"
AsianHotBunnies.com, join.asianhotbunnies.com ahb, MC4wLjkuOS4wLjAuMC4wLjA
BigBreast.tv, join.bigbreast.tv bb, MC4wLjMuMy4wLjAuMC4wLjA
BrazilPartyOrgy.com, join.brazilpartyorgy.com bpo, MC4wLjIzLjIzLjAuMC4wLjAuMA
CastingBunnies.com, join.castingbunnies.com cab, MC4wLjI1LjI1LjAuMC4wLjAuMA
ChubbyWorlds.com, join.chubbyworlds.com cw, MC4wLjE4LjE4LjAuMC4wLjAuMA
CrazyBeauties.com, join.crazybeauties.com, cb, MC4wLjEuMS4wLjAuMC4wLjA
CrazyMonsterCock.com, join.crazymonstercock.com, cmc, MC4wLjExLjExLjAuMC4wLjAuMA
CrazyMouthMeat.com, join.crazymouthmeat.com cmm, MC4wLjE0LjE0LjAuMC4wLjAuMA
CrazyOldMoms.com, join.crazyoldmoms.com, com, MC4wLjguOC4wLjAuMC4wLjA
CrazyPeeGirls.com, join.crazypeegirls.com, cpg, MC4wLjEzLjEzLjAuMC4wLjAuMA
Deep-Throat.tv, join.deep-throat.tv, dt, MC4wLjIuMi4wLjAuMC4wLjA
DildoPenetrations.com, join.dildopenetrations.com, dp, MC4wLjEyLjEyLjAuMC4wLjAuMA
ExGFSexxx.com, join.exgfsexxx.com, exgfs, MC4wLjE3LjE3LjAuMC4wLjAuMA
ExtremeAmateurMovies.com, join.extremeamateurmovies.com, eam, MC4wLjI5LjI5LjAuMC4wLjAuMA
ExtremeMoviePass.com, join.extrememoviepass.com, exmp, MC4wLjMyLjMzLjAuMC4wLjAuMA in PS5 "em"
ExtremeTranny.com, join.extremetranny.com, extr, MC4wLjEwLjEwLjAuMC4wLjAuMA in PS5 "ext"
FistingFiles.com, join.fistingfiles.com, ff, MC4wLjYuNi4wLjAuMC4wLjA
FlexiDolls.com, join.flexidolls.com, fd, MC4wLjE2LjE2LjAuMC4wLjAuMA
HerFirstKisses.com, join.herfirstkisses.com, hfk, MC4wLjcuNy4wLjAuMC4wLjA
iLikeHandJobs.com, join.ilikehandjobs.com, ilhj, MC4wLjI0LjI0LjAuMC4wLjAuMA
LookiamHairy.com, join.lookiamhairy.com, liah, MC4wLjIwLjIwLjAuMC4wLjAuMA
OnlyBreast.com, join.onlybreast.com, ob, MC4wLjUuNS4wLjAuMC4wLjA
PornOnStage.com, join.pornonstage.com, pos, MC4wLjIyLjIyLjAuMC4wLjAuMA
RealTeenDolls.com, join.realteendolls.com, rtd, MC4wLjE5LjE5LjAuMC4wLjAuMA
ScandalOnStage.com, join.scandalonstage.com, sos, MC4wLjI2LjI2LjAuMC4wLjAuMA
SweetPartyChicks.com, join.sweetpartychicks.com, spc, MC4wLjE1LjE1LjAuMC4wLjAuMA
MyBangVan.com, join.mybangvan.com, mbv, MC4wLjIxLjIxLjAuMC4wLjAuMA
-- I originally asked for a list of his current domains mapped to his NATS linkdomain, NATS shortname,
and NATS detaul code for that site/tour. Though he provided things like Amateur18.tv, I need to
ensure he understands that I need all his domains/URLs used within PS5, and not just all his current
sites configured within PS5. These need to be confirmed.
** How their current links/redirect work:
-- In the examples above, both videos_recent.php and join.html are actually files within the /t1 directory. Ex:
-- $ls -la
drwxr-xr-x 2 web64 ftponly 4096 2012-05-16 08:13 .
drwxr-xr-x 18 web64 ftponly 4096 2012-05-16 07:39 ..
....
-rw-r--r-- 1 web64 ftponly 1031 2008-09-15 23:54 .htaccess
-rw-r--r-- 1 web64 ftponly 5913 2010-01-07 01:48 index.html
-rw-r--r-- 1 web64 ftponly 6576 2011-11-19 09:55 join.html
....
-rw-r--r-- 1 web64 ftponly 11984 2010-10-25 09:14 videos_recent.php
....
-- Within the t1 directory, they have a .htaccess script ensures that there is always an Affiliate and Program. Without this it rediects to include the following:
-- www.crazybeauties.com/t1/NoProg=NoAdvert/videos_recent.php
-- This is controlled within their .htaccess file in the t1 directory:
$cat .htaccess
#Options +ExecCGI
AddType application/x-httpd-php .php .htm .html .shtml
AddHandler cgi-script .cgi
#php_value auto_prepend_file /home/www/web64/html/jb/redir.php
SetEnv PS_SITE_CODE cb
SetEnv PS_TOUR_CODE t1
SetEnv PS_PROC_ID CCBILL
SetEnv PS_CASCADE CCBILL|VEROTEL
SetEnv PS_PRG_DEFAULT revs
RewriteEngine on
RewriteBase /t1
# Rewrite rules for valid programs
# Take care of REVS program with affiliate id passed
RewriteRule ^(([^/]+/)*)REVS=([^/]+)(/(.*))?$ $1$5 [L,NC,E=PSID:$3,E=PRGID:REVS,E=POPUP:YES,E=TBACK:NO]
# Take care of no program or no valid program with affiliate id passed
RewriteRule ^(([^/]+/)*)NoProg=([^/]+)(/(.*))?$ $1$5 [L,NC,E=PSID:$3,E=PRGID:NoProg,E=POPUP:Y,E=TBACK:N]
# Take care of affiliate with invalid program, and redirect to NoProg
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^[^/]+=([^/]+)/(.*)$ NoProg=$1/$2 [L,R,NC]
# Take care of no tracking whatsoever, and redirect to NoProg
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^([^/]+=/)?(.*)$ NoProg=NoAdvert/$2 [L,R,NC]
** Implementation On Server:
-- Place this redirect onto their server within t1 (or any tour directory). The name is not important
-- Update their .htaccess file to push all traffic, with all path information, to the NEWTOUR/ps5_to_nats_redirect.php
-- .htaccess rewrite Example:
RewriteEngine On
RewriteRule (.*) /t2/ps5_to_nats_redirect.php?passedall=$1
-- This of course needs to be tested.
-- Run through a test link. Do you get sent through NATS, and then to the proper tour?
** To Do:
-- Still need to figure out specifics on what client wants to do for no aff / no prog. I believe, just use Default NATS code.
-- Chat:
(10:12:34 AM) TMM Jeff - ICQ: I can either make this be Type In traffic, or you can let me know the affiliate/program to use by default.
(10:13:26 AM) mike: make type-in
(10:17:05 AM) TMM Jeff - ICQ: Again, Type-In traffic means no affiliate, no program. If you want the traffic to be connected to an Affiliate, I will also need a program. If you just want all the traffic to be connected to Type-In, there will be no affiliate.
(10:17:59 AM) TMM Jeff - ICQ: I can set this up however you like. I just need to know the specifics of what you want :)
(10:19:51 AM) mike: no affiliate - please
(10:20:15 AM) mike: no affiliate, no program
*/
$inTesting = FALSE; // This will print some mojo, and not redirect
// header('Connection: close');
/* get the right info */
$programname = "revshare"; // id:1, program name: 50% Revshare, Shortname: revshare
$siteshort = "cb"; // NEED TO CONFIRM THIS!! siteID:1, Site Name: CrazyBeauties.com, Shortname: cb
$username = "NoAdvert";
// $sitename = "join.crazybeauties.com/track/"; // overwritten later.
//get end of site
$sitename = $_SERVER['HTTP_HOST'];
$site_parts = explode('.', $sitename);
$len = count($site_parts);
$sitename = $site_parts[$len-2].'.'.$site_parts[$len-1];
// map the sitename to the nats site
$sitename = strtolower($sitename);
switch($sitename) {
case 'amateur18.tv' : {
$sitename = "join.amateur18.tv";
$siteshort = "am18";
$defaultnats = "MC4wLjQuNC4wLjAuMC4wLjA";
break;
}
case 'asianhotbunnies.com' : {
$sitename = "join.asianhotbunnies.com";
$siteshort = "ahb";
$defaultnats = "MC4wLjkuOS4wLjAuMC4wLjA";
break;
}
case 'bigbreast.tv' : {
$sitename = "join.bigbreast.tv";
$siteshort = "bb";
$defaultnats = "MC4wLjMuMy4wLjAuMC4wLjA";
break;
}
case 'brazilpartyorgy.com' : {
$sitename = "join.brazilpartyorgy.com";
$siteshort = "bpo";
$defaultnats = "MC4wLjIzLjIzLjAuMC4wLjAuMA";
break;
}
case 'castingbunnies.com' : {
$sitename = "join.castingbunnies.com";
$siteshort = "cab";
$defaultnats = "MC4wLjI1LjI1LjAuMC4wLjAuMA";
break;
}
case 'chubbyworlds.com' : {
$sitename = "join.chubbyworlds.com";
$siteshort = "cw";
$defaultnats = "MC4wLjE4LjE4LjAuMC4wLjAuMA";
break;
}
case 'crazybeauties.com' : {
$sitename = "join.crazybeauties.com";
$siteshort = "cb";
$defaultnats = "MC4wLjEuMS4wLjAuMC4wLjA";
break;
}
case 'crazymonstercock.com' : {
$sitename = "join.crazymonstercock.com";
$siteshort = "cmc";
$defaultnats = "MC4wLjExLjExLjAuMC4wLjAuMA";
break;
}
case 'crazymouthmeat.com' : {
$sitename = "join.crazymouthmeat.com";
$siteshort = "cmm";
$defaultnats = "MC4wLjE0LjE0LjAuMC4wLjAuMA";
break;
}
case 'crazyoldmoms.com' : {
$sitename = "join.crazyoldmoms.com";
$siteshort = "com";
$defaultnats = "MC4wLjguOC4wLjAuMC4wLjA";
break;
}
case 'crazypeegirls.com' : {
$sitename = "join.crazypeegirls.com";
$siteshort = "cpg";
$defaultnats = "MC4wLjEzLjEzLjAuMC4wLjAuMA";
break;
}
case 'deep-throat.tv' : {
$sitename = "join.deep-throat.tv";
$siteshort = "dt";
$defaultnats = "MC4wLjIuMi4wLjAuMC4wLjA";
break;
}
case 'dildopenetrations.com' : {
$sitename = "join.dildopenetrations.com";
$siteshort = "dp";
$defaultnats = "MC4wLjEyLjEyLjAuMC4wLjAuMA";
break;
}
case 'exgfsexxx.com' : {
$sitename = "join.exgfsexxx.com";
$siteshort = "exgfs";
$defaultnats = "MC4wLjE3LjE3LjAuMC4wLjAuMA";
break;
}
case 'extremeamateurmovies.com' : {
$sitename = "join.extremeamateurmovies.com";
$siteshort = "eam";
$defaultnats = "MC4wLjI5LjI5LjAuMC4wLjAuMA";
break;
}
case 'extrememoviepass.com' : {
$sitename = "join.extrememoviepass.com";
$siteshort = "exmp";
$defaultnats = "MC4wLjMyLjMzLjAuMC4wLjAuMA";
break;
}
case 'extremetranny.com' : {
$sitename = "join.extremetranny.com";
$siteshort = "extr";
$defaultnats = "MC4wLjEwLjEwLjAuMC4wLjAuMA";
break;
}
case 'fistingfiles.com' : {
$sitename = "join.fistingfiles.com";
$siteshort = "ff";
$defaultnats = "MC4wLjYuNi4wLjAuMC4wLjA";
break;
}
case 'flexidolls.com' : {
$sitename = "join.flexidolls.com";
$siteshort = "fd";
$defaultnats = "MC4wLjE2LjE2LjAuMC4wLjAuMA";
break;
}
case 'herfirstkisses.com' : {
$sitename = "join.herfirstkisses.com";
$siteshort = "hfk";
$defaultnats = "MC4wLjcuNy4wLjAuMC4wLjA";
break;
}
case 'ilikehandjobs.com' : {
$sitename = "join.ilikehandjobs.com";
$siteshort = "ilhj";
$defaultnats = "MC4wLjI0LjI0LjAuMC4wLjAuMA";
break;
}
case 'lookiamhairy.com' : {
$sitename = "join.lookiamhairy.com";
$siteshort = "liah";
$defaultnats = "MC4wLjIwLjIwLjAuMC4wLjAuMA";
break;
}
case 'onlybreast.com' : {
$sitename = "join.onlybreast.com";
$siteshort = "ob";
$defaultnats = "MC4wLjUuNS4wLjAuMC4wLjA";
break;
}
case 'pornonstage.com' : {
$sitename = "join.pornonstage.com";
$siteshort = "pos";
$defaultnats = "MC4wLjIyLjIyLjAuMC4wLjAuMA";
break;
}
case 'realteendolls.com' : {
$sitename = "join.realteendolls.com";
$siteshort = "rtd";
$defaultnats = "MC4wLjE5LjE5LjAuMC4wLjAuMA";
break;
}
case 'scandalonstage.com' : {
$sitename = "join.scandalonstage.com";
$siteshort = "sos";
$defaultnats = "MC4wLjI2LjI2LjAuMC4wLjAuMA";
break;
}
case 'sweetpartychicks.com' : {
$sitename = "join.sweetpartychicks.com";
$siteshort = "spc";
$defaultnats = "MC4wLjE1LjE1LjAuMC4wLjAuMA";
break;
}
case 'mybangvan.com' : {
$sitename = "join.mybangvan.com";
$siteshort = "spc";
$defaultnats = "MC4wLjIxLjIxLjAuMC4wLjAuMA";
break;
}
default : {
$sitename = "join.crazybeauties.com";
$siteshort = "cb";
$defaultnats = "MC4wLjEuMS4wLjAuMC4wLjA";
break;
}
}
$request = "/".$_REQUEST['passedall'];
if ($inTesting) echo "".$request."
";
$parts = explode("/", $request);
if ($inTesting) {
echo "tour:".$parts[0]."
";
echo "prog=aff:".$parts[1]."
";
echo "page:".$parts[2]."
";
}
// assign the tour
$tour = $parts[0];
//break apart the program and reseller username
$more_parts = explode("=", $parts[1]);
$programname = ($more_parts[0])?$more_parts[0]:'NoProg';
$username = ($more_parts[1])?$more_parts[1]:'NoAdvert';
if(strtolower($username) == 'noadvert') $username = 'NoAdvert'; // this is the default username
if ($inTesting) {
echo "programname=$programname
";
echo "username=$username
";
}
$joincheck = 0;
if($parts[2]){
$jointest = $parts[2];
if(strpos($jointest, "join") !== FALSE)
$joincheck = 1;
}
if ($inTesting) echo "joincheck = $joincheck
";
/*
map the program name to nats
-- Currently in their NATS:
50% Revshare revshare
**60% Revshare** rev60
ExtremeMovieCash Webmaster Referral 10% (Disabled) rev50percent
Webmaster Referral Program (10%) wrp
-- They might be sending:
mysql> select distinct(prg_code) from stats_signup_detail;
+----------+
| prg_code |
+----------+
| REVS |
| NoProg |
+----------+
2 rows in set (0.11 sec)
-- Client explained that for the following affiliates, the traffic should also be to the 60% Revshare (NATS id: 2, short: rev60)
-- crakmedia
-- ffmihai
-- pornhub
-- yooprndotcom
*/
switch(strtolower($programname)){
case 'revs': {
if(
strtolower($username) == 'crakmedia' ||
strtolower($username) == 'ffmihai' ||
strtolower($username) == 'pornhub' ||
strtolower($username) == 'yooprndotcom'
) $programshort = "rev60";
else $programshort = "revshare";
break;
}
//case 'referral':
//case 'referral_rs':
// $programshort = "webmastersref";
default:
$programshort = "NoProg";
break;
}
// If no program, set the default NATS code, and not any user / prog / etc
if($programshort == 'NoProg'){
$unencoded = "/track/".$defaultnats."/";
} else {
// Make the un-encoded string
$unencoded = "/track/".$username.":".$programshort.":".$siteshort."/";
}
// Set / Send the redirect
$link = "http://" . $sitename . $unencoded;
if ($inTesting) {
echo "
";print_r($parts);echo "
";print_r($more_parts);echo "