You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 140 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Need to detect username and if admin in custom module. [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
pejayuk
Nuke Cadet
Nuke Cadet


Joined: Dec 03, 2004
Posts: 6


PostPosted: Mon Aug 22, 2005 7:06 pm Reply with quoteBack to top

Hi,
I am creating a online user chat module for my phpnuke website and I need to do some things with the username. How do I get the username reliably in PHP.
I would also like to display admin options if the user is an admin. How do you detect this in PHP?.
Many thanks.
Find all posts by pejayukView user's profileSend private message
pejayuk
Nuke Cadet
Nuke Cadet


Joined: Dec 03, 2004
Posts: 6


PostPosted: Tue Aug 23, 2005 3:45 pm Reply with quoteBack to top

Here is an example I found of how to detect in a normal module if the user is admin.
global $admin;
if (is_admin($admin)){
echo "User is admin";
}
Find all posts by pejayukView user's profileSend private message
pejayuk
Nuke Cadet
Nuke Cadet


Joined: Dec 03, 2004
Posts: 6


PostPosted: Tue Aug 23, 2005 3:45 pm Reply with quoteBack to top

Here is an example I found that shows you how to get the users name.
<?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");
?>
Find all posts by pejayukView user's profileSend private message
MGCJerry
Elite Nuker
Elite Nuker


Joined: Jun 16, 2003
Posts: 220


PostPosted: Sun Oct 09, 2005 6:12 pm Reply with quoteBack to top

You don't need to do all that to get the username! Just use this... This should echo the username...

Code:

$userinfo = getusrinfo($user);
echo $userinfo[username];

_________________
Original creator of
* Fetch Mod
* RPG Races Module
* 2 The Xtreme Theme
Find all posts by MGCJerryView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.053 Seconds - 170 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::