Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(!isset($_SESSION["id"]) || !isset($_SESSION["username"])){
- }else{
- header("Location: painel.php");
- }
- if(isset($_POST['login'])){
- require("/data/config.inc.php");
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- $username = stripslashes($username);
- $password = stripslashes($password);
- $username = mysqli_real_escape_string($db, $username);
- $password = mysqli_real_escape_string($db, $password);
- $password = md5($password);
- $sql = "SELECT * FROM usuarios WHERE username = '$username' LIMIT 1";
- $query = mysqli_query($db, $sql);
- $row = mysqli_fetch_array($query);
- $id = $row['id'];
- $db_password = $row['password'];
- if($password = $db_password){
- $_SESSION['username'] = $username;
- $_SESSION['id'] = $id;
- header("Location: painel.php");
- }else{
- echo 'Usuario ou senha incorretos';
- }
- }
- ?>
- <html>
- <head>
- <title> Login Pluz VS</title>
- <meta charset="UTF-8">
- </head>
- <body>
- <form action="" method="post" enctype="multipart/form-data">
- <input placeholder="Usuario" name="username" type="text">
- <input placeholder="Senha" name="password" type="password">
- <input value="Login" name="login" type="submit">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement