4images Forum & Community

General / Allgemeines => Programming => Topic started by: arekuzu on October 17, 2010, 10:36:26 PM

Title: retrieving info for a cookie.. help!!
Post by: arekuzu 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
Title: Re: retrieving info for a cookie.. help!!
Post by: V@no 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'];