Hey still not working
Here is what I have full code..
Code:
require_once ('js/xajax_core/xajax.inc.php');
$xajax = new xajax();
$xajax->registerFunction("processForm");
function processForm($username)
{
$ban_username_exists = sql_query("SELECT * FROM banned_usernames WHERE banned_username = '" .
$username . "'");
$result = sql_query(sprintf("SELECT * FROM users WHERE username = '%s'", $username));
$banned = sql_query("SELECT * FROM usernames WHERE banned_username = '" . $username .
"' LIKE '" . $username % "'");
$objResponse = new xajaxResponse();
if (empty($username)) {
$objResponse->assign("result", "innerHTML",
'<span style="color:#f00"><font size="2">Username Empty</font></span>');
} elseif (!preg_match("/^[a-zA-Z\d\-_]+$/i", $username)) {
$objResponse->assign("result", "innerHTML",
'<span style="color:#f00"><font size="2">Invalid Username - Invalid Character or Space</font></span>');
} elseif (mysql_num_rows($ban_username_exists) != '0') {
$objResponse->assign("result", "innerHTML",
'<span style="color:#f00"><font size="2">Invalid Username - Banned Username</font></span>');
} elseif (mysql_fetch_row($banned)) {
$objResponse->assign("result", "innerHTML",
'<span style="color:#f00"><font size="2">Invalid Username - Banned Username</font></span>');
} elseif (mysql_num_rows($result) > 0) {
$objResponse->assign("result", "innerHTML",
'<span style="color:#f00"><font size="2">Not Available</font></span>');
} else {
$objResponse->assign("result", "innerHTML",
'<span style="color:#0c0"><font size="2">Available</font></span>');
}
return $objResponse;
}
$xajax->processRequest();
--------------- Added [DATE]1204900783[/DATE] at [TIME]1204900783[/TIME] ---------------
Other then the mySQL wildcard is there anyway of matching any username that would have part of a banned username? maybe a reg expression ?