Welcome Guest, Not a member yet? Register   Sign In
Problem with access
#2

[eluser]elmne[/eluser]
But when i try to access login using the path "admin/login"

the form just loops to the homepage as if the login controller was not found.

What causes this?


I happen to have subdirectories within admin, but there is an extended router in the library which first detects controllers then checks for folders, so i don't think it's the cause.

The controller is shown below

Code:
<?php

/*
* Custom router function v 0.1
*
* Add functionality : read into more than one sub-folder
*
*/

Class MY_Router extends CI_Router
{
    Function MY_Router()
    {
        parent::CI_Router();
    }

    function _validate_request($segments)
    {
        if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
        {
            return $segments;
        }

        if (is_dir(APPPATH.'controllers/'.$segments[0]))
        {
            $this->set_directory($segments[0]);
            $segments = array_slice($segments, 1);

            /* ----------- ADDED CODE ------------ */

            while(count($segments) > 0 && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0]))
            {
                // Set the directory and remove it from the segment array
            $this->set_directory($this->directory . $segments[0]);
            $segments = array_slice($segments, 1);
            }

            /* ----------- END ------------ */

            if (count($segments) > 0)
            {
                if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
                {
                    show_404($this->fetch_directory().$segments[0]);
                }
            }
            else
            {
                $this->set_class($this->default_controller);
                $this->set_method('index');

                if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
                {
                    $this->directory = '';
                    return array();
                }

            }

            return $segments;
        }

        show_404($segments[0]);
    }
}

?>

Could someone please advise why validation is failing and instead of directing to the admin index page, the homepage is loaded?


Messages In This Thread
Problem with access - by El Forum - 06-09-2010, 09:04 PM
Problem with access - by El Forum - 06-09-2010, 09:04 PM
Problem with access - by El Forum - 06-09-2010, 09:24 PM
Problem with access - by El Forum - 06-09-2010, 09:32 PM
Problem with access - by El Forum - 06-09-2010, 10:04 PM
Problem with access - by El Forum - 06-09-2010, 10:23 PM
Problem with access - by El Forum - 06-10-2010, 07:23 AM
Problem with access - by El Forum - 06-10-2010, 04:14 PM
Problem with access - by El Forum - 06-10-2010, 04:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB