Just make sure you set your cookies before you output anything. So no
echo lines before your
setcookie() lines. Alternatively, you could use
output buffering.
Also, this code won't work as expected...
$_COOKIE['lagoweb[username]']
PHP will create an array based on that cookie name, so you should use...
$_COOKIE['lagoweb']['username']