Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $db = "paptest";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $db);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // echo "Connected successfully";
- $user = $_POST['Nome'];
- $pass = $_POST['Pass'];
- // echo "Nome: " . $user;
- // echo "Pass: " . $pass;
- $mysqli = new mysqli($servername, $username, $password, $db);
- $result = $mysqli->query("SELECT User FROM alunos WHERE User ='$user'");
- if($result->num_rows == 0) {
- echo "Pass ou User invalido";
- } else {
- echo "Boa";
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <center>
- <div style="padding-top: 14%">
- <form method="POST">
- <div>
- <label>Nome</label>
- <input type="Text" name="Nome">
- </div>
- <div style="margin-top: 1%">
- <label>Password</label>
- <input type="Password" name="Pass">
- </div>
- <input type="submit" name="Login" style="margin-top: 1%">
- <input type="reset" name="Login" style="margin-top: 1%">
- </form>
- </div>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement