Jump to content
php.lv forumi

PHP Cookies neliekas


Wuu

Recommended Posts

		
if (isset($_COOKIE['www.xxx.lv.lang'])) {
		echo $_COOKIE['www.xxx.lv.lang'];
	} else {
		setcookie ("www.xxx.lv.lang", "LV", time()+60*60*24*30);
		echo "cepumiņi necepjas";
	}

visu laiku rāda ka cepumiņi necepjas :(

Edited by Wuu
Link to comment
Share on other sites

<?php
session_start();
if (isset($_COOKIE['www.xxx.lv.lang'])) {
		echo $_COOKIE['www.xxx.lv.lang'];
	} else {
		setcookie ("www.xxx.lv.lang", "LV", time()+60*60*24*30);
		echo "cepumiņi necepjas";
	}
....

 

Nekādīgi neliekas! Mēģināju bez laika arī :(

 

Pie phpinfo();

HTTP_COOKIE PHPSESSID=6eed089d0343a091dbcaa14b926f0bc5; www.xxx.lv.lang=LV

atrod to cepumiņu WTF?

Edited by Wuu
Link to comment
Share on other sites

		
if (isset($_COOKIE['www.xxx.lv.lang'])) {
		echo $_COOKIE['www.xxx.lv.lang'];
	} else {
		setcookie ("www.xxx.lv.lang", "LV", time()+60*60*24*30);
		echo "cepumiņi necepjas";
	}

loģiski ka rādīs ka cepumiņi necepas ...

ja šo

 else {
		setcookie ("www.xxx.lv.lang", "LV", time()+60*60*24*30);
		echo "cepumiņi necepjas";
	}

palabotu uz šo

 else {
		if (!setcookie ("www.xxx.lv.lang", "LV", time()+60*60*24*30)) echo "cepumiņi necepjas";
	}

varbuut ka straadaatu ?

Link to comment
Share on other sites

Pie phpinfo();

HTTP_COOKIE PHPSESSID=6eed089d0343a091dbcaa14b926f0bc5; www.xxx.lv.lang=LV

atrod to cepumiņu WTF?

 

tad sanaak ka tomeer liekas ...

 

wuu, pameegini tiiraa failaa shito:

 

<?php
$value = 'something from somewhere';

if (!$_COOKIE['TestCookie']) {
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", ".example.com", 1);
echo 'cepam';
}

print_r($_COOKIE);
?>

 

kad pirmo reizi atver man paraadiijaas shitais ...

cepamArray ( [__utma] => 114651079.298212314.1209454124.1226573670.1226585082.20 [__utmz] => 114651079.1226573670.19.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) [phpSESSID] => d7d0f4cdf71b67ee6255fa0be543fbff )

 

otrajaa:

Array ( [__utma] => 114651079.298212314.1209454124.1226573670.1226585082.20 [__utmz] => 114651079.1226573670.19.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) [phpSESSID] => d7d0f4cdf71b67ee6255fa0be543fbff [TestCookie] => something from somewhere )

Link to comment
Share on other sites

×
×
  • Create New...