root/EMS/login.php

Revision 8, 1.6 kB (checked in by evilbunny, 2 years ago)

Initial setup improvements

Line 
1 <?
2     require_once("common.php");
3
4     if($_SESSION['_config']['access'] >= 90)
5     {
6         header("location: admin.php");
7         exit;
8     } else if($_SESSION['_config']['access'] > 0) {
9         header("location: home.php");
10         exit;
11     }
12
13     require_once("radauth.php");
14
15     $process = 0;
16     if($_POST['process'] != "")
17         $process = 1;
18
19     $username = strip_tags(trim($_POST['username']));
20     $password = strip_tags(trim($_POST['password']));
21     $errmsg = "";
22
23     if($process)
24     {
25         if(($retval = RADIUS_AUTHENTICATION($username,$password)) == 2)
26         {
27             $_SESSION['_config']['username'] = $username;
28             if($username == "root")
29             {
30                 $_SESSION['_config']['access'] = 90;
31                 header("location: admin.php");
32             } else {
33                 $_SESSION['_config']['access'] = 10;
34                 header("location: home.php");
35             }
36
37             exit;
38         }
39
40         $errmsg = "Incorrect username and/or password";
41     }
42
43     include_once("header.php");
44 ?>
45     <div class="bodytext" style="padding:12px;" align="justify">
46 <? if($errmsg) { ?><p style="color:red;"><?=$errmsg?></p><? } ?>
47         <p>Please enter your username and password below to log into your account.</p>
48         <form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
49         <label for="username" style="width:75px;float:left;clear:left;">Username:</label> <input type="text" name="username" value="<?=$username?>"><br />
50         <label for="password" style="width:75px;float:left;clear:left;">Password:</label> <input type="password" name="password"><br />
51         <label for="process" style="width:75px;float:left;clear:left;">&nbsp;</label> <input type="submit" value="Login"><br />
52         <input type="hidden" name="process" value="1">
53         </form>
54     </div>
55 <? include_once("footer.php"); ?>
56
Note: See TracBrowser for help on using the browser.