php - Re-directing to certain page if logged in -
i have main page has log in link on takes user login page. however, if user logged in want take user page, example info page. i have function: function logged_in_redirect() { if (logged_in() === true) { header('location: client.php'); exit(); } } i'm wondering put this? i've tried pretty everything. if put on login page, not redirect me when logged on. i've tried adding onclick function link on home page didn't work. this logged_in() function: function logged_in() { return (isset($_session['user_id'])) ? true : false; } any suggestions? edit: i have fixed problem making button on home page link test.php file has code: <?php include 'core/init.php'; if (isset($_session["user_id"])) { header('location: client.php'); } else { header('location: info.php'); } ?> is there way around this? if session set , user authenticated work. you don't need function check wheth...