Author |
Message |
TheShniz
Regular


Joined: Jan 27, 2004
Posts: 65
|
Posted:
Wed Jun 02, 2004 11:27 am |
|
Perhaps this is the wrong forum, pleaz correct/move if so... but I'm trying 2 write a Module and I need 2 know the Username/UserID of the person viewing the Module. ie.) I'd like it taylored 2 that person, so I need 2 find out who it is. I've gone through a coup other Modules 2 C what others have done but didn't really come up w/ anything definitive. Can some1 offer some direction?
Thanx,
> TheShniz |
|
|
|
 |
mikem
New Member


Joined: Sep 23, 2003
Posts: 15
|
Posted:
Wed Jun 02, 2004 1:07 pm |
|
The Your_Account module checks the users table to verify if a user is Anonymous or registered and who they are logged as.
You are better off looking at a block's code that does this.
For instance, the code for the User_Info block is good to look at in order to find the code you need to query the users.
mikem |
|
|
|
 |
TheShniz

|
Posted:
Wed Jun 02, 2004 1:43 pm |
|
Yeah, I agree, that's what I've been doing... just not very familiar w/ all the variables & functions these filez R calling
Really just taking a shot in the dark. Is this all that's required (a guess)?
global $user, $cookie
cookiedecode($user);
$uname = $cookie[1];
My objective is 2 do this:
select * from whatever where username = $uname
Thanx,
> TheShniz |
|
|
|
 |
mikem

|
Posted:
Wed Jun 02, 2004 2:15 pm |
|
Yes, that is some required code
Code:global $user, $db, $cookie, $prefix
getusrinfo( $user );
cookiedecode( $user );
|
|
|
|
|
 |
TheShniz

|
Posted:
Wed Jun 02, 2004 2:53 pm |
|
Quick recap just 2 make sure, this is all I need 2 do:
global $user, $db, $cookie, $prefix
getusrinfo( $user );
cookiedecode( $user );
in order 2 access this:
select * from whatever where username = $user
Thanx!
> TheShniz |
|
|
|
 |
TheShniz

|
Posted:
Thu Jun 03, 2004 10:14 am |
|
Ok, tried it out... when I echo $user, I get:
MjpUaGVTaG5pejo2NjI2ZDFhY2ZlNjg1MTA5MWQzZTYxOTFiZjRkMGEzMjoxMDo6MDowOjA6MDo6NDA5Ng==
I'm gonna try using $uname this time w/ the $uname = $cookie[1];
Trial & Error Help!
> TheShniz |
|
|
|
 |
TheShniz

|
Posted:
Thu Jun 03, 2004 10:31 am |
|
Eureka, it worx! Ok, I'm happy now I just needed 2 use $uname instead of $user. Here's what I did:
global $user, $db, $cookie, $prefix
getusrinfo( $user );
cookiedecode( $user );
$uname = $cookie[1];
select * from whatever where username = $uname
I think I'm gonna have 2 sit down w/ the Cookie Decode function & C what other usable goodies R in there
Thanx,
> TheShniz |
|
|
|
 |
|