Hello .. My question is how to know the user has cookies enabled or disabled ? because in my website since the user has given a right password and username can do everything in the website .. waiting for help
Sigh, incorrect. Please read the PHP.net documentation: http://php.net/setcookie You must send the user to another page, before you can check whether they have cookies enabled. i.e. You set a cookie on one page, then forward them, then attempt to read the cookie, if you can read it - all is well. Otherwise, they're not playing ball. Dan
Let me correct you Dan, read I again please: http://php.net/setcookie , if you read the question clearly what user asked "cookies enabled or disabled", the function setcookie returns true or false immediately if could be set or not boolean setcookie I hope it helps you. Do not count anything offensive in any case, I am just programmer like you .
No, it returns the value of whether headers have been output BEFORE the setcookie line. If it returns true then it means the header has been sent successfully - nothing else - it does NOT return whether cookies are enabled or not. JUST if the header is sent. (Enough emphasis?) "My question is how to know the user has cookies enabled or disabled ?" - It will return TRUE even if I have disabled cookies. (I know because I just tried it.) Here's some code for you to try: <?php var_dump( setcookie('test', 'test', time() + 1000) ); var_dump( isset($_COOKIE['test']) ); die(); ?> PHP: Try switching cookies off, and navigating to the above page. It will return bool(true) bool(false). The first one is your setcookie test. (As long as no output has been sent.) Dan