ee68ddc1 |
1 | #!/usr/bin/php5 -q |
0337d704 |
2 | <?php |
3 | require('./connect.db.inc.php'); |
4 | $MESSAGE = ''; |
5 | |
6 | // --------------------------------------- |
7 | |
08cce2ff |
8 | $res = XDB::iterRow( |
0337d704 |
9 | "SELECT a.alias, u.promo, email |
10 | FROM auth_user_md5 AS u |
11 | LEFT JOIN aliases AS a ON( u.user_id=a.id AND a.type='a_vie' ) |
12 | LEFT JOIN emails AS e ON( e.uid = u.user_id AND NOT FIND_IN_SET('filter',e.flags) ) |
13 | WHERE u.date_ins > {?} |
14 | GROUP BY alias |
15 | ORDER BY promo", date("Ymd000000", strtotime ("last Monday"))); |
16 | if ($a = $res->total()) { |
17 | $MESSAGE.="$a INSCRIPTIONS CONFIRMEES:\n"; |
18 | while (list($usern,$promo,$mail) = $res->next()) { |
19 | $MESSAGE.="X$promo, $usern, $mail\n"; |
20 | } |
21 | } |
22 | |
23 | // --------------------------------------- |
24 | |
08cce2ff |
25 | $res = XDB::iterRow( |
2e3d2005 |
26 | "SELECT forlife, email, date |
0337d704 |
27 | FROM register_pending |
28 | WHERE hash != 'INSCRIT' |
29 | ORDER BY date"); |
30 | if ($b = $res->total()) { |
31 | $MESSAGE.="\n$b INSCRIPTIONS NON CONFIRMEES:\n"; |
2e3d2005 |
32 | while (list($usern, $mail, $quand) = $res->next()) { |
33 | $MESSAGE.="$quand, $usern,\n $mail\n"; |
0337d704 |
34 | } |
35 | } |
36 | |
37 | // --------------------------------------- |
38 | |
08cce2ff |
39 | $res = XDB::query('SELECT COUNT(DISTINCT uid), COUNT(*) FROM register_marketing'); |
0337d704 |
40 | list($a, $b) = $res->fetchOneRow(); |
41 | $MESSAGE .= "\n$c INSCRIPTIONS SOLICITÉES :\n"; |
42 | $MESSAGE .= " $a utilisateurs\n $b adresses mails\n"; |
43 | |
44 | // --------------------------------------- |
45 | |
46 | $MESSAGE .= "\n\n"; |
47 | |
48 | require_once('diogenes/diogenes.hermes.inc.php'); |
49 | $mailer = new HermesMailer(); |
50 | $mailer->setSubject("$a confirmées, $b en attente et $c sollicitées"); |
51 | $mailer->setFrom('register@polytechnique.org'); |
52 | $mailer->addTo('register@polytechnique.org'); |
53 | $mailer->addCc('jean-michel.yolin+register@polytechnique.org'); |
54 | $mailer->setTxtBody($MESSAGE); |
55 | $mailer->send(); |
56 | ?> |