Welcome Guest, Not a member yet? Register   Sign In
Not redirecting to the correct place
#1

[eluser]xtremer360[/eluser]
I've seen lately a couple of people have had issues on this topic but none have included code so I'll post my code and see if I can get some responses.

The problem is that my main site is kansasoutlawwrestling.com which isn't anything yet. I am building a CMS called kow manager and I made a controller out of it. I am using tank_auth and so what should be doing when you go to kansasoutlawwrestling.com/kowmanager is going to the login form which would be kansasoutlawwrestling.com/kowmanager/auth/login but doesn't.

Any ideas. Here's my controller.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Kowmanager extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('tank_auth');
        $this->load->library('template');
    }
    
    function index()
    {
        if (!$this->tank_auth->is_logged_in()) {
            redirect('auth/login/');
        } else {
            $data['user_id']    = $this->tank_auth->get_user_id();
            $data['username']    = $this->tank_auth->get_username();
            $this->load->view('welcome', $data);
        }
    }

}

/* End of file kowmanager.php */
/* Location: ./application/controllers/kowmanager.php */
#2

[eluser]Aken[/eluser]
The redirect() location is not relative to the present controller / URL, so you have to include the full location that you want to redirect to. In your case:
Code:
redirect('kowmanager/auth/login');
#3

[eluser]xtremer360[/eluser]
Okay well then what I need isn't solving it because for some reason it says it the file doesn't exist:

http://www.kansasoutlawwrestling.com/kow...auth/login

if I go to here then it says that exists but the auth/login should after the kowmanager not attached to the domain.

http://www.kansasoutlawwrestling.com/auth/login
#4

[eluser]jblack199[/eluser]
auth/login isnt tied to kowmanager however, unless kowmanager is a folder in the controllers folder... kowmanager is one class, auth is another class..

which means kansasoutlawwrestling.com/kowmanager and kansasoutlawwrestling.com/auth

only way to get them to work the same is to either a. make kowmanager a folder inside the controllers folder... or b. make the auth inside the kowmanager.php folder.

I suppose you could use routes too, but that would just be a workaround.
#5

[eluser]xtremer360[/eluser]
Okay so maybe I'm a little confused and want some clarity on the best way to handle this. I have my main site kansasoutlawwrestling.com which will be using CI and then I am also creating a CMS for myself that is a separate entity in its self which will be located at kansasoutlawwrestling.com/kowmanager. My CMS will have different css/js/and image files and what not so I'm wondering if I should just have two different installs of CI or what is the proper set up for this. I tried looking at pyroCMS but there's way folders and I was having a problem understanding its file structure navigation so I decided to ask here.
#6

[eluser]jblack199[/eluser]
what I did with mine was I had my root CI installation. I then created a folder named adm in both the controller and the view folders...

thats where my login.php, main.php, etc are in the controllers.. then in the adm folder of the view, is where all my view files for the admin is... everything else for the front-end is in the same spot you'd have them now...

so basically for my site going to http://www.domain.com/adm is the same as me going to http://www.domain.com/index.php/adm which in effect would be similar to http://www.domain.com/index.php?pg=adm
#7

[eluser]xtremer360[/eluser]
I went ahead deleting everything and did a reinstall of CI in the root folder then made a subdirectory off the root directory called kowmanager and uploaded a copy of the applications folder to the kowmanager directory and copied the index file.

I went into my IDE and edited the kowmanager's index.php file and changed $system_path = 'system'; to $system_path = '../system'; so that they share the same system folder.

Now the thing is if I install the Tank Auth library again and upload it I'd like to have the link to the login be kansasoutlawwrestling.com/kowmanager/login instead of kansasoutlawwrestling.com/kowmanager/auth/login

Is this possible?
#8

[eluser]jblack199[/eluser]
I havent used to the tank auth library so I dont know how exactly it works in regard to that. However, theoretically you should be able to... in terms of the URI that would be that you have an auth.php with a function login inside of it.

However here is how I have my setup:

-root
--applications
---controllers
----adm
---views
----adm


so technically, the adm folder doesn't actually exist and I only have 1 applications folder. But your way would work too. Being that I just downloaded tank auth and took a quick look at it, you would be able to have the kowmanager/auth/login as your url granted that you upload it and install it to the kowmanager folder you have setup.
#9

[eluser]xtremer360[/eluser]
Which doesn't answer the question. The question was how can I have it remove the auth from the url so it only shows kowmanager/login?
#10

[eluser]xtremer360[/eluser]
Any ideas?




Theme © iAndrew 2016 - Forum software by © MyBB