Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- $error_msg = "";
- //checks the session to see if the user is logged in
- if (!isset($_SESSION['username'])) {
- if (!isset($_POST['submit'])) {
- //grabs data from POST
- $username = $_POST['username'];
- $password = $_POST['password'];
- //lookup username and password in the database
- if (!empty($username) && !empty($password)) {
- if ($result = mysqli_query($dbc, "SELECT COUNT(*) FROM users WHERE username='" . $username . "'
- AND password='".$password."'")) {
- $row = mysqli_fetch_assoc($result);
- if ($row['COUNT(*)'] == 0) {
- $_SESSION['username'] = $row['username'];
- //redirect after successful login
- header("Location: admincp.html");
- } else {
- //the username and password are incorrect so set error message
- $error_msg = 'Sorry, you must enter a valid username and password to log in. <a href="Signup.php">Please sign up!</a>';
- }
- }
- }
- }
- }
- ?>
- <html>
- <head>
- <title> GijoeTeam LoginPanel</title>
- <link href="css/admincp.css" rel="stylesheet" type="text/css" media="screen">
- <script src="js/jquery.js" type="text/javascript"></script>
- <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <style>
- .button {
- background-color: #4CAF50; /* Green */
- border: none;
- color: white;
- padding: 16px 32px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 16px;
- margin: 4px 2px;
- -webkit-transition-duration: 0.4s; /* Safari */
- transition-duration: 0.4s;
- cursor: pointer;
- }
- .button1 {
- background-color: white;
- color: black;
- border: 2px solid #4CAF50;
- }
- .button1:hover {
- background-color: #4CAF50;
- color: white;
- }
- .button2 {
- background-color: white;
- color: black;
- border: 2px solid #008CBA;
- }
- .button2:hover {
- background-color: #008CBA;
- color: white;
- }
- .button3 {
- background-color: white;
- color: black;
- border: 2px solid #f44336;
- }
- .button3:hover {
- background-color: #f44336;
- color: white;
- }
- .button4 {
- background-color: white;
- color: black;
- border: 2px solid #e7e7e7;
- }
- .button4:hover {background-color: #e7e7e7;}
- .button5 {
- background-color: white;
- color: black;
- border: 2px solid #555555;
- }
- .button5:hover {
- background-color: #555555;
- color: white;
- }
- </style>
- </head>
- <body class="w3-container">
- <header class="w3-container w3-teal">
- <h1>Gijoe LoginPanel</h1>
- </header>
- <div id="loginp" class="cities">
- <p>
- <form action="login.php" method="post" enctype="multipart/form-data">
- <input type="text" id="username" name="username" placeholder="Username">
- <input type="password" id="password" name="password" placeholder="Password">
- <button type="submit" class="button button2">Login</button>
- </p>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement