Set admin cookie Set admin cookie
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Set admin cookie

Started by sowalsky, June 03, 2005, 02:33:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sowalsky

Hi,
I want to somehow trigger the setting of a cookie with my admin username and password when I access a certain page (outside of coppermine) so that when I view cpg, it gives me admin access.  This is so I don't have to log in manually; I can use my private portal page to set the cookie.

How do I do this?  I can't find where $config[cookie_name] or $config[cookie_path] are defined, so I can't place the proper cookie.  Help, please!?

Nibbler

Here's the setcookie commands from login.php

setcookie($CONFIG['cookie_name'] . '_uid', $USER_DATA['user_id'], time() + $cookie_life_time, $CONFIG['cookie_path']);
        setcookie($CONFIG['cookie_name'] . '_pass', md5($HTTP_POST_VARS['password']), time() + $cookie_life_time, $CONFIG['cookie_path']);


Hardcode in your details and it should work. Cookie name and path are those set in config, loaded into the $CONFIG array from your database in init.inc.php

sowalsky

Okay, so found cookie_name -- it's cpg133 and cookie_path is /
So would my syntax be:

setcookie('cpg133_uid', '1', time() + 3600, '/');
setcookie('cpg133_pass', md5('mypass'), time() + 3600, '/');

I'm trying this and the cookie isn't taking.  It doesn't even show up in the FireFox cookie list... ('1' is the value of the uid cookie for admin placed when i logged in normally.
thanks for your help.

sowalsky

Nevermind -- I figured out what was wrong. I was putting it after my <HTML> tag.  Oops.