<?php
// Define valid credentials and their redirect URLs
$validCredentials = [
    'enter@enter.com' => [
        'password' => 'General',
        'redirect' => 'As.html'
    ],
    'user2@example.com' => [
        'password' => 'securepass456',
        'redirect' => 'user2_welcome.php'
    ],
    'admin@example.com' => [
        'password' => 'admin1234',
        'redirect' => 'admin_panel.php'
    ]
];

// Get submitted email and password
$email = $_POST['email'] ?? '';
$password = $_POST['password'] ?? '';

// Check if credentials are valid
if (array_key_exists($email, $validCredentials)) {
    if ($password === $validCredentials[$email]['password']) {
        // Valid credentials - redirect
        header('Location: ' . $validCredentials[$email]['redirect']);
        exit();
    } else {
        // Invalid password
        die('Invalid password. <a href="login.html">Try again</a>');
    }
} else {
    // Email not found
    die('Email not recognized. <a href="login.html">Try again</a>');
}
?>