Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Problem sa bakinim kolačićima

[es] :: PHP :: Problem sa bakinim kolačićima
(Zaključana tema (lock), by Nemanja Avramović)

[ Pregleda: 1932 | Odgovora: 2 ] > FB > Twit

Postavi temu

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

shandu85

Član broj: 152815
Poruke: 8
*.83.beocity.net.



Profil

icon Problem sa bakinim kolačićima15.12.2007. u 00:39 - pre 198 meseci
kada otkucam sledeći php kod:
Code:

<html>
<head>
    <title>cookie.php</title>
<head>

<body>
<?php
$id = 10;

if ( isset($_COOKIE["test"]) )
{
    $k = $_COOKIE["test"];
    print("Vrednost kolacica je $k");
}
else
{
    $vreme = time() * 60 * 30;
    setcookie("test", $id, $vreme);
}

print("Vrednost \$id = $id!<br />");
print ("<a href='cookie.php'>Ponovo</a>");
?>
</body>
</html>


Firefox mi prikazuje stranicu sledeće sadržine:
Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\webprog\proba\cookie.php:7) in C:\wamp\www\webprog\proba\cookie.php on line 18
Vrednost $id = 10!
Ponovo

Meni ovaj kod deluje ok, ai očigledno nije. U čemu je problem? Molim vas, pomozite, bijem glavu već ceo dan i nikako da prvalim šta ne valja...
 
0

x kepa x
Mihailo Jankovic
Beograd

Član broj: 743
Poruke: 114
*.adsl-4.sezampro.yu.

ICQ: 7739255


Profil

icon Re: Problem sa bakinim kolačićima15.12.2007. u 06:15 - pre 198 meseci
Prva rechenica u PHP MANUALu za setcookie() kaze sledeche:
Citat:
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.
 
0

Nemanja Avramović
Engineering Manager
MENU Technologies
Beograd, Srbija

Moderator
Član broj: 32202
Poruke: 4391
79.101.163.*

Sajt: https://avramovic.info


+46 Profil

icon Re: Problem sa bakinim kolačićima15.12.2007. u 13:07 - pre 198 meseci
Već je objašnjeno... http://www.elitesecurity.org/t96073-0#1348151
Laravel Srbija.

[NE PRUŽAM PODRŠKU ZA PHP PREKO PRIVATNIH PORUKA!]
 
0

[es] :: PHP :: Problem sa bakinim kolačićima
(Zaključana tema (lock), by Nemanja Avramović)

[ Pregleda: 1932 | Odgovora: 2 ] > FB > Twit

Postavi temu

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.