open All Channels
seplocked EVE Technology Lab
blankseplocked IGB Cookies - yay or nay?
 
This thread is older than 90 days and has been locked due to inactivity.


 
Author Topic

D'ala
Posted - 2006.12.05 21:21:00 - [1]
 

Hi, there is very little information on cookie support for the IGB. One person says they work, one does not. I tried this PHP 5.2 code, but it only works on a traditional browser:

<?php
ini_alter("session.use_cookies","1");
ob_start();

// enables session-persistent vars!
session_start();

// set the cookies
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
?>


To debug this I added a print_r($_COOKIE); in the body and that's where things get really weird. In the IGB all I get is:

Array ( [$Version] = 0 [PHPSESSID] = 
6f72974d6af7e8fd588d818385fad038 [$Path] = / )


But in FireFox I get:

Array ( [PHPSESSID] => 18baf9ce0ac78cb51b592a547458e088 
[cookie] => Array ( [three] => cookiethree [two] => cookietwo
[one] => cookieone ) )


Any ideas? Thanks.

Jaka
Posted - 2006.12.05 21:56:00 - [2]
 

I have no idea how PHP session stuff works, but session cookies in IGB work. Permanent cookies (those with expiry 0), however, do not.

ElfeGER
Deep Core Mining Inc.
Posted - 2006.12.06 00:25:00 - [3]
 

Array ( [$Version] = 0 [PHPSESSID] =
6f72974d6af7e8fd588d818385fad038 [$Path] = / )

thats the session id from php and returned by the igb as it should be

as written above permanent cookies don't work

I think you want something like:
<?php
ini_alter("session.use_cookies","1"); //afaik that's default anyway
ob_start();

// enables session-persistent vars!
session_start();
print_r($_SESSION);

$_SESSION['sumfin']='you better remember in the session...';

?>

this should create a session on first load and store a value in the session
the next reload restarts the session (from sessioncookieid) and restores the session vars

jeNK
Caldari
STK Scientific
INVICTUS.
Posted - 2006.12.06 10:29:00 - [4]
 

There is no such thing as a permanent cookie. Setting cookie 0 tells it to expire immediately, thus removing it. Set it for one year or similar if you want a "permanent" cookie.

However, the IGB only sets cookie variables for session ID, IGB version and base path.

Use the session ID as an identifier, and store information in your session data.

Also, try to avoid using the output buffer, it uses quite a lot more server resources (hosting server, not tranq :p)

Xaroth Brook
Minmatar
BIG
Gentlemen's Agreement
Posted - 2006.12.06 16:21:00 - [5]
 

use character id as session id? works just as charming.. no 2 characters have the same character ids..

D'ala
Posted - 2006.12.06 19:14:00 - [6]
 

Great information. Yes I heard there was no such thing as a permanent cookie. That's easy to fix anyways if using a database. :) I had started using $_SESSION[''] vars and think this will work, although I had to completely re-think my code because session vars can't be arrays. Wheew, complicated stuff. :-)


 

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only