if (($username!=="") && ($password!==""))
should be
if (($username!="") && ($password!=""))
or
if (!empty($username) && !empty($password))
however I'd make some other changes too
//$flag is set to 0 by default, only changes if validated.
$flag = 0;
// if your passwords aren't encrypted using md5()
//then you should use urlencode to prevent hacking.
$password = urlencode($password);
if (!empty($username) && !empty($password))
{
$sql = "SELECT `username`, `password` FROM `{$membertable}` WHERE `username` = '{$username}' AND password = '{$password}' ";
$result = mysql_query( $sql);
if ($result) $flag=1; // if flag = 1 user is logged on...
}
refs:
http://nz2.php.net/urlencode
http://www.php.net/md5