public function addUser($user_type, $username, $password) { // check if user name exists $usercount_sql = <<<EOD \tSELECT \t\tCOUNT(*) \tFROM \t\t`sarah`.`users` \tWHERE \t\t`username`='{$username}' EOD; $usercount_data = mysql_query($usercount_sql) or die(mysql_error()); $usercount_row = mysql_fetch_array($usercount_data); if ($usercount_row['COUNT(*)'] == 0) { $hashing = AuthManager::createNewHash($password); $salt = $hashing['salt']; $hash_algorithm = $hashing['hash_algorithm']; $hash = $hashing['hash']; $salt_database = $hashing['salt_database']; $sql = <<<EOD \tINSERT INTO \t\t`sarah`.`users` ( \t\t\t`user_type`, \t\t\t`username`, \t\t\t`hash_algorithm`, \t\t\t`salt`, \t\t\t`password` \t\t) VALUES ( \t\t\t'{$user_type}', \t\t\t'{$username}', \t\t\t'{$hash_algorithm}', \t\t\t'{$salt_database}', \t\t\t'{$hash}' \t\t) EOD; return mysql_query($sql) or die(mysql_error()); } else { return null; } }