Hey, im new to PHP and trying to make a registration process with validation after a turtorial.
I have an error in line 74, but im not good at debugging and dont rally know just what to change to get it right. Do u see what iv done wrong? Probalby alot, but so i can get rid of the syntax error.
<?php
include('/../pages/connect.php');
//teste for alfanumeric username
$test=$_POST[username];
if(!preg_match(("[^A-Za-z0-9]"),$testname)) {
//test for duplicate names
$query="SELECT * FROM user WERE username ='$_post[username]'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
if($num == 0) {
//test for duplicate email
$query2="SELECT * FROM user WERE email = '$_POST[email]'";
$result2=mysql_query($query2);
$num2 = mysql_num_rows($result2);
if($num2==0) {
//if email and password match
if(($_POST['password']==$_post['password2'])&&($_post['email']==$_post['email2'])) {
//generate random confirmation code
$confirm_code=md5(uniqid(rand()));
//get rid of all html from hackserspews
$name=strip_tags($_POST['username']);
$email=strip_tags($_POST['email']);
$password=strip_tags($_POST['password']);
$firstname=strip_tags($_POST['firstname']);
$lastname=strip_tags($_POST['lastname']);
//Insert data into database
$query3="INSERT INTO user_temp SET code='$confirm_code', username='$username', email='$email', password='$password', firstname='$firstname', lastname='$lastname'";
$result3=mysql_query($query3);
if($result3) {
$message="Your confirmation link \r\n";
$message.="Click on this link to activate you account \r\n";
$message.="http://www.playforus.com/confirmation.php?passkey"; //HER MÅ DET GJØRES NOE FIKS LINK
$sentmail=mail("$email", 'Registration Confirmation', "$message");
header("location:thankyou.html");
}
// if you email sucessfulle sent
if($sentmail) {
echo "Your conformation link has been sent to your email adress";
}
else {
echo"connot send conformation link to your amil adress";
}
}else {
echo "not found you email on our database";
}
}else{
header("location:no_match_pw_email.html");
}
}else {
header("location:duplicate_email.html");
}
}else {
header("location:duplicate_name.html");
} else {
header("location:invalid_username.html");
}
?>
thank you