Quote:
Originally Posted by modulles
Hello sarettah ! Could you still explain the redirection of the "miracle folder" - webcams? This, of course, if you want to help me or maybe others who did not understand the same as me how you proceeded step by step! Thank you on behalf of all those who want to know how you did it!
|
It's a secret?
j/k. I use a php program in there to do a redirect to the actual cam page. That allows me to capture the hit in a database and also make decisions regarding the hit.
In that folder I have an htaccess fiole that redirects everything to the /webcams/index.php file. That file is the program that decides where to redirect to.
RewriteEngine On
RewriteRule ^(.*)$ index.php
For example, this is from the script I have in the webcams folder on milffoxes.
<?php
// hookitup is a function in my functions library that creates the database connection
$db=hookitup();
$tag="";
$redir="";
// pull in the requested address
$work=$_SERVER['REQUEST_URI'];
// split address at / to get at tag
if(substr_count($work,"/")>0)
{
$tag=strtolower(substr($work,strrpos($work,"/")+1));
$tag=trim(str_replace(".htm","",str_replace(".php" ,"",strtolower($tag))));
}
// if tag is webmaster signup redirect to webmaster sign up page
if($tag=='webmaster_signup')
{
$redir="https://chaturbate.com/in/?track=xxxxxx&tour=xxxxx&campaign=xxxxxx";
header('Location: ' . $redir);
exit;
}
// if tag is webcam model signup redirect to webcam model sign up page
if($tag=='webcam_model_signup')
{
$redir="https://chaturbate.com/in/?track=xxxxxx&tour=xxxxx&campaign=xxxxx";
header('Location: ' . $redir);
exit;
}
// do cookie read/set here.
$cookiename='unq';
if(!isset($_COOKIE['unq']))
{
$isuniq=1;
}
setcookie('unq',1,time()+2592000,'/');
if(isset($_COOKIE['camviews']))
{
$camviews=intval($_COOKIE['camviews']);
}
$camviews++;
setcookie('camviews',$camviews,time()+2592000,'/');
// 11012014 - do not count googlebot as unique
$gbot=0;
if(substr_count(strtolower($_SERVER['HTTP_USER_AGENT']),'googlebot')>0)
{
$isuniq=0;
$gbot=1;
}
$redir="https://milffoxes.com";
if(!empty($tag))
{
$redir="https://chaturbate.com/in/?tour=xxxxx&campaign=xxxxx&track=xxxxx&disable_sou nd=1&room=" . $tag;
}
if(!empty($tag))
{
$sql_str="insert into mf_hitcount(date, count, uniq, gbot) ";
$sql_str .="values('" . date("Y-m-d", time()-7200) . "', 1," . $isuniq . "," . $gbot .") ";
$sql_str .="on duplicate key update count=count+1, uniq=uniq+" . $isuniq . ", gbot=gbot+" . $gbot;
$db->query($sql_str);
}
header('Location: ' . $redir);
?>