Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- session_start();
- if($_SERVER["REQUEST_METHOD"] == "POST") {
- // username and password sent from form
- $myusername = mysqli_real_escape_string($db,$_POST['username']);
- $mypassword = mysqli_real_escape_string($db,$_POST['password']);
- $sql = "SELECT id FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";
- $result = mysqli_query($db,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $active = $row['active'];
- $count = mysqli_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- if($count == 1) {
- session_register("myusername");
- $_SESSION['login_user'] = $myusername;
- header("location: welcome.php");
- }else {
- $error = "Your Login Name or Password is invalid";
- }
- }
- ?>
- <html lang="es">
- <head>
- <meta charset="utf-8">
- <title>ShurSpotify - Login</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
- <style type="text/css">
- body {
- padding-top: 40px;
- padding-bottom: 40px;
- background-color: #eee;
- }
- .fullscreen_bg {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- background-size: cover;
- background-position: 50% 50%;
- background-image: url('/images/cover.jpg');
- }
- .form-signin {
- position:absolute;
- top: 50%;
- left: 50%;
- width:15em;
- height:18em;
- margin-top: -7em; /*set to a negative number 1/2 of your height*/
- margin-left: -7em;
- }
- .form-signin .form-signin-heading, .form-signin {
- margin-bottom: 10px;
- }
- .form-signin .form-control {
- position: relative;
- font-size: 16px;
- height: auto;
- padding: 10px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .form-signin .form-control:focus {
- z-index: 2;
- }
- .form-signin input[type="text"] {
- margin-bottom: -1px;
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
- border-top-style: solid;
- border-right-style: solid;
- border-bottom-style: none;
- border-left-style: solid;
- border-color: #000;
- }
- .form-signin input[type="password"] {
- margin-bottom: 10px;
- border-top-left-radius: 0;
- border-top-right-radius: 0;
- border-top-style: none;
- border-right-style: solid;
- border-bottom-style: solid;
- border-left-style: solid;
- border-color: #000;
- }
- .form-signin-heading {
- color: #81b71a;
- text-align: center;
- text-shadow: 0 0 4px #000000;
- }
- </style>
- <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
- <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div id="fullscreen_bg" class="fullscreen_bg"/>
- <div class="container">
- <form class="form-signin" method = "post">
- <h1 class="form-signin-heading text-muted">ShurSpotify</h1>
- <input type="text" class="form-control" placeholder="Usuario" required="user" autofocus="">
- <input type="password" class="form-control" placeholder="Contraseña" required="password">
- <button class="btn btn-lg btn-primary btn-block" type="submit">
- Entrar
- </button>
- </form>
- </div>
- <script type="text/javascript">
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement