This commit has been accessed 614 times via Git panel.
commit 0ccf6a40abbf0ee8a547810ac6923372b748d736
tree 80edc03a892c2512aef1de3373794f82bca73eb2
parent 26a8f184ad1fcf85a7ecf239e40313fcc6ae8470
author Engels Antonio <engels@majcms.org> 1351621972 +0800
committer Engels Antonio <engels@majcms.org> 1351621972 +0800
Add count subscribers and aliases for postmaster
diff --git a/index.php b/index.php
index 1d80217..3c0a7ae 100644
--- a/index.php
+++ b/index.php
@@ -1575,15 +1575,59 @@ echo "</tr>";
}
if ($_SESSION['logged_lvl'] == "postmaster") {
+
+ $pm_get = mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' order by id");
+
+ $pm_get_count = mysql_num_rows($pm_get);
+
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
+
+ if ($pm_get_count > 0) {
+
+ $pm_get_0 = mysql_num_rows(mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' and mode='0'"));
+ $pm_get_1 = mysql_num_rows(mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' and mode='1'"));
+
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"10\">";
+
+ if ($pm_get_count == 1) {
+
+ echo "1 subscriber account (";
+
+ if ($pm_get_0 > 0) {
+ echo "disabled";
+ }
+ else {
+ echo "enabled";
+ }
+
+ echo ")";
+ }
+ else {
+ echo "$pm_get_count subscriber accounts (";
+
+ if ($pm_get_1 > 0) {
+ echo "$pm_get_1 enabled";
+ }
+
+ if (($pm_get_1 > 0) and ($pm_get_0 > 0)) {
+ echo ", ";
+ }
+
+ if ($pm_get_0 > 0) {
+ echo "$pm_get_0 disabled";
+ }
+
+ echo ")";
+ }
+
+ echo "</td></tr>";
+ }
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
echo "<tr bgcolor=\"#eeeeee\"><td colspan=\"4\" align=\"center\">status</td><td align=\"center\">username</td><td align=\"center\">complete name</td><td align=\"center\">password</td><td align=\"center\">quota</td><td align=\"center\" colspan=\"2\">action</td></tr>";
echo "<form method=\"post\">";
- echo "<tr bgcolor=\"#ffffff\"><td align=\"center\">new</td><td align=\"center\">cur</td><td align=\"center\">aka</td><td align=\"center\">rcv</td><td><input class=\"input\" type=\"text\" name=\"pm_id\" autocomplete=\"off\" maxlength=\"255\"></td><td><input class=\"input\" type=\"text\" name=\"pm_name\" autocomplete=\"off\" maxlength=\"128\"></td><td><input class=\"input\" type=\"text\" name=\"pm_pw\" autocomplete=\"off\" maxlength=\"64\"></td><td width=\"64\"><input class=\"input\" type=\"text\" name=\"pm_quota\" autocomplete=\"off\" maxlength=\"16\" style=\"text-align: right;\"></td><td colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td align=\"center\">new</td><td align=\"center\">cur</td><td align=\"center\">aka</td><td align=\"center\">rcv</td><td><input class=\"input\" type=\"text\" name=\"pm_id\" autocomplete=\"off\" maxlength=\"255\" required autofocus></td><td><input class=\"input\" type=\"text\" name=\"pm_name\" autocomplete=\"off\" maxlength=\"128\" required></td><td><input class=\"input\" type=\"text\" name=\"pm_pw\" autocomplete=\"off\" maxlength=\"64\" required></td><td width=\"64\"><input class=\"input\" type=\"text\" name=\"pm_quota\" autocomplete=\"off\" maxlength=\"16\" style=\"text-align: right;\"></td><td colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
echo "</form>";
- $pm_get = mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' order by id");
-
while ($pm_row = mysql_fetch_array($pm_get)) {
if ($pm_row[5] == "1") {
@@ -1615,7 +1659,7 @@ echo "</tr>";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
echo "<tr bgcolor=\"#eeeeee\"><td colspan=\"2\" align=\"center\">status</td><td align=\"center\"><nobr>domain name</nobr></td><td align=\"center\"><nobr>account limit</nobr></td><td align=\"center\"><nobr>postmaster password</nobr></td><td align=\"center\" colspan=\"2\">action</td></tr>";
- echo "<form method=\"post\"><tr bgcolor=\"#ffffff\"><td align=\"center\">usr</td><td align=\"center\">rcv</td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_name\" maxlength=\"128\" autocomplete=\"off\"></td><td align=\"center\"><input class=\"input\" style=\"text-align: right;\" type=\"text\" name=\"dom_max\" maxlength=\"6\" autocomplete=\"off\" value=\"0\"></td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_pass\" maxlength=\"64\" autocomplete=\"off\"></td><td align=\"center\" colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr></form>";
+ echo "<form method=\"post\"><tr bgcolor=\"#ffffff\"><td align=\"center\">usr</td><td align=\"center\">rcv</td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_name\" maxlength=\"128\" autocomplete=\"off\" required autofocus></td><td align=\"center\"><input class=\"input\" style=\"text-align: right;\" type=\"text\" name=\"dom_max\" maxlength=\"6\" autocomplete=\"off\" value=\"0\" required></td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_pass\" maxlength=\"64\" autocomplete=\"off\" required></td><td align=\"center\" colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr></form>";
$dom_get = mysql_query("select * from domains order by id");
@@ -1646,14 +1690,58 @@ echo "</tr>";
echo "<td width=\"10\"></td><td valign=\"top\">";
+ $get_aliases = mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' order by id, alias");
+
+ $get_aliases_count = mysql_num_rows($get_aliases);
+
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
+
+ if ($get_aliases_count > 0) {
+
+ $get_aliases_0 = mysql_num_rows(mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' and mode='0'"));
+ $get_aliases_1 = mysql_num_rows(mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' and mode='1'"));
+
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"5\">";
+
+ if ($get_aliases_count == 1) {
+
+ echo "1 alias (";
+
+ if ($get_aliases_0 > 0) {
+ echo "disabled";
+ }
+ else {
+ echo "enabled";
+ }
+
+ echo ")";
+ }
+ else {
+ echo "$get_aliases_count aliases (";
+
+ if ($get_aliases_1 > 0) {
+ echo "$get_aliases_1 enabled";
+ }
+
+ if (($get_aliases_1 > 0) and ($get_aliases_0 > 0)) {
+ echo ", ";
+ }
+
+ if ($get_aliases_0 > 0) {
+ echo "$get_aliases_0 disabled";
+ }
+
+ echo ")";
+ }
+
+ echo "</td></tr>";
+ }
+
echo "<tr bgcolor=\"#eeeeee\"><td align=\"center\">alias</td><td align=\"center\">recipient</td><td align=\"center\" colspan=\"3\">action</td></tr>";
echo "<form method=\"post\">";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"text\" name=\"alias_add\" autocomplete=\"off\" maxlength=\"255\"></td><td><input class=\"input\" type=\"text\" name=\"alias_to\" autocomplete=\"off\" maxlength=\"128\"></td><td colspan=\"3\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"text\" name=\"alias_add\" autocomplete=\"off\" maxlength=\"255\" required></td><td><input class=\"input\" type=\"text\" name=\"alias_to\" autocomplete=\"off\" maxlength=\"128\" required></td><td colspan=\"3\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
echo "</form>";
- $get_aliases = mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' order by id, alias");
-
while ($aliases_row = mysql_fetch_array($get_aliases)) {
if ($aliases_row[3] == "1") {
tree 80edc03a892c2512aef1de3373794f82bca73eb2
parent 26a8f184ad1fcf85a7ecf239e40313fcc6ae8470
author Engels Antonio <engels@majcms.org> 1351621972 +0800
committer Engels Antonio <engels@majcms.org> 1351621972 +0800
Add count subscribers and aliases for postmaster
diff --git a/index.php b/index.php
index 1d80217..3c0a7ae 100644
--- a/index.php
+++ b/index.php
@@ -1575,15 +1575,59 @@ echo "</tr>";
}
if ($_SESSION['logged_lvl'] == "postmaster") {
+
+ $pm_get = mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' order by id");
+
+ $pm_get_count = mysql_num_rows($pm_get);
+
+ echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
+
+ if ($pm_get_count > 0) {
+
+ $pm_get_0 = mysql_num_rows(mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' and mode='0'"));
+ $pm_get_1 = mysql_num_rows(mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' and mode='1'"));
+
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"10\">";
+
+ if ($pm_get_count == 1) {
+
+ echo "1 subscriber account (";
+
+ if ($pm_get_0 > 0) {
+ echo "disabled";
+ }
+ else {
+ echo "enabled";
+ }
+
+ echo ")";
+ }
+ else {
+ echo "$pm_get_count subscriber accounts (";
+
+ if ($pm_get_1 > 0) {
+ echo "$pm_get_1 enabled";
+ }
+
+ if (($pm_get_1 > 0) and ($pm_get_0 > 0)) {
+ echo ", ";
+ }
+
+ if ($pm_get_0 > 0) {
+ echo "$pm_get_0 disabled";
+ }
+
+ echo ")";
+ }
+
+ echo "</td></tr>";
+ }
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
echo "<tr bgcolor=\"#eeeeee\"><td colspan=\"4\" align=\"center\">status</td><td align=\"center\">username</td><td align=\"center\">complete name</td><td align=\"center\">password</td><td align=\"center\">quota</td><td align=\"center\" colspan=\"2\">action</td></tr>";
echo "<form method=\"post\">";
- echo "<tr bgcolor=\"#ffffff\"><td align=\"center\">new</td><td align=\"center\">cur</td><td align=\"center\">aka</td><td align=\"center\">rcv</td><td><input class=\"input\" type=\"text\" name=\"pm_id\" autocomplete=\"off\" maxlength=\"255\"></td><td><input class=\"input\" type=\"text\" name=\"pm_name\" autocomplete=\"off\" maxlength=\"128\"></td><td><input class=\"input\" type=\"text\" name=\"pm_pw\" autocomplete=\"off\" maxlength=\"64\"></td><td width=\"64\"><input class=\"input\" type=\"text\" name=\"pm_quota\" autocomplete=\"off\" maxlength=\"16\" style=\"text-align: right;\"></td><td colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td align=\"center\">new</td><td align=\"center\">cur</td><td align=\"center\">aka</td><td align=\"center\">rcv</td><td><input class=\"input\" type=\"text\" name=\"pm_id\" autocomplete=\"off\" maxlength=\"255\" required autofocus></td><td><input class=\"input\" type=\"text\" name=\"pm_name\" autocomplete=\"off\" maxlength=\"128\" required></td><td><input class=\"input\" type=\"text\" name=\"pm_pw\" autocomplete=\"off\" maxlength=\"64\" required></td><td width=\"64\"><input class=\"input\" type=\"text\" name=\"pm_quota\" autocomplete=\"off\" maxlength=\"16\" style=\"text-align: right;\"></td><td colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
echo "</form>";
- $pm_get = mysql_query("select * from users where domain='{$_SESSION['logged_uid']}' order by id");
-
while ($pm_row = mysql_fetch_array($pm_get)) {
if ($pm_row[5] == "1") {
@@ -1615,7 +1659,7 @@ echo "</tr>";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
echo "<tr bgcolor=\"#eeeeee\"><td colspan=\"2\" align=\"center\">status</td><td align=\"center\"><nobr>domain name</nobr></td><td align=\"center\"><nobr>account limit</nobr></td><td align=\"center\"><nobr>postmaster password</nobr></td><td align=\"center\" colspan=\"2\">action</td></tr>";
- echo "<form method=\"post\"><tr bgcolor=\"#ffffff\"><td align=\"center\">usr</td><td align=\"center\">rcv</td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_name\" maxlength=\"128\" autocomplete=\"off\"></td><td align=\"center\"><input class=\"input\" style=\"text-align: right;\" type=\"text\" name=\"dom_max\" maxlength=\"6\" autocomplete=\"off\" value=\"0\"></td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_pass\" maxlength=\"64\" autocomplete=\"off\"></td><td align=\"center\" colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr></form>";
+ echo "<form method=\"post\"><tr bgcolor=\"#ffffff\"><td align=\"center\">usr</td><td align=\"center\">rcv</td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_name\" maxlength=\"128\" autocomplete=\"off\" required autofocus></td><td align=\"center\"><input class=\"input\" style=\"text-align: right;\" type=\"text\" name=\"dom_max\" maxlength=\"6\" autocomplete=\"off\" value=\"0\" required></td><td align=\"center\"><input class=\"input\" type=\"text\" name=\"dom_pass\" maxlength=\"64\" autocomplete=\"off\" required></td><td align=\"center\" colspan=\"2\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr></form>";
$dom_get = mysql_query("select * from domains order by id");
@@ -1646,14 +1690,58 @@ echo "</tr>";
echo "<td width=\"10\"></td><td valign=\"top\">";
+ $get_aliases = mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' order by id, alias");
+
+ $get_aliases_count = mysql_num_rows($get_aliases);
+
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\">";
+
+ if ($get_aliases_count > 0) {
+
+ $get_aliases_0 = mysql_num_rows(mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' and mode='0'"));
+ $get_aliases_1 = mysql_num_rows(mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' and mode='1'"));
+
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"5\">";
+
+ if ($get_aliases_count == 1) {
+
+ echo "1 alias (";
+
+ if ($get_aliases_0 > 0) {
+ echo "disabled";
+ }
+ else {
+ echo "enabled";
+ }
+
+ echo ")";
+ }
+ else {
+ echo "$get_aliases_count aliases (";
+
+ if ($get_aliases_1 > 0) {
+ echo "$get_aliases_1 enabled";
+ }
+
+ if (($get_aliases_1 > 0) and ($get_aliases_0 > 0)) {
+ echo ", ";
+ }
+
+ if ($get_aliases_0 > 0) {
+ echo "$get_aliases_0 disabled";
+ }
+
+ echo ")";
+ }
+
+ echo "</td></tr>";
+ }
+
echo "<tr bgcolor=\"#eeeeee\"><td align=\"center\">alias</td><td align=\"center\">recipient</td><td align=\"center\" colspan=\"3\">action</td></tr>";
echo "<form method=\"post\">";
- echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"text\" name=\"alias_add\" autocomplete=\"off\" maxlength=\"255\"></td><td><input class=\"input\" type=\"text\" name=\"alias_to\" autocomplete=\"off\" maxlength=\"128\"></td><td colspan=\"3\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
+ echo "<tr bgcolor=\"#ffffff\"><td><input class=\"input\" type=\"text\" name=\"alias_add\" autocomplete=\"off\" maxlength=\"255\" required></td><td><input class=\"input\" type=\"text\" name=\"alias_to\" autocomplete=\"off\" maxlength=\"128\" required></td><td colspan=\"3\"><input class=\"button\" type=\"submit\" value=\"add\"></td></tr>";
echo "</form>";
- $get_aliases = mysql_query("select * from aliases where domain='{$_SESSION['logged_uid']}' order by id, alias");
-
while ($aliases_row = mysql_fetch_array($get_aliases)) {
if ($aliases_row[3] == "1") {