<?
// (c) 2011 RapidComp, Andreas Schmidt & Michael Niendorf GbR
// Das Hosting schliesst automatisch die Akzeptanz eines RapidComp Lizenzvertrages bzw. der AGBs ein,
// der/die unter anderem als Textdokument bei RapidComp GbR erhältlich ist/sind.

 $Geschlecht=getDaten("sex");                           //CamTyp-Filter, optional
 if (!in_array($Geschlecht,array('a','m','w','p','s'))) 
    $Geschlecht='a';
 $PLZ=getDaten("PLZ");                                  //PLZ Filter, optional
 $KatID=getDaten("KatID");                              //Kategorie-ID von CamDroado, optional

 $Target=getDaten("Target");                            //Ziel zum Klick (click.php)
 $targeturl=getDaten("targeturl");                      //wenn auf 1 dann direkt zur Camprofilseite

 $Logo=getDaten("Logo");                                //Logo-Typ (pink oder weiss, sonst kein Logo anzeigen)
 $IconStyle=getDaten("IconStyle");                      //Iconstyle (weiss oder schwarz, sonst keine Icons)
 $BtnStyle=getDaten("BtnStyle");                        //Buttonstyle (grau,lila,orange,pink,rot,schwarz,tuerkis: pink)
 $TeasTopStyle=getDaten("TeasTopStyle");                //Teaserstyle oben (grau,lila,orange,pink,rot,schwarz,tuerkis: pink)
 $TeasBottomStyle=getDaten("TeasBottomStyle");          //Teaserstyle unten (grau,lila,orange,pink,rot,schwarz,tuerkis: pink)
 $TeasPFStyle=getDaten("TeasPFStyle");                  //TeaserProfillinkstyle (01, 02 oder 03: 01)
 $TeasPFCol=getDaten("TeasPFCol");                      //TeaserProfillinkfarbe (schw oder w: schw)
 $TeasPFHoverCol=getDaten("TeasPFHCol");                //TeaserProfillinkfarbe (Hover) (gruen, lila, orange, pink, rot, schwarz, tuerkis oder weiss: lila)

 $BGColor=getDaten("BGCol");                            //Hintergrundfarbe Seite
 $piccol=getDaten("piccol");                            //Rahmenfarbe Cover
 $pichovercol=getDaten("pichcol");                      //Rahmenfarbe Cover (Hover)
 $acol=getDaten("acol");                                //Textfarbe Profillink
 $ahover=getDaten("ahcol");                             //Textfarbe Profillink (Hover)
 $h1col=getDaten("h1col");                              //Textfarbe Camname
 $h2col=getDaten("h2col");                              //Textfarbe Online-Status
 
 $BorderColor=getDaten("BorderCol");                    //Rahmenfarbe Seite

 $BaseTarget=getDaten("BaseTarget");                    //Zielfenster

 $BtnHoverStyle=false; 
 $Skin=getDaten("Skin");                                 //vordefinierte Skin (1-11), optional
 switch($Skin){
     case 1:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#ff7800";
      if (empty($piccol)) $piccol="#8c018e";
      if (empty($pichovercol)) $pichovercol="#ff7800";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#ff7800";
      if (empty($BtnStyle)) $BtnStyle="lila";
      if (empty($TeasTopStyle)) $TeasTopStyle="lila";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="orange";
      break;
     case 2:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#80b133";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#00baeb";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#ff7800";
      if (empty($BtnStyle)) $BtnStyle="tuerkis";
      if (empty($TeasTopStyle)) $TeasTopStyle="gruen";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="orange";
      break;
     case 3:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#dc0025";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#dc0025";
      if (empty($acol)) $acol="#ffffff";
      if (empty($ahover)) $ahover="#dc0025";
      if (empty($BtnStyle)) $BtnStyle="rot";
      if (empty($TeasTopStyle)) $TeasTopStyle="schwarz";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="schwarz";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="w";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="rot";
      break;
     case 4:
      if (empty($h1col)) $h1col="#000000";
      if (empty($h2col)) $h2col="#ff7800";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#ff7800";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#ff7800";
      if (empty($BtnStyle)) $BtnStyle="orange";
      if (empty($TeasTopStyle)) $TeasTopStyle="grau";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="orange";
      break;
     case 5:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#f700b9";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#f700b9";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#f700b9";
      if (empty($BtnStyle)) $BtnStyle="schwarz";
      if (empty($TeasTopStyle)) $TeasTopStyle="pink";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="pink";
      break;
     case 6:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#dc0025";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#dc0025";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#dc0025";
      if (empty($BtnStyle)) $BtnStyle="grau";
      if (empty($TeasTopStyle)) $TeasTopStyle="rot";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="rot";
      break;
     case 7:
      if (empty($h1col)) $h1col="#000000";
      if (empty($h2col)) $h2col="#ff7800";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#ff7800";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#0092ba";
      if (empty($BtnStyle)){
       $BtnStyle="tuerkis";
       $BtnHoverStyle="orange";
      }
      if (empty($TeasTopStyle)) $TeasTopStyle="orange";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="tuerkis";
      break;
     case 8:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#80b133";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#80b133";
      if (empty($acol)) $acol="#000000";
      if (empty($ahover)) $ahover="#80b133";
      if (empty($BtnStyle)){
       $BtnStyle="gruen";
       $BtnHoverStyle="schwarz";
      }
      if (empty($TeasTopStyle)) $TeasTopStyle="schwarz";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="grau";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="schw";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="gruen";
      break;
     case 9:
      if (empty($h1col)) $h1col="#00baeb";
      if (empty($h2col)) $h2col="#80b133";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#00baeb";
      if (empty($acol)) $acol="#ffffff";
      if (empty($ahover)) $ahover="#00baeb";
      if (empty($BtnStyle)) $BtnStyle="tuerkis";
      if (empty($TeasTopStyle)) $TeasTopStyle="schwarz";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="schwarz";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="w";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="tuerkis";
      break;
     case 10:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#ffffff";
      if (empty($piccol)) $piccol="#000000";
      if (empty($pichovercol)) $pichovercol="#ffffff";
      if (empty($acol)) $acol="#ffffff";
      if (empty($ahover)) $ahover="#dc0025";
      if (empty($BtnStyle)){
       $BtnStyle="rot";
       $BtnHoverStyle="orange";
      }
      if (empty($TeasTopStyle)) $TeasTopStyle="rot";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="orange";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="w";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="rot";
      break;
     case 11:
      if (empty($h1col)) $h1col="#ffffff";
      if (empty($h2col)) $h2col="#ff7800";
      if (empty($piccol)) $piccol="#ff7800";
      if (empty($pichovercol)) $pichovercol="#000000";
      if (empty($acol)) $acol="#ffffff";
      if (empty($ahover)) $ahover="#ff7800";
      if (empty($BtnStyle)) $BtnStyle="orange";
      if (empty($TeasTopStyle)) $TeasTopStyle="schwarz";
      if (empty($TeasBottomStyle)) $TeasBottomStyle="schwarz";
      if (empty($TeasPFStyle)) $TeasPFStyle="02";
      if (empty($TeasPFCol)) $TeasPFCol="w";
      if (empty($TeasPFHoverCol)) $TeasPFHoverCol="orange";
      break;
 }
 
 
 if ($Logo!="pink" && $Logo!="weiss") $Logo="pink";
 if ($BtnStyle!="grau" && $BtnStyle!="gruen" && $BtnStyle!="lila" && $BtnStyle!="orange" && $BtnStyle!="pink" && $BtnStyle!="rot" && $BtnStyle!="schwarz" && $BtnStyle!="tuerkis") $BtnStyle="pink";
 if ($IconStyle!="schwarz" && $IconStyle!="weiss") $IconStyle="schwarz";
 if ($TeasTopStyle!="grau" && $TeasTopStyle!="lila" && $TeasTopStyle!="gruen" && $TeasTopStyle!="orange" && $TeasTopStyle!="pink" && $TeasTopStyle!="rot" && $TeasTopStyle!="schwarz" && $TeasTopStyle!="tuerkis") $TeasTopStyle="pink";
 if ($TeasBottomStyle!="grau" && $TeasBottomStyle!="lila" && $TeasBottomStyle!="orange" && $TeasBottomStyle!="pink" && $TeasBottomStyle!="rot" && $TeasBottomStyle!="schwarz" && $TeasBottomStyle!="tuerkis") $TeasBottomStyle="grau";
 if ($TeasPFCol!="schw" && $TeasPFCol!="w") $TeasPFCol="schw";
 if ($TeasPFHoverCol!="gruen" && $TeasPFHoverCol!="lila" && $TeasPFHoverCol!="orange" && $TeasPFHoverCol!="pink" && $TeasPFHoverCol!="rot" && $TeasPFHoverCol!="schwarz" && $TeasPFHoverCol!="tuerkis" && $TeasPFHoverCol!="weiss") $TeasPFHoverCol="lila";
 
 if ($TeasPFStyle!="01" && $TeasPFStyle!="02" && $TeasPFStyle!="03") $TeasPFStyle="01";

 if (!preg_match("/^#[0-9A-F]{6}$/i",$BGColor)) $BGColor="#FFFFFF";
 if (!preg_match("/^#[0-9A-F]{6}$/i",$piccol)) $piccol="#F700B9";
 if (!preg_match("/^#[0-9A-F]{6}$/i",$pichovercol)) $pichovercol="#F700B9";
 if (!preg_match("/^#[0-9A-F]{6}$/i",$acol)) $acol="#000000";
 if (!preg_match("/^#[0-9A-F]{6}$/i",$ahover)) $ahover="#F700B9";
 if (!preg_match("/^#[0-9A-F]{6}$/i",$h1col)) $h1col="#FFFFFF";
 if (!preg_match("/^#[0-9A-F]{6}$/i",$h2col)) $h2col="#80b133";

 if (!preg_match("/^#[0-9A-F]{6}$/i",$BorderColor)) $BorderColor="#000000";
 
 if (!preg_match("/^[_0-9A-Z]+$/i",$BaseTarget)) $BaseTarget="_top";
 
 $KatLinks=array(
 1=>'kategorie-Frauen-1',
 2=>'kategorie-Lesben-2',
 3=>'kategorie-reife+Frauen-3',
 4=>'kategorie-Fetish+++SM-4',
 5=>'kategorie-Paare-5',
 7=>'kategorie-Gay-7',
 8=>'kategorie-TS+++TV-8' 
 );

 $SourceFile=$Geschlecht.".ab16";
 if ($KatID>0){
  $SourceFile=$Geschlecht.".ab16.$KatID";   
 }elseif ($PLZ===false){
/*  $Region=0;   
  $GeoRegionen=array(
    01=>array("Baden-Württemberg",'karte_baden_wuerttemb.gif'),
    02=>array("Bayern",'karte_bayern.gif'),
    03=>array("Bremen",'karte_bremen.gif'),
    04=>array("Hamburg",'karte_hamburg.gif'),
    05=>array("Hessen",'karte_hessen.gif'),
    06=>array("Niedersachsen",'karte_niedersachsen.gif'),
    07=>array("Nordrhein-Westfalen",'karte_nordrhein_westf.gif'),
    08=>array("Rheinland-Pfalz",'karte_rheinland_pfalz.gif'),
    09=>array("Saarland",'karte_saarland.gif'),
    10=>array("Schleswig-Holstein",'karte_schleswig_holstein.gif'),
    11=>array("Brandenburg",'karte_brandenburg.gif'),
    12=>array("Mecklenburg-Vorpommern",'karte_meck_vorpomm.gif'),
    13=>array("Sachsen",'karte_sachsen.gif'),
    14=>array("Sachsen-Anhalt",'karte_sachsen_anhalt.gif'),
    15=>array("Thuringen",'karte_thueringen.gif'),
    16=>array("Berlin",'karte_berlin.gif')
  );                                                                                       
  if (($GeoDaten=geoip_record_by_name($_SERVER['REMOTE_ADDR'])) && $GeoDaten['country_code']=="DE" && array_key_exists((int)$GeoDaten['region'],$GeoRegionen)){
   $Region=(int)$GeoDaten['region'];    
   $SourceFile=$Geschlecht."_region$Region.ab16";
  }*/
 }elseif (strcasecmp($PLZ,'alle')) $SourceFile=$Geschlecht."_plz".((int)$PLZ).".ab16";
 
 if (!file_exists("$relPath/WBMExportData/$SourceFile.php")) $SourceFile="a.ab16";
 
 $Cams=array();
 @include("$relPath/WBMExportData/stars_$SourceFile.php");
 $StarCams=$Cams;
 
 $Cams=array();
 @include("$relPath/WBMExportData/$SourceFile.php");

 $MaxElems=2;
 
 $StdLinkParams=" href=\"".htmlentities($Target)."\" target=\"".htmlentities($BaseTarget)."\"";
     
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>CamDorado</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
BODY {
    margin:0px;
    padding:0px;
    background-color: <? Print $BGColor;?>;    
}

.MainFrame {
    border: 1px solid <? Print $BorderColor;?>;
    width:298px;    
    height:248px;    
    text-align:center;
    overflow:auto;
}


.header{
    padding-top:4px;
    width:256px;
    height:68px;
    margin:auto;
    background-repeat:repeat-x;
    background-position: bottom;
    background-image: url('./images/teas_300_hr.gif');
}
.teaserList{
    width:262px;
    margin:auto;
}
.teas_head{
    background-repeat: no-repeat;
    background-position: top;
}

.teas_bottom{
    background-repeat: no-repeat;
    background-position: bottom;
    margin-bottom: 1px;
    padding: 1px 0px 1px 0px;
}

.clear{
    clear: both;
}             


/*------------125er------------*/

.divteaser h1{
    font-family: Tahoma;
    font-weight: normal;
    font-size: 12px;
    color: <? Print $h1col;?>;
    padding: 2px 0px 0px 2px;
    margin: 0px 0px 0px 0px;
}

.divteaser h2{
    font-family: Tahoma;
    font-weight: bold;
    font-size: 11px;
    color: <? Print $h2col;?>;
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 2px;
}

.divteaser a.bildrahmen img{
    border: 1px solid <? Print $piccol;?>;
}
.divteaser a.bildrahmen:hover img{
    border: 1px solid <? Print $pichovercol;?>;
}

.divteaser .teas_head{
    background-image: url('./images/head_125_<? Print $TeasTopStyle;?>.png');
}

.divteaser .teas_bottom{
    background-image: url('./images/bottom_125_<? Print $TeasBottomStyle;?>.png');
}

.divteaser a.pf_link{
    background-image: url('./images/pfeil_<? Print $TeasPFCol;?>_<? Print $TeasPFHoverCol;?><? Print $TeasPFStyle;?>.gif');
    background-repeat: no-repeat;
    background-position: right 3px;
    padding: 1px 11px 0px 0px;
    font-family: Tahoma;
    font-weight: normal;
    font-size: 11px;
    color: <? Print $acol;?>;
    text-decoration: none;
    margin-right: 1px;
}

.divteaser  a.pf_link:hover{
    background-position: right -20px;
    color: <? Print $ahover;?>;
}

.divteaser a.teas_button{
    background-image: url('./images/button_125_<? Print $BtnStyle;?>.png');
    background-repeat: no-repeat;
    background-position: 0px 0px;
    display: block;
    padding: 0px;
    margin: 0px;
    height: 40px;
}

.divteaser a.teas_button:hover{
<? if (!empty($BtnHoverStyle)){?>
    background-image: url('./images/button_125_<? Print $BtnHoverStyle;?>.png');
<? }else{?>
    background-position: 0px -50px;
<? }?>
}



.divteaser{
    width:125px;
    float:left;
    display:block;
    margin: 3px;
    height: auto;
}

.head_icons{
    margin-top:4px;
    padding: 2px 0px;
    width:256px;
    height:30px;
    display:block;
    text-align:center;
    background-repeat:repeat-x;
    background-position: top;
    background-image: url('./images/teas_300_hr.gif');
}

.head_logo{
    display:block;
/*    margin-bottom: 4px;*/
    float:left;
}

.head_text{
    padding: 2px 0px 2px 4px;
    display:block;
/*    margin-bottom: 4px;*/
    float:left;
}

.head_text a img {border:0px;}
.head_logo a img {border:0px;}

</style>
</head>
<body>
<div class="MainFrame">
<div class="header">
<div class="head_logo"><a<? Print $StdLinkParams;?>><img class="logo" src="./images/logo125_<? Print htmlentities($Logo);?>.png" alt="CamDorado.com by fundorado.com"></a></div>
<div class="head_text"><a<? Print $StdLinkParams;?>><img src="./images/teas_300_text_<? Print $IconStyle;?>.png" alt=""></a></div>

<div class="clear"></div>
<? if (!empty($IconStyle)){?>
<div class="head_icons"><img src="./images/teas_300_icons_<? Print $IconStyle;?>.png" alt="" border="0"></div><? }?>
</div>
<div class="teaserList">
<?

$StarCams=array_values($StarCams);
$Cams=array_values($Cams);$IndexList=array();

$StarCntNeeded=0;
if ($MaxElems>count($Cams)) $StarCntNeeded=count($Cams)-$MaxElems;
else $StarCntNeeded=floor($MaxElems/5);

if (count($Cams)>1) $StarCntNeeded++;
$StarCntNeeded=min($StarCntNeeded,count($StarCams));

$TmpCams=array();
while (count($TmpCams)<$MaxElems && count($StarCams)>0 &&  $StarCntNeeded>0){
     $RandValStars=rand(0,count($StarCams)-1);
     $TmpCams[rand(1,10000)]=$StarCams[$RandValStars];
     array_splice($StarCams,$RandValStars,1);
     $StarCntNeeded--;
}

while (count($IndexList)<min($MaxElems-count($TmpCams),count($Cams))){
    $RandVal=rand(0,count($Cams)-1);
    if (!in_array($RandVal,$IndexList)) $IndexList[]=$RandVal;
}

$TCnt=0;

foreach($IndexList AS $k) $TmpCams[rand(1,10000)]=$Cams[$k];

ksort($TmpCams);

foreach($TmpCams AS $Data)
{
 $LinkTarget=$Target;
 $CamID=$Data['ID'];
 if (!empty($targeturl)){
  if (!empty($KatID) && array_key_exists($KatID,$KatLinks))
       $LinkTarget.="&turl=".urlencode("http://www.camdorado.com/free/$KatLinks[$KatID]Cam".$CamID.".html");
  else $LinkTarget.="&turl=".urlencode("http://www.camdorado.com/free/indexCam".$CamID.".html");
 }

 $LinkParams=" href=\"".htmlentities($LinkTarget)."\" target=\"".htmlentities($BaseTarget)."\"";
?>
<div class="divteaser"><table width="125" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="teas_head"><h1><? Print htmlentities($Data['Nick']);?></h1>
    <a<? Print $LinkParams;?> class="bildrahmen"><img src="<? Print "$absPath/CamPics/".htmlentities($CamID)."_123x91px.jpg";?>" width="123" height="91" border="0" alt=""></a></td>
  </tr>
  <tr>
    <td><table width="125" border="0" cellspacing="0" cellpadding="0" class="teas_bottom">
      <tr>
        <td height="16"><h2>Online</h2></td>
        <td align="right"><a<? Print $LinkParams;?> class="pf_link">zum Profil</a></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><a<? Print $LinkParams;?> class="teas_button"></a></td>
  </tr>
</table>
</div>
<? }?>    
<div class="clear"></div>
</div></div>
</body>
</html>
