Welcome Guest, Not a member yet? Register   Sign In
Admin panel problem

[eluser]Kiran Dangol[/eluser]
Hello everybody,
I am having problem in redirecting the urls in admin panel. I have created a genesis_panel folder inside controller folder. There are two files inside genesis_panel/folder:
1. login.php
2. dashboard.php

Code of login.php is given below:-
Quote:<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {

function __construct(){

public function index()
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() === FALSE){

function change_password(){


Now what the problem is that, I was unable to redirect from the constructor.
Both the urls given same error and says "The page isn't redirecting properly".
But I was able to redirect form the login/index when the form is submitted by removing redirect code of constructor.

One thing,I have declared in routes like
$route['genesis_panel'] = "genesis_panel/login";

Please anyone help me to get out of this problem.

Take the index off the end of your redirects index is default!

Also you may need to setup routes to those.


Remove the session checking part in the constructor. You cannot access login/index nor login/change_password since the process cannot pass through the constructor without session, which generated by login/index, which got redirected to itself forever.

the constructor always runs!

Think about it like this

Somewhere you have a link to "genesis_panel/login". The user clicks the link. If the user is not logged in you redirect to "genesis_panel/login/index". The constructor still runs and thus does the check again. Bingo, it redirects to "genesis_panel/login/index" because the user is not logged in. and it will keep on going forever. A login page doesn't need access control. Anyone should be able to get to the login page. Its after that that you need access control.

Also is it just me or is your form validation saying "if I fail, let the user pass". Or is this just you testing.

[eluser]Kiran Dangol[/eluser]
Thanks Everybody,
Yes, that was the fact which causing an error. I should have checked that session in another controllers.
Many many thanks to every body for taking your time to solve my problem.

Theme © iAndrew 2016 - Forum software by © MyBB