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> 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"; 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. 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 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"); } 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(); } 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
Archived
This topic is now archived and is closed to further replies.