If I should do the Ajax this is what I have right now (pop-up window) to check the username:
Code: Select all
<?php
ob_start();
require('conf.inc.php');
$username = $_GET['username'];
$fname = $_GET['fname'];
print('<html><head><title>Username Availability</title></head><body>');
if(!empty($username)){
$query = mysql_query("SELECT Username from users WHERE Username = '$username'");
if(mysql_num_rows($query)>=1)
{
if(!empty($fname)){
print("<center><b>Sorry $fname,</b><br>Someone has already chosen the username <b>$username.</b> <br>Please try another username.");
} else {
print("<center><b>Sorry,</b><br>Someone has already chosen the username <b>$username.</b> <br>Please try another username.");
}
print('<br><br><a href="#" onClick="self.close()"><center>Close</center></a></body></html>');
ob_flush();
} else {
print("<center><b>Congradulations $fname!</b><br>The username<b> $username </b>has not yet been taken.");
print('<br><br><a href="#" onClick="self.close()"><center>Close</center></a></body></html>');
}
} else {
print("<center><b>Your must enter a username!</b><br>Your have not entered a username, or <br>your username is invaild.<br>Please try again.");
print('<br><br><a href="#" onClick="self.close()"><center>Close</center></a></body></html>');
}
ob_flush();
?>