Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "config.php";
- $Username = $_POST['username'];
- $result1 = mysqli_query($conn, "SELECT * FROM information WHERE username = '".$Username."'");
- if(mysqli_num_rows($result1) == 0)
- {
- ?>
- <script type="text/javascript">
- alert("The Account name doesn't exist!");
- </script>
- <?php
- header("Location: http://localhost:8012/FinalProject/LoginPage.html");
- }
- else
- {
- $Password = $_POST['password'];
- $result2 = mysqli_query($conn, "SELECT * FROM information WHERE password = '".$Password."'");
- if(mysqli_num_rows($result2) == 0)
- {
- ?>
- <script type="text/javascript">
- alert("The password is not correct!");
- </script>
- <?php
- header("Location: http://localhost:8012/FinalProject/LoginPage.html");
- }
- else
- {
- $command = "TRUNCATE TABLE usernameholder";
- $result = $conn->query($command);
- $sql = "INSERT into usernameholder (username) VALUES ('" . $Username . "')";
- $result = $conn->query($sql);
- echo "You have successfully logged in!";
- header("Location: http://localhost:8012/FinalProject/AlbumPage.php");
- }
- }
- $conn->close();
- ?>
Add Comment
Please, Sign In to add comment