Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "LoginDB";
- $fName = $_POST["fName"];
- $fPsw = $_POST["fPsw"];
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM `data` WHERE Name =".$fName."LIMIT 1";
- $result = $conn->query($sql);
- $row = $result->fetch_assoc();
- if ($result->num_rows > 0 && $row["Password"] == $fPsw) {
- echo "Hello ".$row["Role"]." ". $row["Name"];
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement