Clan Adverts

Sponsors

CT on Facebook

Latest Product

User Box

Anonymous
38.107.179.217
Nickname:

Password:

Security Code
Security Code
Type Security Code


PND Downloads Feed

Phpnuke Downloads
How to Delete or Reset yo...
How to Delete or Reset your PHPNuke Admin Account
Lost your admin password ?  Cant login to your admin account ? This s...
Back Online & Stuff
Back Online & Stuff
Look at us with our nifty website back up and running… Seriously...
How to edit the admins in...
How to edit the admins in the forums
Here is a way to make someone admin in your forums on your Evo site. I...
Demo Splash Screen
Demo Splash Screen
Ped @ Clan Themes has released a simple splash screen entrance hack. ...
Free Phpnuke Business The...
Free Phpnuke Business Theme 6
This is the 6th Business theme for Phpnuke that Clan Themes has releas...
Tricked Out Slider
Tricked Out Slider
We have seen some great new things come out of Tricked Out News and th...

Custom Work

PHP Nuke Custom Work

www.clanthemes.com :: View topic - Detect superadmin in module
Detect superadmin in module

9 Replies / 1188 Views


Post new topic   Reply to topic  

   www.clanthemes.com Forum Index » Modules

View previous topic :: View next topic


cupoftea
Reputation: 21.7 Add RepSubtract Rep
Local time: 5:16 PM
Location: Behind My Computer
belgium.gif

Spammer
Spammer

0.08 posts per day
Medals: 0

Joined: Apr 30, 2008
Last Visit: 14 Mar 2009
Posts: 113
Points: 2379 

Post Detect superadmin in module Posted: Fri Jan 23, 2009 8:20 pm

Hey guys,

How do I detect in a normal module file if the user is superadmin? I already tried this (by taking a look at the admin.php file):
Code:
// Getting Super Admin Info From DB
   global $aid, $admingraphic, $language, $admin, $prefix, $db, $counter, $admin_file;
   $newsubs = $db->sql_numrows($db->sql_query("SELECT qid FROM ".$prefix."_queue"));
   $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
   $radminsuper = intval($row['radminsuper']);
// Done


$radminsuper should give 0 or 1.

Thx,
 

Grtz, CupOfTea --- My Nuke Version: 8.0 Patched 3.5 ---  
View user's profileSend private messageSend e-mailVisit poster's websiteMSN Messenger Reply with quote

floppy
Reputation: 2088.8 Add RepSubtract Rep
votes: 22
Local time: 11:16 AM
Location: Jackson Mississippi
usa.gif

Site Admin
Site Admin

1.16 posts per day
Medals: 2 (View more...)
Dedication (Amount: 1)
Scripts/Coder
Scripts/Coder
Joined: Nov 14, 2006
Last Visit: 03 May 2012
Posts: 2353
Points: 132516 

Post Re: Detect superadmin in module Posted: Fri Jan 23, 2009 8:28 pm

Shop Purchases:
Clan Roster 2.0 · Multi Gaming (Warrior) Evo Theme · COD6 ModernWarfare 2 Teaser Splash Screen · Left for Dead Evo Extreme Version

You can detect any type of admin fairly easy, but not sure if you can identify superadmins easily.

It requires two steps

1st)The $admin variable must be in the globals of the file or function
Code:
global $db, $prefix, $admin;


Then you can use it in an if statement like so
Code:
if(is_admin($admin)){
echo 'I am admin wuwu';
}


Hope it helps.
 

Phpnuke Downloads | VMaxxRx Male Enhancement  
View user's profileSend private messageVisit poster's website Reply with quote

Untergang
Reputation: 642.5 Add RepSubtract Rep
votes: 6
Local time: 5:16 PM
Location: Lommel
belgium.gif

Stand-by Stand-by
Stand-by Stand-by

0.19 posts per day
Medals: 0

Joined: May 08, 2007
Last Visit: 31 Oct 2011
Posts: 346
Points: 22131 

Post Re: Detect superadmin in module Posted: Sat Jan 24, 2009 12:16 am

I think I saw is_god($admin) in the latest ravennuke, in the nuke sentinel files it's used quite a lot.
 

UDesigns.be  
View user's profileSend private messageSend e-mailVisit poster's website Reply with quote


floppy
Reputation: 2088.8 Add RepSubtract Rep
votes: 22
Local time: 11:16 AM
Location: Jackson Mississippi
usa.gif

Site Admin
Site Admin

1.16 posts per day
Medals: 2 (View more...)
Super Dedicated User (Amount: 1)
Scripts/Coder
Scripts/Coder
Joined: Nov 14, 2006
Last Visit: 03 May 2012
Posts: 2353
Points: 132516 

Post Re: Detect superadmin in module Posted: Sat Jan 24, 2009 12:17 am

Shop Purchases:
Clan Roster 2.0 · Multi Gaming (Warrior) Evo Theme · COD6 ModernWarfare 2 Teaser Splash Screen · Left for Dead Evo Extreme Version

Untergang wrote:
I think I saw is_god($admin) in the latest ravennuke, in the nuke sentinel files it's used quite a lot.


Now that you mention it I think I have seen that before. I just never had much use for such.
 

 
View user's profileSend private messageVisit poster's website Reply with quote

floppy
Reputation: 2088.8 Add RepSubtract Rep
votes: 22
Local time: 11:16 AM
Location: Jackson Mississippi
usa.gif

Site Admin
Site Admin

1.16 posts per day
Medals: 2 (View more...)
Super Dedicated User (Amount: 1)
Scripts/Coder
Scripts/Coder
Joined: Nov 14, 2006
Last Visit: 03 May 2012
Posts: 2353
Points: 132516 

Post Re: Detect superadmin in module Posted: Sat Jan 24, 2009 12:23 am

Shop Purchases:
Clan Roster 2.0 · Multi Gaming (Warrior) Evo Theme · COD6 ModernWarfare 2 Teaser Splash Screen · Left for Dead Evo Extreme Version

Turns out is_god is a function from nukesentinel.php, so this would only work if you have nukesentinel installed.

Code:
if(is_god($_COOKIE['admin'])){
echo 'I am god';
}


The actual function is as follows
Code:
function is_god($axadmin) {
  global $db, $prefix, $aname;
  $tmpadm = st_clean_string(base64_decode($axadmin));
  if (preg_match(REGEX_UNION, $tmpadm)) { block_ip($blocker_array[1]); }
  if (preg_match(REGEX_UNION, base64_decode($tmpadm))) { block_ip($blocker_array[1]); }
  $tmpadm = explode(":", $tmpadm);
  $aname = addslashes($tmpadm[0]);
  $apwd = addslashes($tmpadm[1]);
  if(!empty($aname) AND !empty($apwd)) {
    $aname = addslashes(trim($aname));
    $apwd = trim($apwd);
    $admrow = $db->sql_fetchrow($db->sql_query("SELECT * FROM `".$prefix."_authors` WHERE `aid`='$aname'"));
    //if((strtolower($admrow['name']) == "god" OR $admrow['radminsuper'] == 1) AND $admrow['pwd']==$apwd) { return 1; }
    if(strtolower($admrow['name']) == "god" AND $admrow['pwd']==$apwd) { return 1; }
  }
  return 0;
}


It might work.
 

 
View user's profileSend private messageVisit poster's website Reply with quote

cupoftea
Reputation: 21.7 Add RepSubtract Rep
Local time: 5:16 PM
Location: Behind My Computer
belgium.gif

Spammer
Spammer

0.08 posts per day
Medals: 0

Joined: Apr 30, 2008
Last Visit: 14 Mar 2009
Posts: 113
Points: 2379 

Post Detect superadmin in module Posted: Sun Jan 25, 2009 10:37 am

I didn't have to put the function in my file did I?

It seems to work, when I'm logged out as admin, I can't see the part that should be visible for superadmin only so I guess it works.

Question, does it work for phpnuke sites that don't have nukesentinel installed?
 

 
View user's profileSend private messageSend e-mailVisit poster's websiteMSN Messenger Reply with quote


floppy
Reputation: 2088.8 Add RepSubtract Rep
votes: 22
Local time: 11:16 AM
Location: Jackson Mississippi
usa.gif

Site Admin
Site Admin

1.16 posts per day
Medals: 2 (View more...)
Super Dedicated User (Amount: 1)
Scripts/Coder
Scripts/Coder
Joined: Nov 14, 2006
Last Visit: 03 May 2012
Posts: 2353
Points: 132516 

Post Re: Detect superadmin in module Posted: Sun Jan 25, 2009 3:58 pm

Shop Purchases:
Clan Roster 2.0 · Multi Gaming (Warrior) Evo Theme · COD6 ModernWarfare 2 Teaser Splash Screen · Left for Dead Evo Extreme Version

is_god will not work, but is_admin will
 

 
View user's profileSend private messageVisit poster's website Reply with quote

cupoftea
Reputation: 21.7 Add RepSubtract Rep
Local time: 5:16 PM
Location: Behind My Computer
belgium.gif

Spammer
Spammer

0.08 posts per day
Medals: 0

Joined: Apr 30, 2008
Last Visit: 14 Mar 2009
Posts: 113
Points: 2379 

Post Detect superadmin in module Posted: Mon Jan 26, 2009 7:05 pm

So for non-NukeSentinel Users I should add this function
Code:
function is_god($axadmin) {
  global $db, $prefix, $aname;
  $tmpadm = st_clean_string(base64_decode($axadmin));
  if (preg_match(REGEX_UNION, $tmpadm)) { block_ip($blocker_array[1]); }
  if (preg_match(REGEX_UNION, base64_decode($tmpadm))) { block_ip($blocker_array[1]); }
  $tmpadm = explode(":", $tmpadm);
  $aname = addslashes($tmpadm[0]);
  $apwd = addslashes($tmpadm[1]);
  if(!empty($aname) AND !empty($apwd)) {
    $aname = addslashes(trim($aname));
    $apwd = trim($apwd);
    $admrow = $db->sql_fetchrow($db->sql_query("SELECT * FROM `".$prefix."_authors` WHERE `aid`='$aname'"));
    //if((strtolower($admrow['name']) == "god" OR $admrow['radminsuper'] == 1) AND $admrow['pwd']==$apwd) { return 1; }
    if(strtolower($admrow['name']) == "god" AND $admrow['pwd']==$apwd) { return 1; }
  }
  return 0;
}

But where do I have to put it? Or doesn't that matter?
 

 
View user's profileSend private messageSend e-mailVisit poster's websiteMSN Messenger Reply with quote

floppy
Reputation: 2088.8 Add RepSubtract Rep
votes: 22
Local time: 11:16 AM
Location: Jackson Mississippi
usa.gif

Site Admin
Site Admin

1.16 posts per day
Medals: 2 (View more...)
Super Dedicated User (Amount: 1)
Scripts/Coder
Scripts/Coder
Joined: Nov 14, 2006
Last Visit: 03 May 2012
Posts: 2353
Points: 132516 

Post Re: Detect superadmin in module Posted: Mon Jan 26, 2009 11:27 pm

Shop Purchases:
Clan Roster 2.0 · Multi Gaming (Warrior) Evo Theme · COD6 ModernWarfare 2 Teaser Splash Screen · Left for Dead Evo Extreme Version

if you add that function and some one has sentinel it will produce an error. If you plan for others to use the script you going to have to use the nuke core function is_admin.
 

 
View user's profileSend private messageVisit poster's website Reply with quote


cupoftea
Reputation: 21.7 Add RepSubtract Rep
Local time: 5:16 PM
Location: Behind My Computer
belgium.gif

Spammer
Spammer

0.08 posts per day
Medals: 0

Joined: Apr 30, 2008
Last Visit: 14 Mar 2009
Posts: 113
Points: 2379 

Post Detect superadmin in module Posted: Tue Jan 27, 2009 3:38 pm

Yeah, but if i include the possibility to add the function an make clear Non-Sentinel users have to use it in the readme it'll be all right
 

 
View user's profileSend private messageSend e-mailVisit poster's websiteMSN Messenger Reply with quote
Post new topic   Reply to topic  
   www.clanthemes.com Forum Index » Modules


 
9 Replies / 1188 Views
Page 1 of 1
All times are GMT
Display posts from previous:   
 
Jump to:  
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 cannot attach files in this forum
You can download files in this forum