Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang = "en">
- <head>
- <title>LogIn Form</title>
- </head>
- <body>
- <div>
- <form name = "signin" action = "ValidateSignIN.php" method="post">
- <div>
- <label for = "">User Name/Email ID:</label>
- <input type="text" name = "une"></input>
- </div>
- <div>
- <label for = "">Passowrd:</label>
- <input type="password" name="pswd"></input>
- </div>
- <div>
- <input type="submit" value = "SignIN"></input>
- <button type="reset">Clear</input>
- </div>
- </form>
- </div>
- </body>
- </html>
- -----------------------------------------------------PHP MySQL Page--------------------------------------------------------------
- //ValidateSignIN.php
- <!DOCTYPE html>
- <html>
- <head>
- <title>LogINReply</title>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "movies";
- $unameormail = $_POST["une"];
- $passwd = $_POST["pswd"];
- /*if($passwd === $cnfpasswd)
- {*/
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error)
- {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM users WHERE UNAMEORMAIL='$unameormail' AND PASSWORD='$passwd'";
- //Whenever I tried to execute the below code, it executes the else part. Though both username and password exist in the //database. Is this the right technique or I have to use something different.
- if ($conn->query($sql) === TRUE)
- {
- echo "<p>WELCOME</p>";
- }
- else
- {
- echo "Error updating record: " . $conn->error;
- }
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement