email-processing.php
7.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<? // Ïîäêëþ÷åíèå
include_once($_SERVER['DOCUMENT_ROOT']."/account/mods/autorizator_admin.php");
// ==============================
// ======== Îáðàáîòêà ===========
// ==============================
// ===============
// ==== start ====
// ===============
if (isset($_GET['action']) && $_GET['action']=='start') {
$sql = "SELECT * FROM zlo_mail WHERE id='".$_GET['mail']."' ";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_affected_rows()!=0) {
$mail=mysql_fetch_assoc($result);
if($mail['status']==1) {
$sql2 ="SELECT u.email, u.pass, u.username, m.*
FROM zlo_mail_activity AS m, zlo_users AS u
WHERE m.mail_id =".$_GET['mail']." AND m.`status`=1
AND m.user_id = u.id
LIMIT ".$mail['limit']." ";
$result2 = mysql_query($sql2) or die(mysql_error());
if (mysql_affected_rows()!=0) {$i=-1;
while ($user=mysql_fetch_assoc($result2)){ $i++;
if ($i < $mail['limit'])
{
/*
Åñëè Âû íå æåëàåòå ïîëó÷àòü ðàññûëêó, Âû ìîæåòå îòïèñàòñÿ ïåðåéäÿ â <a href='http://extremstyle.ua/'>ëè÷íûé êàáèíåò</a> èñïîëüçóéÿ ñëåäóþùèå äàííûå:
<br/>
<br/>
<blockquote>
<blockquote>
ËÎÃÈÍ: ".$user['email']." <br/>
ÏÀÐÎËÜ: ".$user['pass']."
</blockquote>
</blockquote>
<br/>
<br/>
$email.="";
*/
$email = $mail['text'];
sendMail ($user['email'], $user['username'], $mail['email'], $mail['username'], $mail['subject'], $email);
// Ìåíÿåì ñòàòóñ
$sql3="UPDATE zlo_mail_activity SET `status`=2 WHERE mail_id='".$_GET['mail']."' AND user_id='".$user['user_id']."' ";
$result3 = mysql_query($sql3) or die(mysql_error());
}
}
} else {
// Ìåíÿåì ñòàòóñ
$sql3="UPDATE zlo_mail SET `status`=2 WHERE id='".$_GET['mail']."' ";
$result3 = mysql_query($sql3) or die(mysql_error());
// Ðàññûëêà çàâåðøåíà
echo"<html>
<body>
Ðàññûëêà çàâåðøåíà
</body>
</html>";
break; die;
}
// ===============================================
// ========= Îòîîáðàæåíèå ïðîãðåññ áàðà ==========
// ===============================================
$sql4 = "SELECT count(id) as `total` FROM zlo_mail_activity WHERE mail_id='".$_GET['mail']."'";
$result4 = mysql_query($sql4) or die(mysql_error());
if (mysql_affected_rows()!=0) {
$total=mysql_fetch_assoc($result4);
}
$sql4 = "SELECT count(id) as `done` FROM zlo_mail_activity WHERE mail_id='".$_GET['mail']."' AND `status`=2";
$result4 = mysql_query($sql4) or die(mysql_error());
if (mysql_affected_rows()!=0) {
$done=mysql_fetch_assoc($result4);
}
// Ïîäñ÷åò â ìèíóòàõ
$minuts=round((($total['total']-$done['done'])*$mail['interval']/60)/$mail['limit'],2);
// Ïîäñ÷åò â ïðîöåíòàõ
$percent=$done['done']/$total['total']*100 ;
$percent=round($percent,2);
// Äëÿ äèáèëîèäí³õ ñåðâàêîâ
$percent=str_replace(",",".",$percent);
// ===============================================
// ==== Çàïóñàåì ñíîâà =====
echo'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo"<meta HTTP-EQUIV='refresh' content='".$mail['interval']."'; >
<link rel='stylesheet' href='/css/account.css' type='text/css'/>
<body>";
// Âèâîäèì ðåçóëüòàòè
echo"<div class='voite-result'>
<h1>Îòïðàâêà ðàññûëêè ... </h1>
<div class='title'>".$mail['subject']."</div>
<div class='text'> Îòïðàâëÿåòüñÿ ïî ".$mail['limit']." ïèñåì ñ èíòåðâàëîì ".$mail['interval']." ñåêóíä èëè ".round($mail['interval']/60,2)." ìèíóò</div>
<div class='date'> Ñòðîê äåéñòâèÿ ".$mail['date_start']." - ".$mail['date_end']."</div>
<div class='results'>";
echo"<table class='voite-report'>";
echo"<tr class='row'>
<td class='title'>".$done['done']."/".$total['total']." -
<td class='percent'>".$percent."%</td>
<td class='col'>
<div class='line' style='width:".$percent."%;'>
<div class='result'> (".$done['done'].")</div>
</div>
</td>
</tr>";
echo"</table>";
echo"<div class='clear'></div>";
echo"<div class='total'>Îñòàëîñü $minuts ìèíóò</div></div>";
echo"</div><!-- [voite-result] -->";
echo"</body>
</html>";
} else if ($mail['status']==0) { echo "<script language=\"JavaScript\">alert('Ðàññûëêà íåàòèâíà');</script>"; echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/email/\"; self.focus(); } </script>";
} else if ($mail['status']==2) { echo "<script language=\"JavaScript\">alert('Ðàññûëêà çàâåðøåíà');</script>"; echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/email/\"; self.focus(); } </script>"; }
} else {
echo "<script language=\"JavaScript\">alert('Ðàññûëêà íå ñóùåñòâóåò');</script>";
echo "<script language=\"JavaScript\">{ location.href=\"/admin.php/email/\"; self.focus(); } </script>";
}
}
?>