Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
doffer83
Worker
Worker


Joined: Apr 17, 2011
Posts: 117
Location: Amsterdam

PostPosted: Mon May 16, 2011 6:37 am Reply with quote

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
 
View user's profile Send private message Visit poster's website
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9456
Location: Arizona

PostPosted: Thu Dec 22, 2011 8:26 am Reply with quote

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! 
View user's profile Send private message Visit poster's website
fkelly
Former Moderator in Good Standing


Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Thu Dec 22, 2011 12:07 pm Reply with quote

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.
 
View user's profile Send private message Visit poster's website
montego
PostPosted: Fri Dec 23, 2011 9:35 am Reply with quote

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.
 
fkelly
PostPosted: Fri Dec 23, 2011 10:12 am Reply with quote

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.
 
montego
PostPosted: Mon Dec 26, 2011 12:08 pm Reply with quote

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.
 
fkelly
PostPosted: Tue Dec 27, 2011 1:44 pm Reply with quote

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 
montego
PostPosted: Thu Dec 29, 2011 7:03 am Reply with quote

fkelly, need to fix the url in the above post. Looks like the bbcode got mis-placed a bit. Thanks for separating this out.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous 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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©