Log in

View Full Version : need a new cookie field


flat6
07-31-2004, 07:47 PM
I need to add something to the cookies that vB makes, a new field, say, section=Games or section=Books, etc. Now, I looked around and in functions.php, I found vbsetcookie, which may do what I want, I can't say that I can figure out the coding.

I've poked around forumdisplay.php, and found various usages...


vbsetcookie('lastvisit', TIMENOW);
set_bbarray_cookie('forum_view', $forumid, TIMENOW);
$bb_cache_forum_view = unserialize(convert_bbarray_cookie($_COOKIE[COOKIE_PREFIX . 'forum_view']));


Basically, I need to set section=Games and then read from the cookie what section the user wants to be in (Games, for example). How do I do that using vB's functions?

Thanks https://vborg.vbsupport.ru/external/2009/06/7.gif

flat6
07-31-2004, 08:24 PM
After doing some poking around, I see that this is probably what I'll need... setcookie("fieldname","fieldvalue");

However, does that erase the current cookie? I want to append it, or change its value if already existing, not write a new one...

flat6
07-31-2004, 09:42 PM
Got it... it's basically these two lines:


$_COOKIE[COOKIE_PREFIX . 'field_name'];


and...


vbsetcookie('field_name', 'field_value', 0);


...if anyone is wondering the same thing :ninja: