Lost connection to phpmyadmin db.

I have a php script website that connects to a MYSQL database. The website has been working fine for years but just suddenly stopped working. No recent changes were made to the database or php scripts. This is a very generic question, but I was wondering if anyone could suggest some troubleshooting steps to take to track down this issue?

The login function uses this query:

[php] $result = @db_query(“select * from auth
where username=’”.$username."’
and passwd = password(’".$password."’)
and privilege = ‘".$priv."’");[/php]

But than the script errors out here with this message:

[php]function check_user(){
$username = ‘visitor’;
if (!login($username,‘visitor’,‘anon’))
{
echo “”;
exit;
}

}[/php]

Any help is greatly appreciated. If you need more info…be happy to provide!
Thanks.

Try to change this:

$result = @db_query("select * from auth where username='".$username."' and passwd = password('".$password."') and privilege = '".$priv."'");

To this:

$result = @db_query(" SELECT * FROM `auth` WHERE `username` = '.mysql_real_escape_string($username).' AND `passwd` = password($password) AND `privilege` = $priv LIMIT 1");

Best regards.

Sponsor our Newsletter | Privacy Policy | Terms of Service