ok,
i have a site that sets a cookie as a random number to reference shopping cart items. i store the items in a table so the only reson for the cookie is to have a random number that is referenced by the session.
sometimes the cookie is blank. it seems to have a blank space in it though, but that is it. it wouldnt be a problem until the second person who does it.
i am trying to have a function check the charater count and if it is below a vertain number of charaters, it would then use time() and rand() to create a session random number.
i need to figure out how to post a global variable to the server so that it can be used by the script.
here is what i have (and works)
#########################
if (!isset($user_id)) {
$token=md5(uniqid(rand()));
setcookie(user_id,$token,time()+$cookie_time,"/",".$domain");
}
and this is what i am trying to use to create a random number to use as the user_id for the session.
#########################
$num_user_id = count_chars($user_id,3);
if ($num_user_id < "5")
{
$u_time = time();
$u_rand = rand();
$user_id = time().rand();
$_POST["user_id"] = $user_id;
}
i hope this makes sense.
any advice would be great.
thanks