session_start();
include('save.php');
include("../config.inc.php");
if($save==0){ include('error.inc.php'); }else{
if(($step==1) && ($id)){
include('../db.php');
$mailtext="
Dies ist eine Werbeemail, aber kein Spam,
Klicken Sie hier, um Ihren Verdienst abzuholen!";
?>
Mails werden verschickt - Bitte warten<br>
Bei Server-Aufall und Fehlern bitte F5 drücken
<?PHP
$mail=mysql_fetch_array(mysql_query("SELECT * FROM `buchungen` WHERE `status`='1' AND `id`='$id'"));
mysql_query ('UPDATE interessen, user SET mailnow =1 WHERE user.away =1 AND interessen.username = user.username');
//echo "1 Abfrage startet<hr>";
If($mail[interesse]==0){
$query = "SELECT * FROM interessen WHERE mailnow='0' ORDER by RAND() LIMIT $mail[anzahl]";
$result = mysql_query($query);
}else{
$int="i".($mail[interesse]+1);
$query = "SELECT * FROM interessen WHERE mailnow='0' AND `$int`=1 ORDER by RAND() LIMIT $mail[anzahl]";
$result = mysql_query($query) or die(mysql_error());
}
$num = mysql_num_rows($result);
echo "<hr>$num";
for ($i = 0; $i < $num; $i++){
$row = mysql_fetch_array($result);
$SQL="SELECT * FROM user WHERE username='".$row["username"]."';";
$SQL2="UPDATE user SET `empfangen`=`empfangen`+1 WHERE username='".$row["username"]."';";
mysql_query($SQL2);
echo mysql_error();
$email=mysql_fetch_array(mysql_query($SQL));
$SQL="INSERT INTO mail_$id (id, username, zeit, url, minusmail) VALUES ('$id', '$email[username]', '$mail[zeit]', '$mail[url]','$mail[minusmail]');";
mysql_query($SQL);
$datum=time();
"<br><hr>m";
$SQL="INSERT INTO history (id, username, zeit,datum, url, head) VALUES ('$id', '".$email["username"]."', '$mail[zeit]','$datum', '$mail[url]', '$mail[head]');";
mysql_query($SQL);
// echo mysql_error();
$text="$mail[text]
$mailtext
http://www.Geldteufel.com/Actros/mails.php?username=$email[username]&id=$id";
mail("$email[email]", "$mail[head] (Paidmail)", "$text","From: $dienstemail\r\n");
flush();
mysql_query("UPDATE user SET mailnow='1' WHERE username='$email[username]'");
mysql_query("UPDATE buchungen SET versendet=versendet+'1' WHERE id='$id'");
}
mysql_query("UPDATE interessen SET mailnow='0'");
$mail=mysql_fetch_array(mysql_query("SELECT * FROM buchungen WHERE status='1' AND id='$id'"));
echo "alle Mails verschickt";
}
}