How to find the user name in a module

27.10. How to find the user name in a module

If you want to greet the user personally, if registered, from your own home-made module, here is the code that does it in PHP-Nuke (see Getting username in PHP script):

<?php
if (!isset($mainfile)) {include("mainfile.php"); }
include ("header.php");
if(!is_array($user)) {
  $user_get = base64_decode($user);
  $user_get = explode(":", $user_get);
  $user_name = "$user_get[1]";
} else {
  $user_name = "$user[1]";
}
if($user_name == "") {$user_name="Anonymous";}
echo "Welcome, $user_name";
include ("footer.php");
?>
 

Site Info v2.2.2

Last SeenLast Seen
  • neralex
  • FireATST
Server TrafficServer Traffic
  • Total: 379,200,741
  • Today: 4,451
Server InfoServer Info
  • Mar 25, 2019
  • 02:15 am CET