I'va a constant named __Username in this, there are a username for db access. But, sounds the error message, it cant resolve this constant. What I've does wrong?
config.php
<?php
define("__Password", "xxx");
define("__Database", "xxx");
define("__Table", "xxx");
define("__Username", "xxx");
?>
db.php
<?php
include('config.php');
function validateUser($username, $password){
$pswd = '';
$db_handle = mysql_connect('127.0.0.1', __Username, __Password);
$db_found = mysql_select_db(__Database, $db_handle);
if($db_found) {
$query = "select * from users where username = '" . $username . "'";
$result = mysql_query($query) or die(mysql_error());
while($db_field = mysql_fetch_assoc($result))
{
$pswd = $db_field['password'];
}
}
else
{
return false;
}
if($pswd == $password)
{
return true;
}
return false;
}
?>
Has someone an idea?