Posted on: 01/03/04 05:41am
By: cmdrkettch
First of all, let me say that I'm sort of new to Geeklog and PHP. But for a project of mine, I need to be able to grab the username of the user browsing a page and display the corresponding user id. For example, if Bob views the page, it would display Bob's uid and if John views the page, it would display John's uid. Kind of like at the top of this page, where it says "Welcome to Geeklog, username" except one step further. How would I approach this? Could anyone provide some sample code?
Re:Grabbing Usernames
Posted on: 01/03/04 06:03am
By: Dirk
Simply check the global variable $_USER['uid']. If it is not empty and contains a value > 1 then that is the user id of the current user.
Anonymous users have a user id of 1 ($_USER['uid'] may also be empty for anonymous users).
bye, Dirk