Blob


1 <?php
2 //
3 // Postfix Admin
4 // by Mischa Peters <mischa at high5 dot net>
5 // Copyright (c) 2002 - 2005 High5!
6 // License Info: http://www.postfixadmin.com/?file=LICENSE.TXT
7 //
8 // File: viewlog.php
9 //
10 // Template File: viewlog.tpl
11 //
12 // Template Variables:
13 //
14 // tMessage
15 // tLog
16 //
17 // Form POST \ GET Variables:
18 //
19 // fDomain
20 //
21 require ("./variables.inc.php");
22 require ("./config.inc.php");
23 require ("./functions.inc.php");
24 include ("./languages/" . check_language () . ".lang");
26 $SESSID_USERNAME = check_session();
27 $list_domains = list_domains_for_admin ($SESSID_USERNAME);
29 if ($_SERVER['REQUEST_METHOD'] == "GET")
30 {
31 if ((is_array ($list_domains) and count ($list_domains) > 0)) $fDomain = $list_domains[0];
33 if (!check_owner ($SESSID_USERNAME, $fDomain))
34 {
35 $error = 1;
36 $tMessage = $PALANG['pViewlog_result_error'];
37 }
39 if ($error != 1)
40 {
41 $result = db_query ("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
42 if ($result['rows'] > 0)
43 {
44 while ($row = db_array ($result['result']))
45 {
46 $tLog[] = $row;
47 }
48 }
49 }
51 include ("./templates/header.tpl");
52 include ("./templates/menu.tpl");
53 include ("./templates/viewlog.tpl");
54 include ("./templates/footer.tpl");
55 }
57 if ($_SERVER['REQUEST_METHOD'] == "POST")
58 {
59 $fDomain = escape_string ($_POST['fDomain']);
61 if (!check_owner ($SESSID_USERNAME, $fDomain))
62 {
63 $error = 1;
64 $tMessage = $PALANG['pViewlog_error'];
65 }
67 if ($error != 1)
68 {
69 $result = db_query ("SELECT * FROM log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10");
70 if ($result['rows'] > 0)
71 {
72 while ($row = db_array ($result['result']))
73 {
74 $tLog[] = $row;
75 }
76 }
77 }
79 include ("./templates/header.tpl");
80 include ("./templates/menu.tpl");
81 include ("./templates/viewlog.tpl");
82 include ("./templates/footer.tpl");
83 }
84 ?>