OK I still have problems with that but I did some changes to my register.php page to make it more advanced but in trying to do that I have screwed it up! :dunno: Well here is the code and after that I shall explain what is wrong!
PHP Code:
<?php
require_once "config.inc.php";
$error="";
$submit=$_POST['submit'];
if(isset($submit)){
if (!$_POST['user'] | !$_POST['pass'] | !$_POST['email'] ) {
$error="You did not complete all of the required fields";
}
else {
$user=$_POST['user'];
$pass=$_POST['pass'];
$email=$_POST['email'];
$result=mysql_query("SELECT username FROM 'login' WHERE username = '$user'")or mysql_error();
$check = mysql_num_rows($result);
}
if ($check != 0) {
$error="'$user' has already been taken please try another username!";
}
else {
$pass2=md5($pass);
$active=rand();
$result= mysql_query("INSERT INTO login (username, password, email, active) VALUES('$user', '$pass2', '$email', '$active')") or mysql_error();
$to=$email;
$subject="Activation - War of the Lands";
$message="Your username: $user \r\n";
$message.="Your activation code: $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);
header('location:regConfirm.php');
exit;
}
}
?>
<html>
<head>
<title>War of the Lands</title>
<link type="text/css" href="style.css" rel="stylesheet">
</head>
<body>
<script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate"></script>
<h1>Register:</h1><br />
<?php echo $error; ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr>
<td>Username :</td><td><input type="text" name="user"></td>
</tr>
<tr>
<td>Password :</td><td><input type="password" name="pass"></td>
</tr>
<tr>
<td>Email :</td><td><input type="text" name="email"></td>
</tr>
<tr>
<td></td><td><input type="submit" name="submit" value="Register"></td>
</tr>
</table>
</form>
<br />
Copyright 2008 - War of the Lands
</body>
</html>
Well my first problem is that if I click register without filling the input boxes in it is ment to bring up an error but it doesn't. When I do enter a name and it is checked to see if it exists I get this Warning:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/warland/public_html/V1/register.php on line 18
Then it says that the output has already been started to I cannot exicute the header:
Warning: Cannot modify header information - headers already sent by (output started at /home/warland/public_html/V1/register.php:1
in /home/warland/public_html/V1/register.php on line 38
This is really starting to annoy me now but I shall keep going if you people are willing to help. I am learning from my mistakes!