HI
In the begin of my project i made register system with captcha…
Now i want check my work and i get nice suprise…
Captcha picture doesn’t generate…
It’s my code :
SiteController
public function actions()
{
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xFFFFFF,
'testLimit'=>0,
),
// page action renders "static" pages stored under 'protected/views/site/pages'
// They can be accessed via: index.php?r=site/page&view=FileName
'page'=>array(
'class'=>'CViewAction',
),
);
}
Model :
array('captcha', 'captcha', 'allowEmpty'=> !CCaptcha::checkRequirements(),'on'=>'register'),
maybe is something wrong in urlmanager in config/main?
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>/<id:\d+>/<id2:\d+>'=>'<controller>/<action>',
//'<controller:\w+>/<action:\w+>/<param:\w+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
//array('news/show', 'pattern'=>'news/show/<id:\d+>', 'verb'=>'GET'),
),
),
When i go to link - http://localhost/index.php/site/captcha in normal case, it should send me picture with captcha. Now, it’s writing error that picture contained a errors
Please help
RESOLVE:
HAHHAHAHAHAHAHAHAHAHAHAHAHAHAHAH
I SPEND 3 hours for this problem :
my index.php :
<?php //echo dirname(__FILE__) ; ?>
<?php //echo dirname(__FILE__).'/../../yiiroot/framework/yii.php'; ?>
<?php //echo dirname(__FILE__).'/protected/config/main.php'; ?>
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../../yiiroot/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
//$yii=dirname(__FILE__).'/../yiiroot/framework/yii.php';
//$config=dirname(__FILE__).'/../protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
?>
I had to delete firstly 3 lines and now all go right…
But is my next question is…
WHY ?
?
???