So Im setting up a basic registration system, but for some reason when the Register button is clicked it doesnt respond at all… Im kind of stuck here so any help would be welcome
[php]<?php
//is user logged in?
session_start();
//tengjast databaseinn
$con = mysql_connect(‘localhost’, ‘root’, ‘’) or die(msql_error());
$db = mysql_select_db(‘Project 42’, $con) or die(mysql_error());
//koma i veg fyrir SQL injection
include “./functions.php”;
?>
if(!$username || !$password || !$passconf || !$email){
//if any weren't display the error message
echo "<center>Please fill in all the fields</center>";
}else{
if(strlen($username) > 32 || strlen($username) < 3){
echo "<center>Username must be between 3 and 32 characters</center>";
}else{
//select all the rows from out users table where the posted username matches the username stored
$res = mysql_query("SELECT * FROM users WHERE username = '".$username."'");
$num = mysql_num_rows($res);
if($num == 1){
echo "<center>The Usernameyou is already taken</center>";
}else{
if(strlen($password) < 5 || strlen($password) > 32){
echo "<center>Your Passwordmust be between 5 and 32 characters</center>";
}else{
if($password != $passconf){
echo "<center>The Password you supplied did not math the confirmation password</center>";
}else{
//Set the format we want to check out email address against
$checkemail = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
if(!preg_match($checkemail, $email)){
echo "<center>The E-mail is not valid</center>";
}else{
$res1 = mysql_query("SELECT * FROM users WHERE email = '".$email."'");
$num1 = mysql_num_rows($res1);
if($num1 == 1){
echo "<center>The E-mail address is already taken</center>";
}else{
//finally, otherwise register there account
//time of register (unix)
$registerTime = date('U');
//make a code for our activation key
$code = md5($username).$registerTime;
//insert the row into the database
$res2 = mysql_query("INSERT INTO users (username, password, email, rtime, joindate) VALUES('".$username."','".$password."','".$email."','".$registerTime."', CURRENT_TIMESTAMP)");
//send the email with an email containing the activation link to the supplied email address
mail($email, $INFO['chatName'].' registration confirmation', "Thank you for registering to us ".$username.",\n\nHere is your activation link. If the link doesn't work copy and paste it into your browser address bar.\n\nhttp://www.yourwebsitehere.co.uk/activate.php?code=".$code, 'From: [email protected]');
//display the success message
echo "<center>You have successfully registered, please visit you inbox to activate your account!</center>";
}
}
}
}
}
}
}
}
?>
<div id="border">
<from action="register.php" method="post">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td>Username: </td>
<td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Password: </td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td>Confirm Password: </td>
<td><input type="password" name="passconf" /></td>
</tr>
<tr>
<td>Email: </td>
<td><input type="text" name="email" size="25" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Register" /></td>
</tr>
<tr>
<td colspan="2" align="center"><a href="login.php">Login</a> | <a href="forgot.php">Forgotten Password</a></td>
</tr>
</table>
</div>
</from>
</body>
[/php]