create -> add

This commit is contained in:
mischa 2022-09-04 11:10:23 +00:00
parent 299eeaee3f
commit e0b946dd8b
19 changed files with 62 additions and 200 deletions

View File

@ -22,13 +22,11 @@
// fGoto
// fDomain
//
require("./variables.inc.php");
require("./config.inc.php");
require("./functions.inc.php");
include("./languages/" . check_language() . ".lang");
$SESSID_USERNAME = check_session();
$list_domains = list_domains_for_admin($SESSID_USERNAME);
$list_domains = list_domains($SESSID_USERNAME);
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$pCreate_alias_goto_text = $LANG['Create_alias_goto_text'];
@ -109,6 +107,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
}
include("./templates/header.tpl");
include("./templates/menu.tpl");
include("./templates/create-alias.tpl");
include("./templates/add-alias.tpl");
include("./templates/footer.tpl");
?>

View File

@ -28,13 +28,11 @@
// fActive
// fMail
//
require("./variables.inc.php");
require("./config.inc.php");
require("./functions.inc.php");
include("./languages/" . check_language() . ".lang");
$SESSID_USERNAME = check_session();
$list_domains = list_domains_for_admin($SESSID_USERNAME);
$list_domains = list_domains($SESSID_USERNAME);
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$tQuota = $CONF['maxquota'];
@ -188,6 +186,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
}
include("./templates/header.tpl");
include("./templates/menu.tpl");
include("./templates/create-mailbox.tpl");
include("./templates/add-mailbox.tpl");
include("./templates/footer.tpl");
?>

View File

@ -27,12 +27,18 @@ include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$address = strtolower(filter_input(INPUT_POST, 'address', FILTER_DEFAULT));
$domain = filter_input(INPUT_POST, 'domain', FILTER_VALIDATE_DOMAIN);
$goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT));
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
print "$domain_key";
$from = filter_var($address . '@' . $domain, FILTER_VALIDATE_EMAIL);
if (!str_contains($goto, '@')) {

View File

@ -29,8 +29,12 @@ include '../languages/' . check_language() . '.lang';
$list_domains = list_domains();
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$username = strtolower(filter_input(INPUT_POST, 'username', FILTER_DEFAULT));
$domain = filter_input(INPUT_POST, 'domain', FILTER_VALIDATE_DOMAIN);
$password1 = filter_input(INPUT_POST, 'password1', FILTER_DEFAULT);

View File

@ -29,7 +29,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
$limit = PAGE_SIZE;
if (count($list_domains) > 0) {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain'];
$selected_domain = array_search($domain, array_column($list_domains, 'domain'));
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
$list_alias = list_aliases($domain, $offset, $limit);
$list_mailbox = list_mailboxes($domain, $offset, $limit);
}

View File

@ -24,6 +24,7 @@ $list_domains = list_domains();
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain'];
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
$dbh = connect_db();
$sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10");
$sth->bindParam(1, $domain, PDO::PARAM_STR);

View File

@ -14,14 +14,13 @@
// list_alias
// list_mailbox
//
// Form GET Variables:
// Form POST \ GET Variables:
//
// domain
// offset
//
require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
include './templates/header.tpl';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
@ -34,10 +33,11 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
$list_alias = list_aliases($domain, $offset, $limit);
$list_mailbox = list_mailboxes($domain, $offset, $limit);
$template = "list-virtual.tpl";
include './templates/menu.tpl';
include './templates/list-virtuals.tpl';
}
}
include './templates/header.tpl';
include './templates/menu.tpl';
include './templates/list-virtuals.tpl';
include './templates/footer.tpl';
?>

View File

@ -19,8 +19,6 @@
// fPassword
// fPassword2
//
require("./variables.inc.php");
require("./config.inc.php");
require("./functions.inc.php");
include("./languages/" . check_language() . ".lang");

View File

@ -22,8 +22,6 @@
// fSubject
// fBody
//
require("./variables.inc.php");
require("./config.inc.php");
require("./functions.inc.php");
include("./languages/" . check_language() . ".lang");

View File

@ -12,7 +12,7 @@
<?php
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if (isset($domain) && $domain == $row['domain']) echo ' selected';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
}
?>

View File

@ -12,7 +12,7 @@
<?php
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if (isset($domain) && $domain == $row['domain']) echo ' selected';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
}
?>

View File

@ -5,7 +5,7 @@
if (count($list_admins) > 0) {
foreach ($list_admins as $row) {
echo '<option value="' . $row['username'] . '"';
if (isset($_GET['username']) && $_GET['username'] == $row['username']) echo ' selected';
if (isset($username) && $username == $row['username']) echo ' selected';
echo ">" . $row['username'] . "</option>\n";
}
}

View File

@ -5,7 +5,7 @@
if (count($list_domains) > 0) {
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if ($list_domains[$selected_domain]['domain'] == $row['domain']) echo ' selected';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
}
}
@ -16,8 +16,8 @@ if (count($list_domains) > 0) {
</form>
<h4><?php echo $LANG['AdminList_virtual_welcome'] . $domain; ?></h4>
<p><?php echo $LANG['AdminList_virtual_alias_alias_count'] . ": " . $list_domains[$selected_domain]['alias_count'] . " / " . $list_domains[$selected_domain]['aliases']; ?></p>
<p><?php echo $LANG['AdminList_virtual_alias_mailbox_count'] . ": " . $list_domains[$selected_domain]['mailbox_count'] . " / " . $list_domains[$selected_domain]['mailboxes']; ?></p>
<p><?php echo $LANG['AdminList_virtual_alias_alias_count'] . ": " . $list_domains[$domain_key]['alias_count'] . " / " . $list_domains[$domain_key]['aliases']; ?></p>
<p><?php echo $LANG['AdminList_virtual_alias_mailbox_count'] . ": " . $list_domains[$domain_key]['mailbox_count'] . " / " . $list_domains[$domain_key]['mailboxes']; ?></p>
<form name="search" method="post" action="search.php">
<input type="textbox" name="search" size="25">
@ -25,18 +25,18 @@ if (count($list_domains) > 0) {
</div>
<?php
if ($list_domains[$selected_domain]['alias_count'] > $limit || $list_domains[$selected_domain]['mailbox_count'] > $limit) {
if ($list_domains[$domain_key]['alias_count'] > $limit || $list_domains[$domain_key]['mailbox_count'] > $limit) {
echo "<div id=\"nav_bar\">\n";
if ($offset >= $limit) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$selected_domain]['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"../images/arrow-l.png\" title=\"" . $LANG['Overview_left_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=" . ($offset - $limit) . "\"><img border=\"0\" src=\"../images/arrow-l.png\" title=\"" . $LANG['Overview_left_arrow'] . "\"></a>\n";
}
if (($list_domains[$selected_domain]['alias_count'] > $limit) || ($list_domains[$selected_domain]['mailbox_count'] > $limit)) {
if (($list_domains[$domain_key]['alias_count'] > $limit) || ($list_domains[$domain_key]['mailbox_count'] > $limit)) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$selected_domain]['domain'] . "&offset=0\"><img border=\"0\" src=\"../images/arrow-u.png\" title=\"" . $LANG['Overview_up_arrow'] . "\"></a>\n";
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=0\"><img border=\"0\" src=\"../images/arrow-u.png\" title=\"" . $LANG['Overview_up_arrow'] . "\"></a>\n";
}
if ((($offset + $limit) < $list_domains[$selected_domain]['alias_count']) || (($offset + $limit) < $list_domains[$selected_domain]['mailbox_count'])) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$selected_domain]['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"../images/arrow-r.png\" title=\"" . $LANG['Overview_right_arrow'] . "\"></a>\n";
if ((($offset + $limit) < $list_domains[$domain_key]['alias_count']) || (($offset + $limit) < $list_domains[$domain_key]['mailbox_count'])) {
echo "<a href=\"list-virtual.php?domain=" . $list_domains[$domain_key]['domain'] . "&offset=" . ($offset + $limit) . "\"><img border=\"0\" src=\"../images/arrow-r.png\" title=\"" . $LANG['Overview_right_arrow'] . "\"></a>\n";
}
echo "</div>\n";
}
@ -57,8 +57,8 @@ if (count($list_alias) > 0) {
echo " <td>" . $row['address'] . "</td>\n";
echo " <td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>\n";
echo " <td>" . $row['modified'] . "</td>\n";
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$selected_domain]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=alias" . "&delete=" . $row['address'] . "&domain=" . $list_domains[$selected_domain]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=alias" . "&delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
}
echo "</table>\n";
@ -81,8 +81,8 @@ if (count($list_mailbox) > 0) {
echo " <td>" . $row['username'] . "</td>\n";
echo " <td>" . $row['name'] . "</td>\n";
echo " <td>" . $row['modified'] . "</td>\n";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$selected_domain]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=mailbox" . "&delete=" . $row['username'] . "&domain=" . $list_domains[$selected_domain]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?table=mailbox" . "&delete=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
}
echo "</table>\n";

View File

@ -1,35 +0,0 @@
<div id="edit_form">
<form name="create_alias" method="post">
<table>
<tr>
<td colspan="3"><h3><?php echo $LANG['Create_alias_welcome']; ?></h3></td>
</tr>
<tr>
<td><?php echo $LANG['Create_alias_address']; ?></td>
<td><input class="flat" type="text" name="address" value="<?php echo $address ?? ''; ?>" /></td>
<td>
<select class="flat" name="domain">
<?php
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if (isset($domain) && $domain == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><?php echo $LANG['Create_alias_goto'] . ":"; ?></td>
<td><input class="flat" type="text" name="goto" value="<?php echo $goto ?? ''; ?>" /></td>
<td><?php echo $LANG['Create_alias_goto_text']; ?></td>
</tr>
<tr>
<td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php echo $LANG['Create_alias_button']; ?>" /></td>
</tr>
<tr>
<td colspan="3" class="standout"><?php echo $message ?? '&nbsp;'; ?></td>
</tr>
</table>
</div>

View File

@ -1,65 +0,0 @@
<div id="edit_form">
<form name="create_mailbox" method="post">
<table>
<tr>
<td colspan="3"><h3><?php echo $LANG['Create_mailbox_welcome']; ?></h3></td>
</tr>
<tr>
<td><?php echo $LANG['Create_mailbox_username'] . ":"; ?></td>
<td><input class="flat" type="text" name="fUsername" value="<?php echo $tUsername; ?>" /></td>
<td>
<select name="fDomain">
<?php
for ($i = 0; $i < count($list_domains); $i++) {
if ($tDomain == $list_domains[$i]) {
echo "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n";
} else {
echo "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n";
}
}
?>
</select>
<?php echo $pCreate_mailbox_username_text; ?>
</td>
</tr>
<tr>
<td><?php echo $LANG['Create_mailbox_password'] . ":"; ?></td>
<td><input class="flat" type="password" name="fPassword" /></td>
<td><?php echo $pCreate_mailbox_password_text; ?></td>
</tr>
<tr>
<td><?php echo $LANG['Create_mailbox_password2'] . ":"; ?></td>
<td><input class="flat" type="password" name="fPassword2" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><?php echo $LANG['Create_mailbox_name'] . ":"; ?></td>
<td><input class="flat" type="text" name="fName" value="<?php echo $tName; ?>" /></td>
<td><?php echo $pCreate_mailbox_name_text; ?></td>
</tr>
<?php if ($CONF['quota'] == 'YES') { ?>
<tr>
<td><?php echo $LANG['Create_mailbox_quota'] . ":"; ?></td>
<td><input type="text" name="fQuota" value="<?php echo $tQuota; ?>" /></td>
<td><?php echo $pCreate_mailbox_quota_text; ?></td>
<tr>
<?php } ?>
<tr>
<td><?php echo $LANG['Create_mailbox_active'] . ":"; ?></td>
<td><input class="flat" type="checkbox" name="fActive" checked /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><?php echo $LANG['Create_mailbox_mail'] . ":"; ?></td>
<td><input class="flat" type="checkbox" name="fMail" checked /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php echo $LANG['Create_mailbox_button']; ?>" /></td>
</tr>
<tr>
<td colspan="3" class="standout"><?php echo $tMessage; ?></td>
</tr>
</table>
</form>
</div>

View File

@ -5,7 +5,7 @@
if (count($list_domains) > 0) {
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if (isset($domain) && $domain == $row['domain']) echo ' selected';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
}
}
@ -63,22 +63,10 @@ if (count($list_alias) > 0) {
echo " <td>" . $row['address'] . "</td>\n";
echo " <td>" . preg_replace("/,/", "<br>", $row['goto']) . "</td>\n";
echo " <td>" . $row['modified'] . "</td>\n";
if ($CONF['special_alias_control'] == 'YES') {
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
} else {
if (!in_array($row['goto'], $CONF['default_aliases'])) {
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $row['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?delete=" . $row['address'] . "&domain=" . $row['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
} else {
echo " <td>&nbsp;</td>\n";
echo " <td>&nbsp;</td>\n";
}
}
echo " <td><a href=\"edit-alias.php?address=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?delete=" . $row['address'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_aliases'] . ": ". $row['address'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
}
echo "</table>\n";
}
@ -91,7 +79,6 @@ if (count($list_mailbox) > 0) {
echo " <td>" . $LANG['Overview_mailbox_username'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_name'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_modified'] . "</td>\n";
echo " <td>" . $LANG['Overview_mailbox_active'] . "</td>\n";
echo " <td colspan=\"2\">&nbsp;</td>\n";
echo " </tr>\n";
@ -100,8 +87,8 @@ if (count($list_mailbox) > 0) {
echo " <td>" . $row['username'] . "</td>\n";
echo " <td>" . $row['name'] . "</td>\n";
echo " <td>" . $row['modified'] . "</td>\n";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=$fDomain" . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?delete=" . $row['username'] . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " <td><a href=\"edit-mailbox.php?username=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\">" . $LANG['edit'] . "</a></td>\n";
echo " <td><a href=\"delete.php?delete=" . $row['username'] . "&domain=" . $list_domains[$domain_key]['domain'] . "\"onclick=\"return confirm ('" . $LANG['confirm'] . $LANG['Overview_get_mailboxes'] . ": ". $row['username'] . "')\">" . $LANG['del'] . "</a></td>\n";
echo " </tr>\n";
}
echo "</table>\n";

View File

@ -1,8 +1,8 @@
<div id="menu">
<ul>
<li><a target="_top" href="list-domains.php"><?php echo $LANG['Menu_overview']; ?></a></li>
<li><a target="_top" href="create-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_create_alias']; ?></a></li>
<li><a target="_top" href="create-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_create_mailbox']; ?></a></li>
<li><a target="_top" href="add-alias.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_create_alias']; ?></a></li>
<li><a target="_top" href="add-mailbox.php<?php if (isset($domain)) echo '?domain=' . $domain; ?>"><?php echo $LANG['Menu_create_mailbox']; ?></a></li>
<li><a target="_top" href="sendmail.php"><?php echo $LANG['Menu_sendmail']; ?></a></li>
<li><a target="_top" href="password.php"><?php echo $LANG['Menu_password']; ?></a></li>
<li><a target="_top" href="viewlog.php"><?php echo $LANG['Menu_viewlog']; ?></a></li>

View File

@ -5,7 +5,7 @@
if (count($list_domains) > 0) {
foreach ($list_domains as $row) {
echo '<option value="' . $row['domain'] . '"';
if (isset($domain) && $domain == $row['domain']) echo ' selected';
if ($list_domains[$domain_key]['domain'] == $row['domain']) echo ' selected';
echo ">" . $row['domain'] . "</option>\n";
}
}

View File

@ -11,58 +11,30 @@
//
// Template Variables:
//
// tMessage
// tLog
// log
//
// Form POST \ GET Variables:
//
// fDomain
// domain
//
require("./variables.inc.php");
require("./config.inc.php");
require("./functions.inc.php");
include("./languages/" . check_language() . ".lang");
require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains_for_admin($SESSID_USERNAME);
$list_domains = list_domains($SESSID_USERNAME);
if ($_SERVER['REQUEST_METHOD'] == "GET") {
if ((is_array($list_domains) and count($list_domains) > 0)) $fDomain = $list_domains[0];
if (!check_owner($SESSID_USERNAME, $fDomain)) {
$error = 1;
$tMessage = $LANG['Viewlog_result_error'];
}
if ($error != 1) {
$result = db_query("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
if ($result['rows'] > 0) {
while ($row = db_array($result['result'])) {
$tLog[] = $row;
}
}
}
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain'];
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
$dbh = connect_db();
$sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT 10");
$sth->bindParam(1, $domain, PDO::PARAM_STR);
$sth->execute();
$log = $sth->fetchAll();
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$fDomain = escape_string($_POST['fDomain']);
if (!check_owner($SESSID_USERNAME, $fDomain)) {
$error = 1;
$tMessage = $LANG['Viewlog_error'];
}
if ($error != 1) {
$result = db_query("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
if ($result['rows'] > 0) {
while ($row = db_array($result['result'])) {
$tLog[] = $row;
}
}
}
}
include("./templates/header.tpl");
include("./templates/menu.tpl");
include("./templates/viewlog.tpl");
include("./templates/footer.tpl");
include './templates/header.tpl';
include './templates/menu.tpl';
include './templates/viewlog.tpl';
include './templates/footer.tpl';
?>