summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2014-04-09 02:26:19 +0200
committerMichael Tänzer <neo@nhng.de>2014-04-09 02:26:19 +0200
commit165628b7c3ce2558943ec5bc0b0a06dc9873e895 (patch)
tree4b8ead4d6fe30a72989fdfcce5e03cfb18e7043a /scripts
parent0331f388f67262e365b7d579cd0d186c7d355ea5 (diff)
downloadcacert-devel-165628b7c3ce2558943ec5bc0b0a06dc9873e895.tar.gz
cacert-devel-165628b7c3ce2558943ec5bc0b0a06dc9873e895.tar.xz
cacert-devel-165628b7c3ce2558943ec5bc0b0a06dc9873e895.zip
bug 1265: Proper SQL query
Signed-off-by: Michael Tänzer <neo@nhng.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/send_heartbleed.php43
1 files changed, 42 insertions, 1 deletions
diff --git a/scripts/send_heartbleed.php b/scripts/send_heartbleed.php
index 1898b56..a30bf14 100644
--- a/scripts/send_heartbleed.php
+++ b/scripts/send_heartbleed.php
@@ -51,7 +51,48 @@ echo "ID now: $lastid\n";
$count = 0;
-$query = "select `id`,`fname`,`lname`,`email`,`language` from `users` where `deleted` = 0 and `id` > '$lastid' order by `id`";
+$query = "
+ (
+ select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language`
+ from `users` as u, `alerts` as a
+ where u.`deleted` = 0 and u.`id` > '$lastid'
+ and a.`memid` = u.`id`
+ and a.`general` = 1
+ )
+ union distinct
+ (
+ select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language`
+ from `users` as u, `domains` as d, `domaincerts` as dc
+ where u.`deleted` = 0 and u.`id` > '$lastid'
+ and dc.`domid` = d.`id` and d.`memid` = u.`id`
+ and dc.`expire` >= '2011-12-01'
+ )
+ union distinct
+ (
+ select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language`
+ from `users` as u, `domains` as d, `domlink` as dl, `domaincerts` as dc
+ where u.`deleted` = 0 and u.`id` > '$lastid'
+ and dc.`id` = dl.`certid` and dl.`domid` = d.`id` and d.`memid` = u.`id`
+ and dc.`expire` >= '2011-12-01'
+ )
+ union distinct
+ (
+ select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language`
+ from `users` as u, `org` as o, `orgdomaincerts` as dc
+ where u.`deleted` = 0 and u.`id` > '$lastid'
+ and dc.`orgid` = o.`orgid` and o.`memid` = u.`id`
+ and dc.`expire` >= '2011-12-01'
+ )
+ union distinct
+ (
+ select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language`
+ from `users` as u, `org` as o, `orgdomains` as d, `orgdomlink` as dl, `orgdomaincerts` as dc
+ where u.`deleted` = 0 and u.`id` > '$lastid'
+ and dc.`id` = dl.`orgcertid` and dl.`orgdomid` = d.`id`
+ and d.`orgid` = o.`orgid` and o.`memid` = u.`id`
+ and dc.`expire` >= '2011-12-01'
+ )
+ order by `id`";
$res = mysql_query($query);