Io ho il programma sotto, ma mi da un errore. Ora vi spiego
cos’è sperando mi possiate dare una mano. Come mai se escludo il cron mi
da le giuste righe nel database (4000 righe) e invece se metto il cron viene
svolto parzialmente? Se metto tempo fisso ad esempio 30 10 * * * insomma ogni
giorno alle 10.30 tale programma ha minor numero righe? Se faccio */10 10 * * *
ne arrivano solo 917 righe? Non riesco a capire come mai non le carica tutte
4000 il tempo c’è come mai? Che influenza ha il cron sul codice?
Spero possiate aiutarmi. Il codice è sotto a tale
spiegazione.
Ciao,
Pier
<?
//**VS**//$setting[ptr]//**VE**//
include("config.php");
include("includes/functions.php");
include("includes/mysql.php");
$Db1 = new DB_sql;
$Db1->connect($DBHost, $DBDatabase, $DBUser,
$DBPassword);
include("includes/globals.php");
echo "Connected<br />";
flush();
//**S**//
function get_users($count, $country) {
global $Db1;
$sql=$Db1->query("SELECT
username, name, email FROM user WHERE suspended=0 and optin='1'
".iif($country != ""," and country='$country'")."
ORDER BY rand() LIMIT $count");
for($x=0;
$temp=$Db1->fetch_array($sql); $x++) {
$list[$x]=$temp;
}
return $list;
}
if($settings[cron_pwd] == $pwd) {
$sql=$Db1->query("DELETE FROM
click_history");
// $sql=$Db1->query("DELETE FROM
email_history");
$sql=$Db1->query("DELETE FROM
pending_emails");
$sql=$Db1->query("SELECT * FROM
emails WHERE credits>=1");
while($mail=$Db1->fetch_array($sql)) {
$mailid=$mail[id];
echo "<!-- Starting
Email Loop -->\n\n"; flush();
$emailsubject =
"$mail[title]";
$emailbody =
"".stripslashes($mail[description])."\n\n";
$users =
get_users($mail[credits], $mail[country]);
$user_index=0;
echo
ceil($mail[credits]/100);
for($x=0;
$x<$mail[credits]; $x++) {
if($user_index
< count($users)) {
echo
"<!-- Starting Email Loop 2 -->\n\n"; flush();
$list="";
echo
"<!-- Starting Email Loop 3 -->\n\n"; flush();
$list
.=
$users[$user_index][name].":".$users[$user_index][email].":".$users[$user_index][username]."\n";
$user_index++;
echo
"<!-- Creating Entry -->\n\n"; flush();
$Db1->query("INSERT
INTO pending_emails SET
mailid='".$mailid."',
subject='".addslashes($emailsubject)."',
body='".addslashes($emailbody)."',
tolist='".addslashes($list)."'
");
}
}
}
echo "<!-- All Done -->\n\n";
flush();
exit;
function sendmail($mail, $user) {
global $settings;
$subject = "$settings[site_title]
Paid Email: $mail[title]";
$body =
"".stripslashes($mail[description])."\n\n
To receive credit for this email, Please click the
following URL
$settings[base_url]/pemail.php?user=$user[username]&id=$mail[id]
\n
--------------------------------------------------------------
$settings[site_title] Paid Email
You are receiving this email because you are a member
of
$settings[domain_name] and have opted in to receiving
paid emails. If
you want to stop receiving emails, please login to
your account turn
off paid emails in your profile page.
--------------------------------------------------------------";
send_mail($user[email],$user[name],$subject,$body);
echo "<!- Finished Mailing
$user[username] !>\n\n";
flush();
}
function mailgo($mail) {
global $Db1;
}
$sql=$Db1->query("SELECT * FROM
emails WHERE credits>=1");
while($temp=$Db1->fetch_array($sql)) {
$emails[$x][0]=
$sql=$Db1->query("SELECT
username, email FROM user WHERE optin='1' and username!='$mail[username]' ORDER
BY rand() LIMIT $mail[credits]");
while($user=$Db1->fetch_array($sql))
{
echo
".";
flush();
sendmail($mail,
$user);
}
}
$Db1->sql_close();
while($temp=$Db1->fetch_array($sql)) {
$sql=$Db1->query("SELECT
username, email FROM user WHERE optin='1' and username!='$mail[username]' ORDER
BY rand() LIMIT $mail[credits]");
while($user=$Db1->fetch_array($sql))
{
echo
".";
flush();
sendmail($mail,
$user);
}
}
}
else {
echo "Invalid Access To Cron!";
}
//**E**//
?>