cvs: php-master-web /manage challenge-response.php
| From: | Wez Furlong | Date: | Fri, 20 Aug 2004 20:12:52 +0000 |
| Subject: | cvs: php-master-web /manage challenge-response.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-25898@lists.php.net to get a copy of this message | ||
wez Fri Aug 20 16:12:52 2004 EDT
Modified files:
/php-master-web/manage challenge-response.php
Log:
Sort addresses by domain.
Show count of quarantined mail
http://cvs.php.net/diff.php/php-master-web/manage/challenge-response.php?r1=1.1&r2=1.2&ty=u
Index: php-master-web/manage/challenge-response.php
diff -u php-master-web/manage/challenge-response.php:1.1
php-master-web/manage/challenge-response.php:1.2
--- php-master-web/manage/challenge-response.php:1.1 Fri Aug 20 15:51:48 2004
+++ php-master-web/manage/challenge-response.php Fri Aug 20 16:12:52 2004
@@ -1,4 +1,4 @@
-<?php # $Id: challenge-response.php,v 1.1 2004/08/20 19:51:48 wez Exp $
+<?php # $Id: challenge-response.php,v 1.2 2004/08/20 20:12:52 wez Exp $
/* Show the list of people caught up in the CR system
* for the current user. */
@@ -20,7 +20,26 @@
}
}
-$res = db_query("select distinct sender from phpmasterdb.users left join accounts.quarantine
on users.email = rcpt where username='$user' order by sender");
+$res = db_query("select distinct sender from phpmasterdb.users left join accounts.quarantine
on users.email = rcpt where username='$user'");
+
+$inmates = array();
+while ($row = mysql_fetch_array($res)) {
+ $inmates[] = $row[0];
+}
+
+function sort_by_domain($a, $b)
+{
+ list($al, $ad) = explode('@', $a, 2);
+ list($bl, $bd) = explode('@', $b, 2);
+
+ $x = strcmp($ad, $bd);
+ if ($x)
+ return $x;
+
+ return strcmp($al, $bl);
+}
+
+usort($inmates, 'sort_by_domain');
?>
@@ -32,14 +51,17 @@
<tr>
<td> </td>
<td>Sender</td>
+ <td>Domain</td>
</tr>
<?php
-while ($row = mysql_fetch_array($res)) {
+foreach ($inmates as $prisoner) {
+ list($localpart, $domain) = explode('@', $prisoner, 2);
?>
<tr>
- <td><input type="checkbox" name="confirm[]" value="<?=
htmlentities($row[0]) ?>"/></td>
- <td><?= htmlentities($row[0]) ?></td>
+ <td><input type="checkbox" name="confirm[]" value="<?=
htmlentities($prisoner) ?>"/></td>
+ <td align="right"><?= htmlentities($localpart) ?></td>
+ <td align="left">@<?= htmlentities($domain) ?></td>
</tr>
<?php
}
@@ -56,5 +78,10 @@
</form>
<?php
+$res = db_query("select count(id) from phpmasterdb.users left join accounts.quarantine on
users.email = rcpt where username='$user'");
+$n = @mysql_result($res, 0);
+
+echo "You have <b>$n</b> messages in quarantine<br>";
+
foot();
?>