in php i would do
if (isset($_COOKIE[\'user\']) && $_COOKIE[\'user\'] == $valueFromDb) echo \'logged\';
But in javascript how can
Yes. check out this question: Create, read, and erase cookies with jQuery
a plugin to make it even easier for you: http://plugins.jquery.com/project/cookie