<?php
function site_vars(){
///////////////////Change affiliate id below to
yours and trackingid to whatever you would like to show in
stats////////////////
$affiliateid="HNwJw";
//
$trackingid="hr8m";
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////
$sitevar['affid']
=$affiliateid;
$sitevar['track']=$trackingid;
return $sitevar;
}
function
get_current_dir(){
$base=str_replace($_SERVER[DOCUMENT_ROOT], "", $_SERVER
[SCRIPT_FILENAME]);
$base2=str_replace(basename($_SERVER[PHP_SELF]), ""
,$base);
$directory=str_replace("/admin/", "", $base2);
$directory=str_replace
("/", "", $directory);
if ($directory){
$url="http://".$_SERVER
[SERVER_NAME]."/".$directory."/";
}else{
$url="http://".$_SERVER
[SERVER_NAME]."/";
}
return $url;
}
function get_cams($affiliateid, $trackingid){
$cams = new SimpleXMLElement
('http://chaturbate.com/affiliates/api/onlinerooms/?
format=xml&wm='.$affiliateid.'', null, true);
foreach($cams as $cam){
if($cam-
>gender=="f"){
//if(@GetImageSize($cam->image_url)){
$FemaleCamArr['username']
[]=$cam->username;
$cam->chat_room_url=str_replace('?track=default', "?
track=$trackingid", $cam->chat_room_url);
$FemaleCamArr['chaturl'][]=$cam-
>chat_room_url;
$FemaleCamArr['imageurl'][]=$cam->image_url;
//}
}elseif($cam-
>gender=="m"){
//if(@GetImageSize($cam->image_url)){
$MaleCamArr['username'][]
=$cam->username;
$cam->chat_room_url=str_replace('?track=default', "?
track=$trackingid", $cam->chat_room_url);
$MaleCamArr['chaturl'][]=$cam-
>chat_room_url;
$MaleCamArr['imageurl'][]=$cam->image_url;
//}
}elseif($cam-
>gender=="c"){
//if(@GetImageSize($cam->image_url)){
$CoupleCamArr['username']
[]=$cam->username;
$cam->chat_room_url=str_replace('?track=default', "?
track=$trackingid", $cam->chat_room_url);
$CoupleCamArr['chaturl'][]=$cam-
>chat_room_url;
$CoupleCamArr['imageurl'][]=$cam->image_url;
//}
}else{
//if
(@GetImageSize($cam->image_url)){
$MiscCamArr['username'][]=$cam->username;
$cam->chat_room_url=str_replace('?track=default', "?track=$trackingid", $cam-
>chat_room_url);
$MiscCamArr['chaturl'][]=$cam->chat_room_url;
$MiscCamArr
['imageurl'][]=$cam->image_url;
//}
}
}
$NewCams['Female']=$FemaleCamArr;
$NewCams
['Male']=$MaleCamArr;
$NewCams['Couple']=$CoupleCamArr;
$NewCams['Misc']
=$MiscCamArr;
return $NewCams;
}
function cams_count($carr, $gender){
if
($gender=="f"){
$Count=count($carr['Female']['username']);
}elseif
($gender=="m"){
$Count=count($carr['Male']['username']);
}elseif($gender=="c"){
$Count=count($carr['Couple']['username']);
}else{
$Count=count($carr['Misc']
['username']);
}
return $Count;
}
function Show_Cams($CamArray, $gender, $rows,
$maxnum, $rand, $showusername, $linkusername, $linkimage, $tablewidth,
$imgborder, $imgheight, $imgwidth){
if(!$rows){
$rows=5;
}
if($imagewidth && !
$imgheight){
$imgheight='';
}
if(!$imgwidth){
$imgwidth='180';
}
if($gender=="f"){
$FemaleCamCount=cams_count($CamArray, $gender="f");
$arrcount=$FemaleCamCount;
$gentype="Female";
}elseif($gender=="m"){
$MaleCamCount=cams_count($CamArray,
$gender="m");
$arrcount=$MaleCamCount;
$gentype="Male";
}elseif($gender=="c"){
$CoupleCamCount=cams_count($CamArray, $gender="c");
$arrcount=$CoupleCamCount;
$gentype="Couple";
}else{
$MiscCamCount=cams_count($CamArray, $gender="misc");
$arrcount=$MiscCamCount;
$gentype="Misc";
}
if($maxnum){
if($maxnum > $arrcount){
$maxnum=$arrcount;
}
}
if (!$maxnum){
$maxnum=$arrcount;
}
$i=0;
$returnhtml='<table
width="'.$tablewidth.'%">';
$position = 1;
while($i <= $maxnum ){
if($position ==
1){$returnhtml.= "<tr>";}
if ($rand==true){
if ($usedrand==false){
//populate
array with 0-maxnum
$var = range(0, $maxnum);
shuffle($var);
$usedrand=true;
}
$rn
= array_rand($var);
$username= $CamArray[''.$gentype.'']['username'][$rn];
$chaturl= "viewcam.php?id=$username";
$imageurl= $CamArray[''.$gentype.'']
['imageurl'][$rn];
unset($var[$rn]);
}else{
$username= $CamArray
[''.$gentype.'']['username'][$i];
$chaturl= "viewcam.php?id=$username";
$imageurl= $CamArray[''.$gentype.'']['imageurl'][$i];
}
if($showusername==true
&& $linkusername==false){
$linknamecode=$username."<br>";
}
if
($showusername==true && $linkusername==true){
$linknamecode='<a
href="'.$chaturl.'">'.$username.'</a><br>';
}
if($linkimage==true){
$linkimagecode='<a href="'.$chaturl.'">';
}else{
$linkimagecode='';
}
if
($imgborder==true){
$bordercode='border="1"';
}else{
$bordercode='';
}
if($imageurl
&& $username){
$returnhtml.='<td
align="center">'.$linknamecode.''.$linkimagecode.' <img src="'.$imageurl.'"
width="'.$imgwidth.'" height="'.$imgheight.'" '.$bordercode.'
></a></td>'.$tblinfo;
if($position == $rows){$returnhtml.= "</tr> "; $position
= 1;}else{ $position++;}
}
$i++;
$end = "";
if($position != 1){
for($z=($rows-
$position); $z>0 ; $z--){
$end .= "<td></td>";
}
$end .= "</tr>";
}
}//if
////////////end function
$returnhtml.= $end."</table> ";
return $returnhtml;
}
function show_camview($hostname){
$hostname = strip_tags($hostname);
$sitevars=site_vars();
$affiliateid=$sitevars['affid'];
$trackingid=$sitevars
['track'];
$books = new SimpleXMLElement
('http://chaturbate.com/affiliates/api/onlinerooms/?
format=xml&wm='.$affiliateid.'', null, true);
foreach($books as $book) // loop
through our books
{
$name=$book->username;
if($book->gender=="f"){
$fhosts[]
=$book->username;
}
$mostpopularhost=$fhosts[0];
if($name == $hostname){
$online="yes";
$imageurl=$book->image_url;
$imgembed='<img src="'.$book-
>image_url.'" width="1" height="1" />';
}
}
if ($online=="yes"){
$iframe="$imgembed<br><iframe src='http://chaturbate.com/affiliates/in/9oGW/
$affiliateid/?track=$trackingid&room=$hostname&bgcolor=white' height=528
width=850 style='border: none;'></iframe>";
}else{
$iframe="<b>$hostname Is Currently Offline!</b><br><br><b>You Are Now
Viewing The Most Popular Live Cam <br><br>
<iframe
src='http://chaturbate.com/affiliates/in/NxHf/$affiliateid/?
track=$trackingid&bgcolor=white' height=528 width=850 style='border:
none;'></iframe>";
}
return $iframe;
}
?>
|