redirect() |
[eluser]davy_yg[/eluser]
Hello, I am following this tutorial: http://www.codefactorycr.com/login-with-...r-php.html What's redirect means ? In the tutorial seems there are several controllers. So is redirect means to switch to another controller ? This is my codes: controllers/admin/login.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); controllers/admin/verifylogin.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); controllers/admin/home.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); models/user.php Code: <?php routes.php Code: $route['admin/login_view'] = 'admin/login'; My file structure: controllers/admin/ home.php controllers/admin/ login.php controllers/admin/ verifylogin.php application/views/admin.php application/views/adminnav.php application/views/login_view.php That's my codes. I wonder why after I login to login page it brings me to : http://localhost/IndonusaCI/index.php?verifylogin (this page instead remaining in the login page or go to the admin page) I wonder why ? Please help. Thanks before.
[eluser]Tpojka[/eluser]
Use same file structure as shown in tutorial. If you achive it works, start with changing code regarding your needs. Have you tried exact code if worked as well? If so, when you change particular line of code and it doesn't work, say what line is that. But first you have to be sure you are dealling with something that works besides comments in article. Make sure it works as is in very your system.
[eluser]davy_yg[/eluser]
The problem is there is no error message appears, just the url changes as I said and I cannot figure out which line of codes cause the problems. I wonder why after I login to login page it brings me to : http://localhost/IndonusaCI/index.php?verifylogin (this page instead remaining in the login page or go to the admin page) Can anyone tells me which line of code do I need to change ?
[eluser]davy_yg[/eluser]
I try the exact code and it does works. I wonder why the modified code does not work. I only change the address of the file after the login and trying to match it with my system. I wonder what causes the error.
[eluser]Tpojka[/eluser]
Most people here don't have so much time to read pages and pages and files and files. Write down two codes that are changed with pointing on those lines. For example: works Code: <?=isset($example_var) ? 1 : 0;?> Code: <?=isset($my_var) ? 1 : 0;?> Maybe you should change your routes.php line. You don't put there location of view file, but something you want to be typed in browser URL.
[eluser]davy_yg[/eluser]
Strange, I keep getting the same result. This is my routes: Code: $route['admin/login_view'] = 'admin/login';
[eluser]Tpojka[/eluser]
Seems you are "making house from roof" here. It is irrelevant folder organization and routing until you have valid code that make the job done. For start, remove session_start(); and put Code: $this->load->library('session'); |
Welcome Guest, Not a member yet? Register Sign In |