Exemplo n.º 1
0
function public_login()
{
    $p_user = new PublicUser();
    global $main_db, $session;
    if (isset($_POST['login_submit'])) {
        $login = false;
        if ($_POST['email'] != '') {
            if ($user = $p_user->loged_in($_POST['email'], $_POST['password'])) {
                $_SESSION['p_user'] = $user->id;
            }
        } else {
            if ($user = $p_user->loged_in($_POST['mobile'], $_POST['password'], 'mobile')) {
                $_SESSION['p_user'] = $user->id;
            }
        }
        if (isset($_SESSION['p_user'])) {
            safe_redirect(get_home_url() . '/user-admin.php');
        } else {
            $session->message('* The username or password you entered was incorrect !' . $main_db->last_query);
            safe_redirect(get_home_url() . '/login.php');
        }
    }
}