joostvanveen / build-a-cms-with-codeigniter

Source code for the Tutsplus course 'Build a CMS with Codeigniter'
53 stars 55 forks source link

Hello Sir #3

Closed krunal14320 closed 11 years ago

krunal14320 commented 11 years ago

I am working on this cms tutorials. and i also have that tutsplus video tutorials. I must say that you are great in all this.

I still have a problem with redirection from the validation form, so when i try to login using the good credentials, there is no error and i still be redirected to the admin/user/login. I tried to fix that but cant find any result. Please help me in this issue . I am really stuck at this point and cant go ahead in this tutorial because of this login problem.

joostvanveen commented 11 years ago

Thanks, always good to hear :)

This can be caused by a couple of things, such as: the session does not store correctly, or you might be using the wrong email/password combination after all :) (it does happen sometimes)

Luckily, this is not hard to debug. From what you write it seems that you have a session problem, but it would be a good idea to approach this step by step. Just dump() the variables in the process and see if they produce the results that you expect, step by step. To help you on your way:

  1. On line 65 of the user controller add dump_exit($this->form_validation->run()); and post the form. It should dump TRUE to the screen. Now you have debugged proper validation handling.
  2. If it does return TRUE delete the dump() statement and try the next step. On line 67 of the user controller add dump_exit($this->user_m->login()); and post the form again. This should also dump TRUE to the screen. Now you have debugged the login authentication process.
  3. If that returns TRUE as well, try doing dump_exit($this->session->userdata('loggedin')); That should also return TRUE (it is set on line 62 of the user model. Now you have checked that data is stored in your session.

I'm sure you'll find out what the trouble is this way.

Good luck!

Cheers, Joost

krunal14320 commented 11 years ago

In first step on line 65 only it is showing Dump =>

boolean false

I think i have problem in validation then..

Sorry Sir, I am just new to it so i cant properly figure out the main problem. Please guide me with this problem.

i am using your id and password. id is : joost@codeigniter.tv pass : tutsplus

And really thank you that you helped me in this :) :+1:

krunal14320 commented 11 years ago

Please sir reply me if you got this message..

krunal14320 commented 11 years ago

hello there???

joostvanveen commented 11 years ago

Have you checked your code against the source code?

krunal14320 commented 11 years ago

yeah also i have used in this same source code ...and the same database..then also its not working...

joostvanveen commented 11 years ago

Well it can't be exactly the same or it would be working. Can you paste your code on http://paste.laravel.com/

Sent from my iPhone

Op 25 aug. 2013 om 02:07 heeft krunal14320 notifications@github.com het volgende geschreven:

yeah also i have used in this same source code ...and the same database..then also its not working...

— Reply to this email directly or view it on GitHub.

krunal14320 commented 11 years ago

This is the user controller

http://paste.laravel.com/LKV

This is user Model

http://paste.laravel.com/LL2

On Sun, Aug 25, 2013 at 2:22 PM, krunal raval krunal@nexuscc.in wrote:

yeah sure...

On Sun, Aug 25, 2013 at 1:47 PM, Joost van Veen notifications@github.comwrote:

Well it can't be exactly the same or it would be working. Can you paste your code on http://paste.laravel.com/

Sent from my iPhone

Op 25 aug. 2013 om 02:07 heeft krunal14320 notifications@github.com het volgende geschreven:

yeah also i have used in this same source code ...and the same database..then also its not working...

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/joostvanveen/build-a-cms-with-codeigniter/issues/3#issuecomment-23223835 .

krunal14320 commented 11 years ago

Hello Sir ?

mesaugat commented 11 years ago

Are you trying to run this project? If yes, there are two solutions:

1) Go to 'public_html/index.php':

   switch (dirname(__FILE__)) {
    case 'FULL PATH TO YOUR PROJECT FOLDER public_html':   // Change Here
        define('ENVIRONMENT', 'development');
        break;
    default:
        define('ENVIRONMENT', 'production');
        break;
}

2) This solution is not recommended. Only do this, if you are not able to solve the problem using the first solution. Just change 'application/config/production/database.php' to this:

      $db['default']['hostname'] = 'localhost';
      $db['default']['username'] = 'YOUR USERNAME';
      $db['default']['password'] = 'YOUR PASSWORD';
      $db['default']['database'] = 'cms';

Hope this helps!

krunal14320 commented 11 years ago

Yeah it really helped..i was just doing some changes and in that i change this also the database file in production folder... I changed it with the same as in the development server.. Thanks a lott for this help.. Now will be able to complete the tutorial.. :) :)

Thank You

joostvanveen commented 11 years ago

Actually, that code is already included in index.php and discussed in the video :) Anyway, glad you got it working.