PDA

View Full Version : Protect Admin CP...


Chris M
06-24-2002, 10:22 AM
Ok...

I asked before, how do I protect the Admin CP from unauthorised Users?

I know about Cpanel Passwords, but I want to code the script to allow only userid=1 and userid=3 to be able to access it...

I tried several variations, but none work :

if ($bbuserinfo[userid]!=1) OR ($bbuserinfo[userid]!=3) {
show_nopermission();
exit;
}
if ($bbuserinfo[userid]!=1) {
show_nopermission();
exit;
}

if ($bbuserinfo[userid]!=3) {
show_nopermission();
exit;
}

What is the code that will only allow access to Userid=1 and Userid=3???

Satan

Chris M
06-24-2002, 11:33 AM
Anyone?

Satan

Admin
06-24-2002, 12:49 PM
Don't bump your post after an hour.

Chris M
06-24-2002, 05:17 PM
Ok Sorry...

But does anyone know?

Satan

Admin
06-24-2002, 05:23 PM
Why are you doing it after I told you not to?

Broekie
06-24-2002, 05:36 PM
Uhm, there's more than one hour between your post and his reply on that post FireFly :)

But uhm, hellsatan: did you try to place the code in admin/global.php, let's say, above require("./sessions.php");

Chris M
06-24-2002, 07:22 PM
No...

I never did...

Thanks...

I'll give it a try:)

Satan

Chris M
06-24-2002, 07:36 PM
Error :

Parse error: parse error in /home2/thelyceu/public_html/forum/admin/global.php on line 160

Fatal error: Call to undefined function: adminlog() in /home2/thelyceu/public_html/forum/admin/index.php on line 7

Satan

Broekie
06-24-2002, 08:26 PM
well, seems like it doesn't work ;)

I'm off to bed now, I'll let you know when I come up with an idea...

Chris M
06-24-2002, 08:31 PM
Thanks...:)

Enjoy your sleep!

Satan

Xenon
06-24-2002, 08:36 PM
Originally posted by hellsatan
if ($bbuserinfo[userid]!=1) {
show_nopermission();
exit;
}

if ($bbuserinfo[userid]!=3) {
show_nopermission();
exit;
}Satan

i hope you haven't used this code have ya?

if you use this code, no one would ever be able to acces to it ;)

scsa20
06-25-2002, 03:55 AM
try this:


if ($bbuserinfo['userid']!=1 or $bbuserinfo['userid']!=3)
{show_nopermission(); exit; }


right before or after (either one you like):


if ($action=="") {
adminlog();
}


in admin/index.php

I hope this helps ;)

Chris M
06-25-2002, 09:46 AM
Cool...

I'll try that thanks scsa20...

@Xenon - I did, thats why I asked here:)

Satan

Chris M
06-25-2002, 10:34 AM
That blocks access as well...

Satan

Admin
06-25-2002, 11:36 AM
Use AND instead of OR.

Chris M
06-25-2002, 03:58 PM
Thanks Chen...

Works perfectly!

Satan