Advertisement
Guest User

Untitled

a guest
May 9th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.52 KB | None | 0 0
  1. <?php
  2.    include("config.php");
  3.    session_start();
  4.    
  5.    if($_SERVER["REQUEST_METHOD"] == "POST") {
  6.       // username and password sent from form
  7.      
  8.       $myusername = mysqli_real_escape_string($db,$_POST['username']);
  9.       $mypassword = mysqli_real_escape_string($db,$_POST['password']);
  10.      
  11.       $sql = "SELECT id FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";
  12.       $result = mysqli_query($db,$sql);
  13.       $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  14.       $active = $row['active'];
  15.      
  16.       $count = mysqli_num_rows($result);
  17.      
  18.       // If result matched $myusername and $mypassword, table row must be 1 row
  19.        
  20.       if($count == 1) {
  21.          session_register("myusername");
  22.          $_SESSION['login_user'] = $myusername;
  23.          
  24.          header("location: welcome.php");
  25.       }else {
  26.          $error = "Your Login Name or Password is invalid";
  27.       }
  28.    }
  29. ?>
  30.  
  31. <html lang="es">
  32. <head>
  33.     <meta charset="utf-8">
  34.     <title>ShurSpotify - Login</title>
  35.         <meta name="viewport" content="width=device-width, initial-scale=1">
  36.     <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
  37.     <style type="text/css">
  38.           body {
  39.     padding-top: 40px;
  40.     padding-bottom: 40px;
  41.     background-color: #eee;
  42.   }
  43.   .fullscreen_bg {
  44.     position: fixed;
  45.     top: 0;
  46.     right: 0;
  47.     bottom: 0;
  48.     left: 0;
  49.     background-size: cover;
  50.     background-position: 50% 50%;
  51.     background-image: url('/images/cover.jpg');
  52.   }
  53.   .form-signin {
  54.   position:absolute;  
  55.     top: 50%;  
  56.     left: 50%;  
  57.     width:15em;  
  58.     height:18em;  
  59.     margin-top: -7em; /*set to a negative number 1/2 of your height*/  
  60.     margin-left: -7em;
  61.   }
  62.   .form-signin .form-signin-heading, .form-signin {
  63.     margin-bottom: 10px;
  64.   }
  65.   .form-signin .form-control {
  66.     position: relative;
  67.     font-size: 16px;
  68.     height: auto;
  69.     padding: 10px;
  70.     -webkit-box-sizing: border-box;
  71.     -moz-box-sizing: border-box;
  72.     box-sizing: border-box;
  73.   }
  74.   .form-signin .form-control:focus {
  75.     z-index: 2;
  76.   }
  77.   .form-signin input[type="text"] {
  78.     margin-bottom: -1px;
  79.     border-bottom-left-radius: 0;
  80.     border-bottom-right-radius: 0;
  81.     border-top-style: solid;
  82.     border-right-style: solid;
  83.     border-bottom-style: none;
  84.     border-left-style: solid;
  85.     border-color: #000;
  86.   }
  87.   .form-signin input[type="password"] {
  88.     margin-bottom: 10px;
  89.     border-top-left-radius: 0;
  90.     border-top-right-radius: 0;
  91.     border-top-style: none;
  92.     border-right-style: solid;
  93.     border-bottom-style: solid;
  94.     border-left-style: solid;
  95.     border-color: #000;
  96.   }
  97.   .form-signin-heading {
  98.     color: #81b71a;
  99.     text-align: center;
  100.     text-shadow: 0 0 4px #000000;
  101.   }
  102.     </style>
  103.     <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
  104.     <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
  105. </head>
  106. <body>
  107. <div id="fullscreen_bg" class="fullscreen_bg"/>
  108.  
  109. <div class="container">
  110.  
  111.     <form class="form-signin" method = "post">
  112.         <h1 class="form-signin-heading text-muted">ShurSpotify</h1>
  113.         <input type="text" class="form-control" placeholder="Usuario" required="user" autofocus="">
  114.         <input type="password" class="form-control" placeholder="Contraseña" required="password">
  115.         <button class="btn btn-lg btn-primary btn-block" type="submit">
  116.             Entrar
  117.         </button>
  118.     </form>
  119.  
  120. </div>
  121. <script type="text/javascript">
  122.  
  123. </script>
  124. </body>
  125. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement