<?php
session_start();
include 'db_connect.php'; // your database connection

if(isset($_POST['email']) && isset($_POST['password'])){
    $email = $con->real_escape_string($_POST['email']);
    $password = $con->real_escape_string($_POST['password']);

    // Check user in database
    $sql = "SELECT * FROM amul_registration WHERE email='$email' AND password='$password' LIMIT 1";
    $result = $con->query($sql);

    if($result->num_rows > 0){
        $user = $result->fetch_assoc();
        $_SESSION['user_id'] = $user['id'];
        $_SESSION['email'] = $user['email'];
        echo 'success';
    } else {
        echo 'Invalid email or password';
    }
} else {
    echo 'Please enter email and password';
}
?>
