mcrackin Posted June 10, 2013 Share Posted June 10, 2013 This is the error: Deprecated: Function session_is_registered() is deprecated in login_success.php on line 3Warning: Cannot modify header information - headers already sent by (output started at login_success.php:3) in login_success.php on line 4 This is the code I am using: <?php session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> <html> <body> Login Successful </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/279013-php-login-system-depreciation-error/ Share on other sites More sharing options...
rwhite35 Posted June 10, 2013 Share Posted June 10, 2013 Change session_is_registered to $_SESSION['myusername']. session_register, session_is_registered(), and session_unregister(). are all deprecated. To assign value to your session, use $_SESSION['myusername'] = "your string"; Quote Link to comment https://forums.phpfreaks.com/topic/279013-php-login-system-depreciation-error/#findComment-1435223 Share on other sites More sharing options...
mcrackin Posted June 10, 2013 Author Share Posted June 10, 2013 Thank you, works fine now. Quote Link to comment https://forums.phpfreaks.com/topic/279013-php-login-system-depreciation-error/#findComment-1435225 Share on other sites More sharing options...
AbraCadaver Posted June 11, 2013 Share Posted June 11, 2013 (edited) Well the purpose of session_is_registered() was to see if that session var was set. Use this: if(!isset($_SESSION['myusername'])){ header("location:main_login.php"); } Edited June 11, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/279013-php-login-system-depreciation-error/#findComment-1435260 Share on other sites More sharing options...
DavidAM Posted June 11, 2013 Share Posted June 11, 2013 Well the purpose of session_is_registered() was to see if that session var was set. Use this: if(!isset($_SESSION['myusername'])){ header("location:main_login.php"); } And always exit after a header redirect. if(!isset($_SESSION['myusername'])){ header("location:main_login.php"); exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/279013-php-login-system-depreciation-error/#findComment-1435423 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.