Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("config.php");
- // Processing form data when form is submitted
- if($_SERVER["REQUEST_METHOD"] == "POST") {
- $username = $_POST['username'];
- $password = $_POST['password']);
- $query = "SELECT id FROM users WHERE username = $username and password = $password";
- $result = mysqli_query($db,$query);
- $count = mysqli_num_rows($result);
- if($count == 1) { //If the posted values are equal to the database values, then session will be created for the user
- session_start();
- $_SESSION['login_user'] = $username;
- header("location: member.php");
- }
- else {
- echo "Invalid username or password";
- }
- }else{
- echo "Form not being posted";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement