if (USER::login($_POST['username'], $_POST['password'])) { TPL::message("Perfect! You'll be redirected in 2 seconds..", "success"); redirect(isset($_GET['redirect']) ? urldecode($_GET['redirect']) : LINKS::get("admin_home"), 2); } else { switch (LOGS::get_error()['log_text']) { case "wrong_username": TPL::message("You entered a wrong username.."); break; case "wrong_password": TPL::message("You entered a wrong password.."); break; } } } // set render TPL::render("v_login/login"); break; /* * logout user */ /* * logout user */ case "logout": // sign out user USER::logout(); // redirect redirect(LINKS::get("admin_login")); break; } }
<?php require_once 'class.user.php'; require_once 'dbconfig.php'; require_once 'class.crud.php'; Session_start(); $user_login = new USER(); $user_login->logout();
<?php session_start(); require_once 'classes/class.user.php'; $user = new USER(); $user->logout(); $user->redirect('changepass.php');
<?php require_once 'php/session.php'; require_once 'php/user.php'; //new user object $user_logout = new USER($conn); //if user login has a session redirects to index if ($user_logout->loggedin() != "") { $user_logout->redirect('index'); } //if the session and url gets logout then logout and redirect if (isset($_GET['logout']) && $_GET['logout'] == "true") { $user_logout->logout(); $user_logout->redirect('index.php'); }