4
I am with a div where I search only logged in users, in it I am displaying users but each update is inserted new records, gave me the tip to use cookise more never worked with it. the following code is giving the error Warning: Cannot Modify header information - headers already sent by (output Started at line 5
<?php
$id_usuario = $_SESSION['user_id'];
$usuario = $_SESSION['user_name'];
setcookie($usuario, $id_usuario, time() + (86400 * 30), "/");
if(!isset($_COOKIE[$usuario])) {
echo "Cookie named '" . $usuario . "' is not set!";
} else {
echo "Cookie '" . $usuario . "' is set!<br>";
echo "Value is: " . $_COOKIE[$usuario];
}
?>
following this tutorial http://www.w3schools.com/php/php_cookies.asp
Put the full code, including the part that puts the names on file, please.
– Victor Eyer
No question, you are starting the session with
session_start();
first of all in the code?– user28595
yes, my login system is complete and working normally, this page I am calling her within a div every X seconds
– Arsom Nolasco
About the error Cannot Modify header information already have question and answer here on the site.
– Bacco