I have a form where the user enters their database information and can click a link that uses AJAX to send the credentials to this page. The problem I have is that as long as they enter the correct host name the script returns TRUE
.
Is there another way to test this so that it will return FALSE
if the username and password are not valid?
$h = urldecode($_GET['h']);
$u = urldecode($_GET['u']);
$p = urldecode($_GET['p']);
$con = mysql_connect($h, $u, $p);
if(!$con){
echo 'Could not connect';
}
else{
echo 'Connected';
}
Solved!
For future reference, the issue was that there where entries in the mysql user table for user = "Any". I removed those users and the script worked as expected. I updated this post to include a screen shot for anyone having similar problems. Thanks to Fabio below for the suggestion!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…