PHP-LEE Posted November 14, 2011 Share Posted November 14, 2011 <?php session_start(); if(!session_is_registered(myusername)){ header("location:./default.php"); } ?> My session works fine but I am just wondering how I can echo the current sessions username? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/251109-help-with-session/ Share on other sites More sharing options...
joel24 Posted November 14, 2011 Share Posted November 14, 2011 bool session_is_registered ( string $name ) This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. use isset() and to echo, you would use echo $_SESSION['myusername']; Quote Link to comment https://forums.phpfreaks.com/topic/251109-help-with-session/#findComment-1287968 Share on other sites More sharing options...
cypher86 Posted November 14, 2011 Share Posted November 14, 2011 obiously you have to set it first wher you create the session. Quote Link to comment https://forums.phpfreaks.com/topic/251109-help-with-session/#findComment-1287971 Share on other sites More sharing options...
AyKay47 Posted November 14, 2011 Share Posted November 14, 2011 note: session_is_registered() is deprecated and should not be used. Quote Link to comment https://forums.phpfreaks.com/topic/251109-help-with-session/#findComment-1287976 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.