Hi
I am trying to do what I thought would be a simple job of creating a registration function that allows users to register to my site. The software I used had a basic version built in with instructions to modify it manually which I followed but not wel enough obviously as I just get errors.
Could someone take the time to look at this and see if they could advise why I get the following error
Parse error:
syntax error, unexpected '<' in /home/fr03thee/public_html/register.php on line 88
The offending line just seems to be the start of the "normal" HTML bit of the page so I dont understand why is is creating an error. The demo code I coy looks identical to me and seems to work but I have been through this 100 times and cant see any difference. Help!!!!
<?php
$error_message = "";
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$action = isset($_POST['action']) ? $_POST['action'] : '';
$mysql_server = 'localhost';
$mysql_username = 'myusername';
$mysql_password = 'mypassword';
$mysql_database = 'mydatabaser';
$mysql_table = 'mytable';
$success_page = './login.html';
if ($action == 'signup')
{
$newusername = $_POST['username'];
$newtitle = $_POST['title'];
$newfirst_name = $_POST['first_name'];
$newlast_name = $_POST['last_name'];
$newpostcode = $_POST['postcode'];
$newbirthday = $POST['birthday'];
$newemail = $_POST['email'];
$newpassword = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$newallow_contact = $_POST['allow_contact'];
if ($newpassword != $confirmpassword)
{
$error_message = 'Password and Confirm Password are not the same!';
}
else
if (!ereg("^[A-Za-z0-9_!@$]{1,50}$", $newusername))
{
$error_message = 'Username is not valid, please check and try again!';
}
else
if (!ereg("^[A-Za-z0-9_!@$]{1,50}$", $newpassword))
{
$error_message = 'Password is not valid, please check and try again!';
}
else
if (!ereg("^[A-Za-z0-9_!@$.' &]{1,50}$", $newfullname))
{
$error_message = 'Fullname is not valid, please check and try again!';
}
else
if (!ereg("^.+@.+\..+$", $newemail))
{
$error_message = 'Email is not a valid email address. Please check and try again.';
}
if (empty($error_message))
{
$db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
mysql_select_db($mysql_database, $db);
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".$newusername."'";
$result = mysql_query($sql, $db);
if ($data = mysql_fetch_array($result))
{
$error_message = 'Username already used. Please select another username.';
}
}
if (empty($error_message))
{
$crypt_pass = md5($newpassword);
$sql = "INSERT `".$mysql_table."` (`username`, `title`, `first_name`, `last_name`, `postcode`, `birthday`, `email`, `password`, `signup_date`, `last_login`, `account_level`, `activated`, `allow_contact`) VALUES ('$newusername', ‘$newtitle’, ‘$newfirst_name’, ‘$newlast_name’, ‘$newpostcode’, ‘$newbirthday’, ‘$newemail’, '$crypt_pass', 'now()', 'now(), a, 1, ‘$newallow_contact’)”;
$result = mysql_query($sql, $db);
mysql_close($db);
$mailto = $newemail;
$subject = 'Your new account';
$message = 'A new account has been setup.';
$message .= "Username: ";
$message .= $newusername;
$message .= "Password: ";
$message .= $newpassword;
$message .= "";
$header = "From: webmaster@yourwebsite.com"."";
$header .= "Reply-To: webmaster@yourwebsite.com"."";
$header .= "MIME-Version: 1.0"."";
$header .= "Content-Type: text/plain; charset=utf-8"."";
$header .= "Content-Transfer-Encoding: 8bit"."";
$header .= "X-Mailer: PHP v".phpversion();
mail($mailto, $subject, $message, $header);
header('Location: '.$success_page);
exit;
}
}
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Register</title>
Cut off so it fits but the error is ahead of this I think