Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>Citytrans Logistics | Log in</title>
- <!-- Tell the browser to be responsive to screen width -->
- <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
- <!-- Bootstrap 3.3.7 -->
- <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
- <!-- Font Awesome -->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
- <!-- Ionicons -->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
- <!-- Theme style -->
- <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
- <!-- SweetAlert -->
- <link rel="stylesheet" href="../../plugins/SweetAlert/sweetalert.css">
- <!-- SweetAlert JS -->
- <script src="../../plugins/SweetAlert/sweetalert.min.js"></script>
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- <!-- Google Font -->
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
- </head>
- <body class="hold-transition login-page">
- <!-- php for sessions -->
- <?php
- session_start();
- require($_SERVER['DOCUMENT_ROOT'] . '/config/db.php');
- require($_SERVER['DOCUMENT_ROOT'] . '/config/cpp.php');
- //if form submitted, insert value into db
- if (isset($_POST['username'])) {
- //remove backlashes and escape special char
- $username = stripslashes($_REQUEST['username']);
- $username = mysqli_real_escape_string($conn,$username);
- $password = stripslashes($_REQUEST['password']);
- $password = mysqli_real_escape_string($conn,$password);
- //Checking is user existing in the database or not
- $query = "SELECT * FROM `users` WHERE username='$username' and password='".md5($password)."'";
- $result = mysqli_query($conn,$query) or die(mysql_error());
- $rows = mysqli_num_rows($result);
- if ($rows==1) {
- ob_start();
- $_SESSION['username'] = $username;
- // Redirect user to index.php
- header("Location: home.php", true, 301); exit;
- ob_end_flush();
- } else {
- ?>
- <script type="text/javascript">
- swal({
- title: "Invalid username/password!",
- text: "Please key in the correct username/password.",
- timer: 1000,
- showConfirmButton: true
- });
- </script>
- <?php
- }
- }
- ?>
- <div class="login-box">
- <div class="login-logo">
- <a href="../../index.php"><b><?php echo $companyname; ?></b></a>
- </div>
- <!-- /.login-logo -->
- <div class="login-box-body">
- <?php
- if (!isset($_SESSION['username'])) {
- echo '<p class="login-box-msg">Sign in to start your session</p>';
- } else {
- header("Location: home.php", true, 301); exit;
- }
- ?>
- <form action="" method="post" name="login">
- <div class="form-group has-feedback">
- <input type="text" class="form-control" placeholder="Username" name="username" id="username">
- <span class="glyphicon glyphicon-user form-control-feedback"></span>
- </div>
- <div class="form-group has-feedback">
- <input type="password" class="form-control" placeholder="Password" name="password" id="password">
- <span class="glyphicon glyphicon-lock form-control-feedback"></span>
- </div>
- <div class="row">
- <div class="col-xs-12">
- <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
- </div>
- <!-- /.col -->
- </div>
- </form>
- </div>
- <!-- /.login-box-body -->
- </div>
- <!-- /.login-box -->
- <!-- jQuery 3.1.1 -->
- <script src="../../plugins/jQuery/jquery-3.1.1.min.js"></script>
- <!-- Bootstrap 3.3.7 -->
- <script src="../../bootstrap/js/bootstrap.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement