Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="form-group">
- <form name="" id="loginForm" action="checklogin.php" method="POST" enctype="multipart/form-data">
- <div class="form-group has-feedback">
- <!----- username -------------->
- <input class="form-control" placeholder="Username" id="username" type="text" autocomplete="off" name="username" />
- <span style="display:none;font-weight:bold; position:absolute;color: red;position: absolute;padding:4px;font-size: 11px;background-color:rgba(128, 128, 128, 0.26);z-index: 17; right: 27px; top: 5px;" id="span_loginid"></span>
- <!---Alredy exists ! -->
- <span class="glyphicon glyphicon-user form-control-feedback"></span>
- </div>
- <div class="form-group has-feedback">
- <!----- password -------------->
- <input class="form-control" placeholder="Password" id="password" type="password" autocomplete="off" name="password" />
- <span style="display:none;font-weight:bold; position:absolute;color: grey;position: absolute;padding:4px;font-size: 11px;background-color:rgba(128, 128, 128, 0.26);z-index: 17; right: 27px; top: 5px;" id="span_password"></span>
- <!---Alredy exists ! -->
- <span class="glyphicon glyphicon-lock form-control-feedback"></span>
- </div>
- <div class="row">
- <div class="col-xs-12">
- <div class="checkbox icheck">
- <label>
- <input type="checkbox" id="loginrem" > Remember Me
- </label>
- </div>
- </div>
- <div class="col-xs-12">
- <button type="submit" class="btn btn-green btn-block btn-flat" onclick="userlogin()">Ingresar</button>
- </div>
- </div>
- </form>
- </div>
- <?php session_start(); ?>
- <?php
- include 'conexion.php';
- $username = $_POST["username"];
- $password = $_POST["password"];
- $sql = "SELECT * FROM administrador WHERE nombre_admin = '$username'";
- $result = $conexion->query($sql);
- if ($result->num_rows > 0) {
- }
- $row = $result->fetch_array(MYSQLI_ASSOC);
- if (password_verify($password, $row["password"])) {
- $_SESSION['loggedin'] = true;
- $_SESSION['username'] = $username;
- $_SESSION['start'] = time();
- $_SESSION['expire'] = $_SESSION['start'] + (5 * 60);
- echo "Bienvenido! " . $_SESSION['username'];
- echo "<br><br><a href=panel-control.php>Panel de Control</a>";
- } else {
- echo "Username o Password estan incorrectos.";
- echo "<br><a href='index.php'>Volver a Intentarlo</a>";
- }
- mysqli_close($conexion);
- ?>
Add Comment
Please, Sign In to add comment