Log in

View Full Version : Debug info for specific userid?


djxcee
10-20-2008, 09:25 AM
I know I can add $config['Misc']['debug'] = true; in config.php but is there a way for me to make it viewable to specific userid? Just so I can see what's going on at all times ;).

Dismounted
10-20-2008, 10:36 AM
No, there is no practical way. The debug variable needs to be set before the database class is initialised, but you can't get the user ID before the database connection is established ;).

Well, you can, but the explain feature won't work.

Lynne
10-20-2008, 02:25 PM
I think you may be able to do it by IP, no?

if ($_SERVER["REMOTE_ADDR"] == "xxx.xxx.xxx.xxx") {
// enable debug mode for only my IP address
$config['Misc']['debug'] = true;
}

(I've never tried this.)

djxcee
10-20-2008, 05:45 PM
This looks like a great solution but unfortunately it's not working for me.

--------------- Added 1224530418 at 1224530418 ---------------

Very odd, it's working on one of my forum but not the other :confused:.

Thanks Lynne, will take a look around to see what's the problem.

Lynne
10-20-2008, 06:28 PM
I just tested it on my 3.7.3 board and it works just fine. You did put your correct ip addy in there, right?

djxcee
10-20-2008, 06:48 PM
Ah, the other forum wasn't working because of I accidently added the wrong IP...

Thank you, once again, Lynne :)

BTW, is it possible to add more then one ID address?

Lynne
10-20-2008, 07:16 PM
Ah, the other forum wasn't working because of I accidently added the wrong IP...

Thank you, once again, Lynne :)

BTW, is it possible to add more then one ID address?
I would guess you could just add an OR in there:
if ($_SERVER["REMOTE_ADDR"] == "xxx.xxx.xxx.xxx" OR $_SERVER["REMOTE_ADDR"] == "yyy.yyy.yyy.yyy") {
// enable debug mode for only some IPs
$config['Misc']['debug'] = true;
}

Dismounted
10-21-2008, 05:47 AM
$debugips = array(
'xxx.xxx.xxx.xxx',
'yyy.yyy.yyy.yyy'
);

if (in_array($_SERVER['REMOTE_ADDR'], $debugips))
{
$config['Misc']['debug'] = true;
}
Be aware that many people have dynamic IPs, meaning they change over time.

djxcee
10-21-2008, 05:55 AM
I am aware of that and installed a FF extension to show my IP at all times so I will be ok.

Thanks much Lynne & Dismounted, I really do appreciate it :D.