Romdmit
21-05-2013, 08:19
Ребята, проблема с залогиниванием под драйвером ORM!
Под драйвером “File” - залогинивается и разлогинивается удачно, а под драйвером “ORM”, - НЕТ! т.е. что-то не так с phpMyAdmin как я полагаю!?
сборка:apache_2.2.14-win32-x86-openssl-0.9.8k.msi + kohana-3.3.0 + phpMyAdmin-4.0.0-all-languages.zip.
В файлах: auth.php, main.php и bootstrap.php - все по нотам и без ошибок! смотрим:
auth.php: <?php defined('SYSPATH') OR die('No direct access allowed.');
return array(
'driver' => 'ORM',
'hash_method' => 'sha256',
'hash_key' => '2, 4, 6, 7, 9, 15, 20, 23, 25, 30',
'lifetime' => 1209600,
'session_type' => Session::$default,
'session_key' => 'auth_user',
// Username/password combinations for the Auth File driver
'users' => array(
// 'admin' => '7de9e3fed384f75bfa21907c41defd632cf254fedf5b46fbd3725352fe4d78f5',
),
);
main.php: <?php defined('SYSPATH') or die('No direct script access.');
class Controller_MainGB5 extends Controller_Template {
public $template = "basic";
public function action_index()
{
$data["message"] = "1,2,3";
$data["message1"] = "4,5,6";
$auth = Auth::instance();
if($auth->logged_in()!= 0)
{
$data["message"] = "Залогинен";
}
else
{
$data["message"] = "Незалогинен";
}
if(isset($_POST['btnsubmit']))
{
$login = Arr::get($_POST, 'login', '');
$password = Arr::get($_POST, 'password', '');
$auth->login($login, $password);
}
$this->template->content = View::factory('home', $data);
}
public function action_hpass()
{
$auth = Auth::instance();
$this->template->content = $auth->hash_password('admin');
}
public function action_logout()
{
$auth = Auth::instance();
$auth->logout();
$this->template->content = "Разлогинились";
}
} // End Welcome
bootstrap.php:Kohana::init(array(
'base_url' => '/kohana/',
));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH.'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File);
Cookie::$salt = 'random';
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
// 'minion' => MODPATH.'minion', // CLI Tasks
'orm' => MODPATH.'orm', // Object Relationship Mapping
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'Welcome',
'action' => 'index',
));
Прилагаю в имейджах - изображение ключевых мест рабочих окон phpMyAdmin и логи.
Помогите разобраться в чем проблема, если не сложно!?
Под драйвером “File” - залогинивается и разлогинивается удачно, а под драйвером “ORM”, - НЕТ! т.е. что-то не так с phpMyAdmin как я полагаю!?
сборка:apache_2.2.14-win32-x86-openssl-0.9.8k.msi + kohana-3.3.0 + phpMyAdmin-4.0.0-all-languages.zip.
В файлах: auth.php, main.php и bootstrap.php - все по нотам и без ошибок! смотрим:
auth.php: <?php defined('SYSPATH') OR die('No direct access allowed.');
return array(
'driver' => 'ORM',
'hash_method' => 'sha256',
'hash_key' => '2, 4, 6, 7, 9, 15, 20, 23, 25, 30',
'lifetime' => 1209600,
'session_type' => Session::$default,
'session_key' => 'auth_user',
// Username/password combinations for the Auth File driver
'users' => array(
// 'admin' => '7de9e3fed384f75bfa21907c41defd632cf254fedf5b46fbd3725352fe4d78f5',
),
);
main.php: <?php defined('SYSPATH') or die('No direct script access.');
class Controller_MainGB5 extends Controller_Template {
public $template = "basic";
public function action_index()
{
$data["message"] = "1,2,3";
$data["message1"] = "4,5,6";
$auth = Auth::instance();
if($auth->logged_in()!= 0)
{
$data["message"] = "Залогинен";
}
else
{
$data["message"] = "Незалогинен";
}
if(isset($_POST['btnsubmit']))
{
$login = Arr::get($_POST, 'login', '');
$password = Arr::get($_POST, 'password', '');
$auth->login($login, $password);
}
$this->template->content = View::factory('home', $data);
}
public function action_hpass()
{
$auth = Auth::instance();
$this->template->content = $auth->hash_password('admin');
}
public function action_logout()
{
$auth = Auth::instance();
$auth->logout();
$this->template->content = "Разлогинились";
}
} // End Welcome
bootstrap.php:Kohana::init(array(
'base_url' => '/kohana/',
));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH.'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File);
Cookie::$salt = 'random';
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
// 'minion' => MODPATH.'minion', // CLI Tasks
'orm' => MODPATH.'orm', // Object Relationship Mapping
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'Welcome',
'action' => 'index',
));
Прилагаю в имейджах - изображение ключевых мест рабочих окон phpMyAdmin и логи.
Помогите разобраться в чем проблема, если не сложно!?