Closed Vlad777 closed 11 years ago
Yea let me take a look.
Hmm, I see problems with the headers being sent before session_start(). Incase you were wondering, this is because we include html before the session_start(). Usually session_start() should be the first thing in a php script.
I changed the code, try it now. Iam not having problems with refreshing.
I tried with Chrome and Safari.
I still see the problem on http://cs160.sjsu-cs.org/spring2013/sec2group3/index.php right now.
Thanks for correcting the issue with sessionstart() not being the first thing. It did make the warning message go away I have no idea why I didn't get that warning message before _
I also still have the problem that logs me out when I refresh the page, on instructor's website. Shouldn't we look at whether his server php setting have session enabled?
It is enable. I uploaded a phpinfo.php up on the site. Its weird. I sometime get logged off, sometimes i stay logged in. But if you use my user_test.php to test the login, I stay logged in.
Oh. lol, there is whitespace a the end of pdo_connect.php. So its output whitespace. If you check the error_log, there are still warnings.
Yeah wow I was just there to upload a phpinfo and I saw it was there. I will also look through the logs and see if anything helps.
Ok i removed whitespace from pdo_connect(). Seems to work. I tried in an Incognito tab.
Maybe we should look through the logic of function_user.php and enable some debug? What is strange is that it works on local xampp environment...
Well i think our repo and website were out of sync. Because in the github, pdo_connect.php does not have whitespaces at the bottom. So if you just pulled the code from the repo, it will work. But if you didnt replace pdo_connect.php on the website you get a warning. I believe that this warning is saying that it cannot start the session. Since it cannot start the session, only the first page will appear to log in, cause you set all the variables, ie userid and username. But since Session was not correctly initiated these variables will not be saved between page refreshes.
The whitespace at the bottom of pdo_connect was causing the login issue.
Big thumbs up for solving this one!
Yes because we push things manually in the FTP and not the full blob from github. I also didn't know about that change about whitespace.
It works now! Thanks!
Cool. Iam going to close this then. We can open it or create a new one if there is an issue.
Not sure if this is the case with your original scripts. Since we've integrated them with the index page, refreshing causes user to be logged out, which is quite inconvenient. Do you think you can help with this?