Author Topic: retrieving info for a cookie.. help!!  (Read 4683 times)

0 Members and 1 Guest are viewing this topic.

Offline arekuzu

  • Pre-Newbie
  • Posts: 2
    • View Profile
retrieving info for a cookie.. help!!
« on: October 17, 2010, 10:36:26 PM »
hi, i was triying make a mod in a single.php file, that working if i pass de user_id for the URL, but i need extract the user_id reading a cookie... some body can help??
Sorry por mi ingles, me esforce un poco, saludos de chile
;)

In phpnuke y get the user making something like this:
<?
cookiedecode($user);
$username = $cookie[1];
echo "$username";
?>

*******************************

i answer my miself:

define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
echo "$user_info[user_id]";


very easy.. :P
« Last Edit: October 17, 2010, 11:05:41 PM by arekuzu »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: retrieving info for a cookie.. help!!
« Reply #1 on: October 18, 2010, 03:27:16 AM »
As you already answered yourself user id is available in $user_info['user_id'] variable
but in your example you should not use echo at anywhere in the code, it could cause some problems with headers.

P.S.
you don't have to enclose a variable in quotes:
echo $user_info['user_id'];
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)