I even cannot suppose what do you want to achieve with this mess...

Clean variant:

=== core.php ===
//Configure::write('Routing.admin', 'admin'); // NOT active option

=== routes.php ===
//Router::connect('/admins/*', array('controller' => 'admin',
'action'
=> 'index','prefix' => 'admin', 'admin' => true)); // do NOT need
routes

=== admins_controller.php ===
class AdminsController extends AppController {
        var $name = 'Admins';
        var $helpers = array('Html', 'Form', 'Javascript');
        var $paginate = array('limit' => 5, 'page' => 1);

        function index() { ... }
        function login() { ... }
        function dashboard() { ... }
        function session_check() { ... }
        function logout() { ... }
}

Views: index.ctp, login.ctp, dashboard.ctp, logout.ctp

URLs in this case:
http://localhost/oystercafe/admins
http://localhost/oystercafe/admins/login
http://localhost/oystercafe/admins/dashboard
http://localhost/oystercafe/admins/logout

Note: if session_check() is some internal method, define it "private"
as __session_check()

On Jul 22, 2:53 pm, anurag <[email protected]> wrote:
> I have have get this error then i try to run or open  admin index
> page.
>
> i have try it by this url :-
>
> http://localhost/oystercafe/admins
>
> "Error:  The requested address '/admins' was not found on this
> server."
>
> followings are my settings
>
> core.php
>
> Configure::write('Routing.admin', 'admin'); //active this option
>
> routes.php
>
> Router::connect('/admins/*', array('controller' => 'admin', 'action'
> => 'index','prefix' => 'admin', 'admin' => true));
>
> I have admin_index.php at following path
>                                                                 view-
>
> >admin_index.ctp file
>
> In controllers folder i have a "admins_controller.php" file with
> following code.
>
> class AdminsController extends AppController {
>
>         var $name = 'Admins';
>
>         var $uses = array('Admin');
>
>    var $helpers = array('Html', 'Form', 'Javascript');
>
>         var $paginate = array('limit' => 5, 'page' => 1);
>
>         function admin_index() {
>
>                                 $this->layout='admin_layout';
>                 }
>
>         function admin_login() {
>
>                   print_r($this->data);
>                   $this->layout='admin_layout';
>                   $username=$this->data['Admin']['username'];
>                   $pass=$this->data['Admin']['password'];
>                   $passmd5=$pass;
>
>                   $rows=$this->Admin->findAll("login_name='$username' AND
> password='$passmd5' AND status='1'");
>           print_r($rows);exit;
>                                           
> if($rows[0]['Admin']['password']==$passmd5)
>                              {
>                                     $this->Session->write('name', 
> $rows[0]['Admin']['fname']);
>                                         $this->Session->write('id', 
> $rows[0]['Admin']['id']);
>                                         $this->flash('Sucessfully Login');
>                                 $this->redirect('dashboard');
>
>                               } else{
>
>                                         $this->flash('Login Failed! Please 
> enter valid username and
> password');
>                                     $this->redirect('index');
>
>                                 }
>         }
>
>         function admin_dashboard() {
>
>                                 $this->layout='dashboard';
>                 }
>
>         function session_check()
>          {
>                    if(empty($_SESSION['id']))
>                         {
>                          $this->redirect('login');
>                         }
>          }
>
>          function admin_logout() {
>
>                   $this->layout='admin_layout';
>                   $this->beforeloginTab();
>                                  if ($this->Session->check('name')== true)
>                                          {
>                                           $this->Session->destroy('name');
>                                           $this->Session->destroy('id');
>                                          }
>                                         $this->Session->setFlash('You\'ve 
> successfully logged out.');
>                                     $this->redirect('index');
>
>         }
>
> }
>
> Please help me out
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to