Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- //connect to the database
- include('connect.php');
- //get details from html form
- $username = $_POST['username'];
- $password = $_POST['password'];
- //login to database
- $sql = "SELECT * FROM register WHERE username = '$username' and password = '$password'"; // select all products from the database
- $result = mysqli_query($conn,$sql); // run the query and store in an array $result
- $found = 0;
- while ($row = mysqli_fetch_array($result))
- {
- $found = 1;
- $username = $row[1];
- $password = $row[2];
- $usertype = $row[8];
- $email = $row[5];
- $_SESSION['email'] = $email;
- if
- ($usertype == 1)
- {
- echo "<p>Successfully Logged in!</p>";
- echo "<p>Admin granted</p>";
- echo "<a href='control.html'> Click here To Return</a>";
- }
- else
- {
- echo "<p>Logged in!</p>";
- echo "<a href='control.html'> Click here To Return</a>";
- }
- }
- if ($found==0)
- {
- echo "Invalid Login, Please return and try again, if the problem continues, please contact support.";
- }
- $conn->close();
- ?>
Add Comment
Please, Sign In to add comment