Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- if (!empty($_POST)) {
- $servername = "localhost";
- $username1 = "dxa6145";
- $password1 = "hawaiisomeone";
- $dbname = "dxa6145";
- $username = $_POST['username'];
- $password = $_POST['password'];
- echo $username;
- echo $password;
- echo "000";
- $conn = new mysqli($servername, $username1, $password1, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- echo $username;
- echo $password;
- echo "111";
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- if (isset($_POST['username']) && isset($_POST['password'])) {
- $sql = "SELECT username FROM users WHERE username=" . $username . " AND password=MD5(" . $password . ")";
- echo "232";
- $result = $conn->query($sql);
- echo "222";
- if ($result->num_rows > 0) {
- echo "333";
- while ($row = $result->fetch_assoc()) {
- echo "Welcome " . $row["username"];
- }
- } else {
- echo "0 results";
- }
- }
- }
- }
- ?>
- <form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" name="form" novalidate>
- <fieldset>
- <legend>Login</legend>
- <br>Username: <input type="text" name="username">
- <br>Password: <input type="password" name="password">
- <input type="submit" value="Submit">
- </fieldset>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement