i m working on a project using the framework Yii, my question is: how can i display a message to the user when he tries to login to the site with cookies disabled in his browser?
Asked
Active
Viewed 531 times
-1
-
Using Jquery: http://stackoverflow.com/questions/8112634/jquery-detecting-cookies-enabled – SuVeRa Sep 27 '12 at 06:01
2 Answers
1
Here is nothing to do with yii Just use:
if(count($_COOKIE) > 0){
echo "Cookies are yummy!";
} else {
die( "You didn't bring any cookies here. We are hungry!");
}
CHeck this url: http://nik.chankov.net/2010/01/16/detecting-if-the-cookies-are-enabled-with-php/
For Managing Cookies with yii check this: http://www.yiiframework.com/wiki/152/cookie-management-in-yii/
hope this helps

Elbek
- 3,434
- 6
- 37
- 49
1
in the class WebUser i have overridden the function beforeLogin like this:
public function beforeLogin(){
if(!isset(Yii::app()->request->cookies['PHPSESSID']))
Yii::app()->controller->redirect(array('page','view'=>'cookies'));
return parent::beforeLogin($id,$states,$fromCookie);
}
and i defined a static page site/page/cookies to display the message.

safiot
- 336
- 1
- 4
- 10