phpRS 2.8.x : phpRS Fórum
Toto fórum je určené výhradně k diskuzi o verzích phpRS v2.8.x.
phpRS - redakční a informační systém
Vlastní cookie
Zaslán uživatelem/kou: solich (IP adresa zaznamenána)
Datum: 2009-06-24, 19:38

Zdravím. Narazil jsem na následující problém.
Potřeboval bych si vlastní funkcí vytvořit cookie (v externím scriptu, který pak do phprs načítám)

function KosikId()
{
if(isset($_COOKIE["KosikId"]))
{
return $_COOKIE["KosikId"];
}
else
{
setcookie("KosikId", "$session_ID", time() + ((3600 * 24) * 1));
}
}

Ono to funguje, ale zároveň s výsledkem scriptu se mi zobrazuje taky hláška:

Warning: Cannot modify header information - headers already sent by (output started at /mnt/raid/www1/eurosolar.cz/www/phprs/image/freestyle/lengine.php:55)

Zde na fóru jsem hledal a asi se to uložení cookie z externího scriptu musí v lengine.php nějak ošetřit, ale na to mi už znalost phprs nestačí. Poradíte? Děkuji.

Re: Vlastní cookie
Zaslán uživatelem/kou: JanVar (IP adresa zaznamenána)
Datum: 2009-06-24, 23:21

uprav si sušenku v phpRS k obrazu svému

-- JaV ---- [http://www.hades.cz] ---- security by obscurity ---------------------------------------------
motto:
It's OK to be ignorant; it's not OK to play stupid.
But it's simply not efficient for us to try to help people who are not willing to help themselves.
----------------------------------------------------------------------------------------------------------------------

Re: Vlastní cookie
Zaslán uživatelem/kou: xsuchy09 (IP adresa zaznamenána)
Datum: 2009-06-24, 23:59

RTFM (php.net)
Citace:
setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.


========================
WEB: Publikační systém WAMOS
SEO: SEO analýza zdarma
OPEN PROJECTS: Studentský portál VUT
HOSTING: WebGlobe.cz
ICQ: 313887644
EMAIL: xsuchy09(at)centrum.cz
========================



Lituji, ale pouze registrovaní uživatelé mohou zasílat příspěvky do této sekce.
This forum powered by Phorum and designed by STaNBoSS.