Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include_once 'dbconnect.php';
- if(isset($_SESSION['user'])!="")
- {
- $_SESSION['userId'] = $_POST['Username'];
- header("Location: account.php");
- }
- if(isset($_POST['btn-login']))
- {
- $uname = mysql_real_escape_string($_POST['Username']);
- $upass = $_POST['Password'];
- $uname = trim($uname);
- $upass = trim($upass);
- $res=mysql_query("SELECT userId, username, password FROM users WHERE username='$uname'");
- $row=mysql_fetch_array($res);
- $count = mysql_num_rows($res); // if uname/pass correct it returns must be 1 row
- if($count == 1 && $row['password']==$upass)
- {
- $_SESSION['user'] = $row['userId'];
- header("Location: account.php");
- }
- else
- {
- ?>
- <script>alert('Username / Password Seems Wrong !');</script>
- <?php
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="Team 12, Code App, Level Up, Travel, Agency">
- <title>Login</title>
- <!-- Bootstrap core CSS -->
- <link href="css/bootstrap_nova.css" rel="stylesheet">
- <!--external css-->
- <link href="css/font-awesome/css/font-awesome.css" rel="stylesheet" />
- <!-- Custom styles for this template -->
- <link href="css/style.css" rel="stylesheet">
- <link href="css/style-responsive.css" rel="stylesheet">
- <style>
- #test1{
- opacity: 0.9;
- }
- </style>
- </head>
- <body>
- <div id="login-page">
- <div class="container">
- <form class="form-login" method="post" id="test1">
- <h2 class="form-login-heading">sign in now</h2>
- <div class="login-wrap">
- <div class="input-group input-group-lg">
- <span style="border: none" class="input-group-addon"><i style="width: 15px; border:none;" class="fa fa-user"></i></span>
- <input type="text" class="form-control" placeholder="Username" name="Username" style="border: none" autofocus required>
- </div>
- <br>
- <div class="input-group input-group-lg">
- <span style="border: none" class="input-group-addon"><i style="width: 15px;" class="fa fa-lock"></i></span>
- <input type="password" class="form-control" placeholder="Password" name="Password" style="border: none" required>
- </div>
- <label class="checkbox">
- <span class="pull-right">
- <a data-toggle="modal" href="login.php#myModal"> Forgot Password?</a>
- </span>
- </label>
- <button class="btn btn-theme btn-block" name="btn-login" type="submit"><i class="fa fa-lock"></i> SIGN IN</button>
- <hr>
- <div class="registration">
- <strong><a class="" href="register.php">
- Create an account
- </a></strong>
- |
- <strong> <a class="" href="index.php">
- Home
- </a></strong>
- |
- <strong><a class="" href="blog.php">
- Blog
- </a></strong>
- </div>
- </div>
- </form>
- </div>
- </div>
- <!-- js placed at the end of the document so the pages load faster -->
- <script src="js/jquery.js"></script>
- <script src="js/bootstrap.min.js"></script>
- <!--BACKSTRETCH-->
- <!-- You can use an image of whatever size. This script will stretch to fit in any screen size.-->
- <script type="text/javascript" src="js/jquery.backstretch.min.js"></script>
- <script>
- $.backstretch("img/paris-large.jpeg", {speed: 500});
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement