Author |
Message |
doffer83
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/d5c522c25233365e6b83d.jpg)
Joined: Apr 17, 2011
Posts: 117
Location: Amsterdam
|
Posted:
Mon May 16, 2011 6:37 am |
|
Hallo Folks,
I have a nuke site with 3 admin wich can acces the cp. I am trying to write a simple code to show the logged in admins in the cp when (me as) a God admin is accesed the admin.php
I use the next code and I count on your help please
Code:global $admin;
if(!is_array($admin)) {
$admin_name = base64_decode($admin);
$admin_name = explode(":", $admin_name);
$admin_name = "$admin_name[0]";
} else {
$admin_name = "$admin[0]";
}
if($admin_name != "Johne") {
echo" johne is online";
}
|
Johne is the admin name of the second admin..
any help is appreciated |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Thu Dec 22, 2011 8:26 am |
|
Unfortunately, there is no separate session table for admins. Sessions are only maintained for regular Your Account type logins, so there is really no reliable way of doing this without adding some type of session table/handling for just admins. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
fkelly
Former Moderator in Good Standing
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY
|
Posted:
Thu Dec 22, 2011 12:07 pm |
|
I'm not sure if this would accomplish your purposes but:
- you have a list of usernames in your usertable
- standard RN blocks can tell you who is logged in (which usernames) code for this for instance is in the block-User_info
- now you also have an authors table with author names
- the question is, how did you set these up. IF the author (admin) names correspond on a one for one basis with usernames in the usertable then you could do a simple lookup. Search the authors table for each logged in username (from the WHOIS block) and if that user is in the authors table you know that admin is logged in.
If, for the same people, you have different author names it will not be so simple. But you could still "hardcode" the search, assuming we are talking about a small and not frequently changing set. If X is the username and Y is his name in the authors table you'd just code the SQL to say that if X is logged in look up Y.
If that makes any sense. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Dec 23, 2011 9:35 am |
|
Actually, fkelly, this will only work if the admin (logged in through admin.php) as well as logged in as a regular user (logged in through Your Account), which is the point I was trying to make above.
I will often times log in as just admin if I'm doing just an admin chore and my regular user login has already expired. I only need to log in as a regular user if I need to make a post to the forums. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
fkelly
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Dec 23, 2011 10:12 am |
|
Yes you are right in that case M. In my situation I am pretty sure that my admins always log in as normal users first. Actually the system would work better if administrative privileges could be associated with a normal username ... perhaps by membership in a group. I published a hack a while ago to automatically sign in a user who has administrative privileges in but that won't work in some cases and could cause security problems in others. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 26, 2011 12:08 pm |
|
fkelly wrote: | Actually the system would work better if administrative privileges could be associated with a normal username |
Completely agree with you. The whole separate admin user needs to be done away with. It wouldn't be that difficult. Create a new core system group for Administrators in Groups and change around the admin log in code (which is mostly function driven anyways, to use that instead. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
fkelly
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Dec 27, 2011 1:44 pm |
|
Quote: | . The whole separate admin user needs to be done away with. It wouldn't be that difficult. |
Rather than hijack this thread, see instead:
Only registered users can see links on this board! Get registered or login! |
Last edited by fkelly on Thu Dec 29, 2011 7:42 am; edited 1 time in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Dec 29, 2011 7:03 am |
|
fkelly, need to fix the url in the above post. Looks like the bbcode got mis-placed a bit. Thanks for separating this out. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|