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 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']; 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. 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. Link to comment https://forums.phpfreaks.com/topic/251109-help-with-session/#findComment-1287976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.