Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot log in

Status
Not open for further replies.

krisc13

Programmer
Jul 17, 2006
42
US
I have a php web application that begins with a simple username and password login page. The program has recently been placed on a new server and data migrated from an older mySQL database to the new application's database. Prior to migrating the data I was able to successfully log in on the new server and view the program and data therein. We are almost finished with the data transfer and now when I attempt to log into my program it not only takes over 10 minutes but it loads a blank page. I realize this may not be enough information but this is my first attempt at something like this so I'm not sure what to add. Does anyone have any suggestions on how to determine why I can no longer log into my application? Any assistance would be appreciated.
 
how are you logging in? are you checking against a database? are you using header authentication? or form-based authentication?

what about errors? any errors displaying? do you have error reporting set to E_ALL?



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Yes we check against a database - username and encrypted password. Form-based authentication. I'm making sure E_ALL is on now...
 
E_ALL is on however I still don't receive any error messages. Just a blank page.
 
can't tell you much without seeing code.

try adding "or die" statements after each DB command. see example here. should tell you what's going on. use it for connection, database selection, table querying. tell us what you get.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
It's on on the new server. Off on the test one. However we're not sure we should change it as everything we do is on this new server. Is it risky to change?
 
Okay we turned it off. Doesn't seem to have changed anything...Keep the suggestions comin tho please! Thanks so much!
 
Oh I am entertaining your suggestion. Tried the die command on several lines. Sorry cLFlaVA wasn't disregarding you. And yes I'm echoing the mysql_error with the die(). Thanks I'm sorry.
 
Yeah I can't seem to get an error message or anything. I did get in once briefly with a test user. Then it crapped out again. Still trying...I wish I knew what code to paste up here but there's so much I've no idea where to start. Line by line I guess...
 
if Cory's advice to use constructs like:
Code:
mysql_connect("host", "user", "pass") or die(mysql_error());
mysql_select_db("dbname") or die(mysql_error());
does not give you any feedback then chances are that this bit of your code is either working or you're code is failing with a parse error at the start.

in your php.ini file have you set display_errors to on?

remember to restart your webserver after editing your php.ini file.
 
Okay I've managed to echo some stuff from the login page and it appears that when the page craps out it's here:

Code:
header('Location: index.php');

Everything up to that point works. I've commented out everything in index.php and put an echo on that page but it's no use. When the login page reaches this line it either hangs forever and goes to a blank page in Firefox, or simply resets the username and password and goes nowhere in IE.
 
We've discovered that the reason the login is taking so long is because of a mySQL select statement that pulls all customers relative to that user from a table of over 500k rows. It simply takes too long. The table is indexed. Well in fact I'm probably not in the right forum now am I? At any rate it appears the php is fine. It's the sql. Hope we have a forum here for that!
 
there is indeed a forum. but for logons you really don't want to do that kind of query.

something like

Code:
$result = mysql_query("select count(*) from users where username='something' and password='somehash'" or die (mysql_error());
if (mysql_result($result,0,0) !== 1){
  //not logged in
} else {
  //ok
}

 
Oh I'm sorry I didn't explain that right. The login is working it's the main page the user logs onto where this sql statement is run to retrieve all the customers for that user. We discovered it is successfully logging the person in it's the gathering of the information for what is displayed that seems to be causing the problem.
 
You need to split that page!

Have one page that says "Logon successful. Click <here> to see your customers."

<here> will be a link to your current slow loading page.

You could even have a metatag on the "successful" page that will load the slow page automatically after a few seconds.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top