<html>
<head>
<title>Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="bootcom.css" rel="stylesheet" type="text/css">
</head>
<body>
<?
$username="bootcom";
$password="mankind";
$database="bootcom_users";
$connection = mysql_connect(localhost,$username,$password)
or die("Database Connection Failed. Please inform our administritive team.");
$result=mysql_select_db($database) or die( "Unable to select database");
// validate username
if(!validate_username($username)) {
// damn. username already taken. tell user to use back button and try again
die("The username you chose is unavailable. Please use your browser's back button to try another.");
}
function validate_username($username) {
// check length and anything else you want and then check availability
$sql = "SELECT COUNT(id) FROM user_information WHERE username='$username'";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
if ($row[0] != 0)
return false;
else
return true;
}
$query = "INSERT INTO user_information VALUES ('". $firstname ."','". $lastname ."','". $DOB ."','". $email ."','". $city ."','". $telephone ."','". $gender ."','". $username ."','". $password ."','". $MSN ."','". $Yahoo ."','". $date ."')";
$result = mysql_query($query);
if (!$query)
{
die(" Query could not be executed");
}
mysql_close();
print "Record added\n";
?></br>
<p> </p></body>
</html>