Advanced search  

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

Pages: [1]   Go Down

Author Topic: Set admin cookie  (Read 4293 times)

0 Members and 1 Guest are viewing this topic.

sowalsky

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Set admin cookie
« on: June 03, 2005, 02:33:11 pm »

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!?
« Last Edit: June 05, 2005, 11:56:16 pm by GauGau »
Logged

Nibbler

  • Guest
Re: Set admin cookie
« Reply #1 on: June 03, 2005, 08:03:47 pm »

Here's the setcookie commands from login.php

Code: [Select]
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
Logged

sowalsky

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Set admin cookie
« Reply #2 on: June 04, 2005, 03:20:08 pm »

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.
Logged

sowalsky

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Set admin cookie
« Reply #3 on: June 05, 2005, 01:19:23 am »

Nevermind -- I figured out what was wrong. I was putting it after my <HTML> tag.  Oops.
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 15 queries.