• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Cookies problem

PHP:
if (!empty($_COOKIE['remembers'])) {
setcookie("remembers",1);
}

i think you mixed with the names a bit
PHP:
bool setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )

The stringname should match the one that you are looking for

http://php.net/manual/en/function.setcookie.php
 
Last edited:
PHP:
if (!isset($_COOKIE['TestCookie'])) {
    setcookie("TestCookie",1);
} else {
    echo "Cookie is allready set <br/>";
}

if (!empty($_COOKIE['TestCookie'])){
   echo "This is the cookie ". $_COOKIE['TestCookie'];
} else {
	echo "Cookie is empty";
}

This is tested and it worked for me. First page was "This cookie is empty" AFTER reloaded page the cookie had it value and it changed to.

Rep plox :D
 
this is error :/

screenhunter56dec281831.jpg


- - - Updated - - -

line 63 -->
setcookie("TestCookie",1);
 
i don't know what is this, but its nicaw acc

its my header.php

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Author" content="nicaw" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo $cfg['skin_url'].$cfg['skin']?>.css" type="text/css" media="screen" />
<link rel="stylesheet" href="print.css" type="text/css" media="print" />
<link rel="alternate" type="application/rss+xml" title="News" href="news.php?RSS2" />
<script type="text/javascript" src="javascript/prototype.js"></script>
<script type="text/javascript" src="javascript/main.js"></script>
<link rel="shortcut icon" href="resource/favicon.ico" />
</head>
<body>
<div id="form"></div>
<div id="header">
<div id="status"><center>



</div></center>
<a href="news.php"><div class="header"">


</div></a></div>
<div id="container">

<br><br>

<div id="panel">
</div>
<div class="bot"></div>
</div>

- - - Updated - - -

any idea ?;p
 
You are including a file?

i mean you putted the scipt inside header.php but wanted to use it in myaccount.php?
cuz what ever i do with it is still working?

forgot? "<?php "script" ?>"
 
i didn't put any script in header, just wanted to add cookie in myaccount.php ^.^

when i add your script
if (!isset($_COOKIE['TestCookie'])) {
setcookie("TestCookie",1);
} else {
echo "Cookie is allready set <br/>";
}

if (!empty($_COOKIE['TestCookie'])){
echo "This is the cookie ". $_COOKIE['TestCookie'];
} else {
echo "Cookie is empty";
}

i got now after deleting some shits from header:

screenhunter57dec281845.jpg
 
Back
Top