1

Topic: Trying to make an undercover Admin

Hi!
I've followed the instructions from here

added the following:

 if($pun_user['id'] == 3)
$pun_user['g_id'] = PUN_ADMIN;

to /include/common.php right after line 118 (or something)

 // Check/update/set cookie and fetch user info
119     $pun_user = array();

I looked in db table users and found that id of the user that i want to be admin is 3.

But it isn't working. why?

Re: Trying to make an undercover Admin

$pun_user['g_id'] = PUN_ADMIN;

This should be:

$pun_user['g_id'] == PUN_ADMIN;

3

Re: Trying to make an undercover Admin

But = is the assignment operator and == is comparison operator, so your code should just return boolean value.

I'm not even sure that the condition evaluates to TRUE and this statement runs. I just don't know how to check this.

Or should i use $ prefix before PUN_ADMIN ?

Re: Trying to make an undercover Admin

Ant wrote:

Or should i use $ prefix before PUN_ADMIN ?

Surely not. I don't know about the rest

5

Re: Trying to make an undercover Admin

Ok, don't know exactly why, but let it be without $.

Anyway, any ideas how to make undercover admin work?

Re: Trying to make an undercover Admin

It should work just fine. What mods do you have installed?

7

Re: Trying to make an undercover Admin

Hi, elbekko!

Absolutely no mods, just clean PunBB 1.2.15 install.

So. am I inserting the right code in the right place and it still doesn't work!?

Re: Trying to make an undercover Admin

You should be doing it right =/ May I remind you: this will nowhere show up, except for the admin interface the user himself sees.

9 (edited by Ant 2007-04-26 21:23)

Re: Trying to make an undercover Admin

>>> May I remind you: this will nowhere show up, except for the admin interface the user himself sees.

I, understand this, after all that's undercover admin smile

But when logged in under that account, I cant access admin_options.php or edit messages of other users, i.e. no sign of admin privileges at all sad

 if($pun_user['id'] == 3)
$pun_user['g_id'] = PUN_ADMIN

Guess I need to check that this condition evaluates to TRUE and the statement where g_id changes executes. How can this be done? php syntax seems a little bit strange to me smile

Re: Trying to make an undercover Admin

Ah, I found the error. You should put it after this line:

check_cookie($pun_user);

11

Re: Trying to make an undercover Admin

But it is after sad

here's that snippet of common.php

 // Check/update/set cookie and fetch user info
$pun_user = array();
check_cookie($pun_user);

if($pun_user['id'] == 3)
 $pun_user['g_id'] = PUN_ADMIN;

// Attempt to load the common language file

Looks like there is some stupid mistake, that I can't see...
Any advices?

Re: Trying to make an undercover Admin

Just to be sure, are you logged in as the user with ID 3? wink

Re: Trying to make an undercover Admin

Well, I tested it yesterday on a fresh 1.2.15 install, and it worked just fine. So indeed, check what Smartys said.