<?
$url='http://www.klammlose-powerads.de';
$var='klammlose-powerads';


$sponsordaten = "";
$interfacedaten = $db->query("SELECT * FROM equinox_".$pageconfig['install_nr']."_interface WHERE interface = '".$var."_ft' AND werbeart = 'forcedtextlinks'");
$interfacedaten = mysql_fetch_array($interfacedaten);

$db->query("UPDATE equinox_".$pageconfig['install_nr']."_kampagnen SET status = '0' WHERE format = 'forcedtextlinks' AND bemerkung LIKE '".$var."_%'");

$fb=@fopen("".$url."/crons/if.php?uid=".$interfacedaten['betreiber']."&pw=".$interfacedaten['pass']."&sid=".$interfacedaten['seite']."&verg=".$interfacedaten['mindestverguetung']."&reload=240&rest=".$interfacedaten['restklicks']."&ma=".$interfacedaten['aufendhalt']."&art=3","r");
if($fb) {
 while($line=fgets($fb,1000)) {
  $sponsordaten.=$line;
 }
 fclose($fb);
}
if (!$fb) die();

$code = explode("|", $sponsordaten);
$tl_count = (count($code)/8)-1;
$bid_lesen = 0;

for ($tl_anz=0;$tl_anz <= $tl_count;$tl_anz++) {
 $int_ziel		= $code[$bid_lesen+6];
 $int_name		= $code[$bid_lesen+5];
 $int_menge		= $code[$bid_lesen+3];
 $int_kid		= $code[$bid_lesen];
 $int_reload		= $code[$bid_lesen+2];
 $int_verdienst		= ($code[$bid_lesen+4]*$interfacedaten['umrechnung']) - (($code[$bid_lesen+4]*$interfacedaten['umrechnung']) / 100 * $interfacedaten['eigenverdienst']);
 $int_ma		= $code[$bid_lesen+7]+5;
 $ext_verguetung	= $code[$bid_lesen+4];
 $bid_lesen		= $bid_lesen+8;

 $int_name 		= preg_replace('/[^a-zA-Z0-9_.-:;,!?§%&()=#+*]/', ' ', $int_name);
 $int_name 		= stripslashes($int_name);
 $int_name 		= mysql_real_escape_string($int_name);
 $int_name 		= ltrim($int_name);
 $int_name 		= rtrim($int_name);

 if ($ext_verguetung >= $interfacedaten['mindestverguetung'] and $int_menge >= $interfacedaten['restklicks']) {
  $forcedbanner_check = $db->query("SELECT status FROM equinox_".$pageconfig['install_nr']."_kampagnen WHERE format = 'forcedtextlinks' AND bemerkung = '".$var."_".$int_kid."'");
  if (!mysql_num_rows($forcedbanner_check)) {
   $db->query("INSERT INTO equinox_".$pageconfig['install_nr']."_kampagnen (userid,format,do_views,do_clicks,in_views,in_clicks,reload,url_ziel,text_link,name,bemerkung,payout,aufendhalt,status) VALUES ('0','forcedtextlinks','0','0','0','".$int_menge."','".$int_reload."','".$int_ziel."','".$int_name."','Ext. Kampagnen ".$var."','".$var."_".$int_kid."','".$int_verdienst."','".$int_ma."','1')");
  }
  else {
   $db->query("UPDATE equinox_".$pageconfig['install_nr']."_kampagnen SET aufendhalt = '".$int_ma."', reload = '".$int_reload."', do_views = '0', do_clicks = '0', in_views = '0', in_clicks = '".$int_menge."', payout = '".$int_verdienst."', status = '1' WHERE format = 'forcedtextlinks' AND bemerkung = '".$var."_".$int_kid."'");
  }
 }
}

if ($interfacedaten['loeschen'] == 1) {
 $db->query("DELETE FROM equinox_".$pageconfig['install_nr']."_kampagnen WHERE format = 'forcedtextlinks' AND bemerkung LIKE '".$var."_%' AND status = '0'");
}

?>