Try this. I make the assumption that ID is not set to auto increment, and also that footer.php connects to your database.
PHP Code:
<?php
if (isset($_POST['submit'])) {
$pass=$_POST['pass'];
$user=$_POST['user'];
$email=$_POST['email'];
}
else {
register();
require_once "footer.php";
exit;
}
$result= mysql_query("SELECT * FROM 'login' WHERE (username = '$user')");
$check= mysql_num_rows('$result');
if ($check != 0) {
echo "'$user' has already been taken, please try another username!";
register();
require_once "footer.php";
exit;
}
else {
$pass2=md5($pass);
$active=rand();
$query = "INSERT INTO login (ID,username,password,email,active) VALUES('$id','$username','$password','$email','$active')";
mysql_query($query) or die(mysql_error());
$to=$email;
$subject="Activation - War of the Lands";
$message="Your activation link: $active \r\n";
$message.="Copy this code into the input box on this page: \r\n";
$message.="http://www.warofthelands.x10hosting.com/V1/active.php";
$header="From: no-reply@warofthelands.x10hosting.com";
mail($to, $subject, $message, $header);
echo "<br>You have been sent your activation link. You need to activate your account before you can login!<br>";
}
require_once "footer.php";
?>