Problem in displaying moodle index page

Problem in displaying moodle index page

by Shriya Dhar -
Number of replies: 8

I have customized moodle acc. to our needs but there is a problem. Please see if anyone can help. When I login into moodle with a wrong password or login name, it displays error but after that when i give correct login name and password it logs in but does not show the moodle/index page instead it remains on the login/index page only and when i manually type the address of moodle/index page it shows the page. If i successfully login for the first time only then there is no problem. Problem occurs when once there is a unsuccessful login. I checked the variables. Basically when after unsuccessful login data_submitted function is called, it returns false as it shows $_POST variable as empty and hence it does not enter the loop at all. I am attaching login index file also. On the moodle index page i am redirecting thta page to login/index.php. Why $_POST remains empty and where is this variable filled.

You can check it online also at http://jiva.netexpertsonline.com/moodle/ with test as username and test as password.I am attaching the moodle/index.php. I don't think there is any problem in that page, I am not able to understand why after unsuccessful login there is no value in $_POST and also frm->username and password also does not contain any value.

PLease help

Average of ratings: -
In reply to Shriya Dhar

Re: Problem in displaying moodle index page

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
(Thanks for moving the discussion of this modified version to this forum)

I tried your site using Mozilla, and it seemed to work fine. I tried first to log in using "testd" which failed, then I tried "test" and it was successful: I was logged in and was taken to the front page.

In reply to Martin Dougiamas

Re: Problem in displaying moodle index page

by Shriya Dhar -
I am using IE 6.0. So do u want to say it is browser specific problem? But then what is the solution. Has anyone else experienced the problem? Is it some referer problem? Actually I have to show it to someone buut am wating for the solution of this problem only.
In reply to Shriya Dhar

Re: Problem in displaying moodle index page

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I don't know what the problem is - I'm just helping you find the problem.

I'm saying your site works for me using Mozilla, so you can use this to narrow down the cause by experimenting further. Have you tried a different browser? Also, have you explored the suggestion I mentioned earlier? Then you might know if it's a referrer problem.

Have you tried setting "buggy_referer" to "true" in config.php?
In reply to Martin Dougiamas

Re: Problem in displaying moodle index page

by Shriya Dhar -
buggy_referer is already set true in config file. Will install another browser and try that one? We don't have any zone alarm/firewalls on the server. If we display the value of referer after invalid login it is /login/index.php. We tried to change the value to moodle/index.php, still it didn't work. Also if we change debug to yes in administartor configure variables option then sometimes i get logged in properly but sometimes it gives the same problem. Also when i open the page for the first time it also displays a message that undefined variable http_referer.
In reply to Shriya Dhar

Re: Problem in displaying moodle index page

by Shriya Dhar -
I installed mozilla on my pc and with it everything is working fine but the question is why. We have to find solution. Can anyone help. Its getting very frustrating for us now.
In reply to Shriya Dhar

Re: Problem in displaying moodle index page

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
IE 6 doesn't work for me on your site either. This might be a HTTP header bug with that browser.

Look in your modified login/index.php. I notice you are using the old header() statements whereas Moodle uses the Moodle function redirect (which uses META statements for redirection).

For example, look in that file for this:
   header("Location: $wantsurl");

and try changing that to:
   redirect($wantsurl);

Change ALL the header() calls in that file to redirect() calls in the same way, and see if that helps.
In reply to Martin Dougiamas

Re: Problem in displaying moodle index page

by Shriya Dhar -

martin,

I have tried this but of no use. Actually after unsuucessful login when we give correct login data_submitted function is returning false so it is not entering that loop where this header/redirect function is calleed. As written earlier also second time frm->username and frm->password are empty so data_submitted is also returning false.

In reply to Martin Dougiamas

Re: Problem in displaying moodle index page

by Shriya Dhar -

Ahhh some progress seems to be there after changing header to redirect. Now what is happening when i login after and unsuccessful login, it is giving one error "session not created" i.e. $SESSION->wantsurl is coming empty. And after that if i relogin then it is redirecting. But it is confusing why it is redirecting on the third attempt and why $SESSION->wantsurl is empty. The error is coming at:

else if (empty($SESSION->wantsurl)) {

echo "Session not created";

session_write_close();

//header("Location: $CFG->wwwroot");

redirect(

"$CFG->wwwroot");