1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- session_start();
- include_once ('tools/util.php');
- include_once ('tools/htpasswd.php');
- $ini = read_config();
- if (isset ( $_POST ['user'] ) && isset ( $_POST ['password'] )) {
- $username = $_POST ['user'];
- $password = $_POST ['password'];
-
- $hash_tool = new crypt_hash_tool();
-
- if ($username == $ini['admin_user'] && $hash_tool->check_password_hash($password,$ini['admin_pwd_hash'])) {
- $_SESSION ['login'] = true;
- header ( 'LOCATION:index.php' );
- die ();
- }
- $error = 'Invalid user or password!';
- }
- include_once ('includes/head.php');
- include_once ('includes/nav.php');
- ?>
- <div class="container box">
- <div class="row">
- <div class="col-xs-12">
- <h2>Please Login:</h2>
- <?php
- if (isset ( $error )) {
-
- ?>
- <div class="alert alert-danger">
- <?php
- echo "<p>" . $error . "</p>";
- ?>
- </div>
- <?php
- }
- ?>
- <form class="navbar-form navbar-left" action="login.php" method="post">
- <div class="form-group">
- <p>Login:</p>
- <input type="text" class="form-control" placeholder="Username"
- name="user">
- </p>
- <p>
- <input class="form-control" type="password" name="password"
- placeholder="Password" />
- </p>
- <button type="submit" class="btn btn-default">Login</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <?php
- include_once ('includes/footer.php');
- ?>
|