Redirecting from Admin page if not logged in... Redirecting from Admin page if not logged in...
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Redirecting from Admin page if not logged in...

Started by fatmcgav, March 15, 2007, 03:41:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fatmcgav

Hi there,

This is prob simple to do, but i cant for the life of me work it out.
What i want to be able to do is have the admin page redirect anybody who isnt logged in to the login page.
This is because i've removed the login.php link as the site's locked down, and i want admins to still be able to login to the site easily.

Any info appreicated.

Cheers
Fatmcgav

Sami

You can edit admin.php :

go to line 45 and change this:


if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);


with this


//if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); // Comment for redirecting
if (!GALLERY_ADMIN_MODE) header("Location: http://" . $_SERVER['HTTP_HOST']. dirname($ORIGINAL_PHP_SELF). "/login.php") ;


It should work ;)
‍I don't answer to PM with support question
Please post your issue to related board

fatmcgav

Sweet, that worked a treat.
Made one slight tweak to it, to add a referer onto the login.php link so that it will automatically go back through to the admin page once logged in.

Many thanks.

Cheers
Quote from: Sami on March 16, 2007, 08:33:02 AM
You can edit admin.php :

go to line 45 and change this:


if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);


with this


//if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); // Comment for redirecting
if (!GALLERY_ADMIN_MODE) header("Location: http://" . $_SERVER['HTTP_HOST']. dirname($ORIGINAL_PHP_SELF). "/login.php") ;


It should work ;)