90ff574818a66e93efc80f614491d01ab90ed0d9
bernd webinterface => /webinterface

bernd authored 17 years ago

1) <?php
2) 
bernd XSS/CSRF-Bugs behoben

bernd authored 16 years ago

3) require_once("inc/security.php");
4) 
bernd webinterface => /webinterface

bernd authored 17 years ago

5) function system_failure($reason)
6) {
7)         include('inc/top.php');
bernd Fehlermeldungen hübscher

bernd authored 16 years ago

8)         echo '
bernd webinterface => /webinterface

bernd authored 17 years ago

9)         <h3>Fehler</h3>
bernd Fehlermeldungen hübscher

bernd authored 16 years ago

10)         <div class="error">
11)           <p>Es ist ein Fehler aufgetreten:<br /> '.filter_input_general($reason).'</p>
bernd webinterface => /webinterface

bernd authored 17 years ago

12)         </div>';
13)         include('inc/bottom.php');
14)         die();
15) }
16) 
17) 
18) function input_error($reason)
19) {
20)   global $input_error;
21)   if (!isset($input_error))
22)     $input_error = array();
23)   array_push($input_error, $reason);
24) }
25) 
26) function warning($msg)
27) {
28)   global $warning;
29)   if (!isset($warning))
30)     $warning = array();
31)   array_push($warning, $msg);
32) }
33) 
34) function success_msg($msg)
35) {
36)   global $success_msg;
37)   if (!isset($success_msg))
38)     $success_msg = array();
39)   array_push($success_msg, $msg);
40) }
41) 
42) 
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

43) function we_have_an_error()
44) {
45)   global $input_error;
46)   global $warning;
47) 
48)   return ((count($input_error) + count($warning)) > 0);
49) 
50) }
51) 
52) 
bernd webinterface => /webinterface

bernd authored 17 years ago

53) function show_messages()
54) {
55)   global $input_error;
56)   global $success_msg;
57)   global $warning;
58)   if (isset($input_error))
59)   {
60)     echo '<div class="error">
61)     <h3>Fehler</h3>
62)     <p>Folgende Fehler wurden festgestellt: </p>
63)     <ul>
64)     ';
65)     foreach ($input_error as $error)
66)     {
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

67)       echo '<li>'.nl2br(filter_input_general($error))."</li>\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

68)     }
69)     echo '</ul>
70)     </div>';
71)   }
72)   if (isset($warning))
73)   {
74)     echo '<div class="error">
75)     <ul>
76)     ';
77)     foreach ($warning as $msg)
78)     {
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

79)       echo '<li>'.nl2br(filter_input_general($msg))."</li>\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

80)     }
81)     echo '</ul>
82)     </div>';
83)   }
84)   if (isset($success_msg))
85)   {
86)     echo '<div class="success">
87)     <ul>
88)     ';
89)     foreach ($success_msg as $msg)
90)     {
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

91)       echo '<li>'.nl2br(filter_input_general($msg))."</li>\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

92)     }
93)     echo '</ul>
94)     </div>';
95)   }
96) }
97) 
98) 
99) function require_role($roles)
100) {
101)   if (! is_array($roles))
102)     $roles = array($roles);
103)   $allow = false;
104)   foreach ($roles as $role)
bernd Nachtrag zum vorigen

bernd authored 16 years ago

105)     if ($role & $_SESSION['role'])
bernd webinterface => /webinterface

bernd authored 17 years ago

106)       $allow = true;
107)   if (! $allow)
bernd Nachtrag zum vorigen

bernd authored 16 years ago

108)     if ($_SESSION['role'] == ROLE_ANONYMOUS)
109)       login_screen("Diese Seite können Sie erst benutzen, wenn Sie sich mit Ihren Zugangsdaten anmelden.");
110)     else
111)       login_screen("Diese Seite können Sie mit Ihren aktuellen Zugriffsrechten nicht benutzen, bitte melden Sie sich mit den benötigten Zugriffsrechten an!");
bernd webinterface => /webinterface

bernd authored 17 years ago

112) }
113) 
114) 
115) function login_screen($why)
116) {
117)         $title = 'Login';
118)         include('inc/top.php');
119)         echo '<h3>Sie sind nicht am System angemeldet!</h3>';
120)         if ($why != "")
121)         {
122)                 echo '<p class="warning"><b>Fehler:</b> '.$why.'</p>';
123)         }
124)         echo '<form action="" method="post">
125)         <p><span class="login_label">Benutzer<sup>*</sup>:</span> <input type="text" name="username" size="30" /></p>
126)         <p><span class="login_label">Passwort:</span> <input type="password" name="password" size="30" /></p>
bernd Entities repariert

bernd authored 16 years ago

127)         <p><span class="login_label">&#160;</span> <input type="submit" value="Anmelden" /></p>
bernd webinterface => /webinterface

bernd authored 17 years ago

128)         </form>
bernd Auch IMAP-Accounts können s...

bernd authored 16 years ago

129)         <p><sup>*</sup> Sie können sich hier mit Ihrem System-Benutzernamen, Ihrer System-User-ID, Ihrem IMAP-Account oder Ihrer Kundennummer anmelden. Je nach gewählten Daten erhalten Sie unterschiedliche Zugriffsrechte.</p>