latheesan
07-04-2005, 02:33 PM
Hi, this is my piece of code to register for a user account. for some reason, i keep getting a strange error saying that
Parse error: parse error in root\htdocs\users\register.php on line 90
this is my php script
79
<?php
//Connect to database
include("db.php");
//Set some variables
$name = $_POST['name'];
$email = $_POST['email'];
$user = $_POST['user'];
$pass = $_post['password'];
$id = $_PSOT['id'];
//Email validation function
function valid($email){
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) {
return true;
}else{
return false;
}
}
//Some error checking
if (!$name) {
echo "You did not enter your real <b>Name</b>, Go back and try again";
exit();
}
if (!$email) {
echo "You did not enter a valid <b>E-Mail Address</b>, Go back and try again";
exit();
}
if (valid($email)) {
echo "You entered an <b>Invalid</b> E-Mail Address, Format Should be you@domain.com<br><br>Go back and try again";
exit();
}
if (!$user) {
echo "You did not enter your <b>Username</b>, Go back and try again";
exit();
}
if (!$pass) {
echo "You did not enter your <b>Password</b>, Go back and try again";
exit();
}else{
//username check
$sql_username_check = mysql_query("SELECT username FROM users WHERE username='$user'");
$username_check = mysql_num_rows($sql_username_check);
if ($username_check > 0) {
echo "The username you chose is already in use!<br><br>Please go back and try again.";
exit();
}
else {
//MD5 encrypt password
$db_pass = md5($pass);
//Write information to database
mysql_query("INSERT INTO user (name, email, username, password, id, active) VALUES('$name', '$email', '$user', '$db_pass', '$id', 'no')") or die(mysql_error());
//E-Mail validation
$subject = "MySite Account Activation";
$message = "Dear $name,
Please click on the link below to activate your account:
http://www.mysite.com/activate.php?id=$id
Once activated, you can login with the following information
Username: $user
Password: $pass
Regards,
MySite, http://www.MySite.com
<b>Please note: This is an automated response, Please do not reply!</b>
//Send email to user
mail('$email', '$subject', '$message', 'From: Admin<admin@mysite.com>\nX-Mailer: PHP/' . phpversion());
//Include finsih function
include ('finish.php');
}
}
//Close database connection
mysql_close();
?>
When i checked it, the line 90 is this part "?>"
now hows that causing a problem?
Parse error: parse error in root\htdocs\users\register.php on line 90
this is my php script
79
<?php
//Connect to database
include("db.php");
//Set some variables
$name = $_POST['name'];
$email = $_POST['email'];
$user = $_POST['user'];
$pass = $_post['password'];
$id = $_PSOT['id'];
//Email validation function
function valid($email){
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) {
return true;
}else{
return false;
}
}
//Some error checking
if (!$name) {
echo "You did not enter your real <b>Name</b>, Go back and try again";
exit();
}
if (!$email) {
echo "You did not enter a valid <b>E-Mail Address</b>, Go back and try again";
exit();
}
if (valid($email)) {
echo "You entered an <b>Invalid</b> E-Mail Address, Format Should be you@domain.com<br><br>Go back and try again";
exit();
}
if (!$user) {
echo "You did not enter your <b>Username</b>, Go back and try again";
exit();
}
if (!$pass) {
echo "You did not enter your <b>Password</b>, Go back and try again";
exit();
}else{
//username check
$sql_username_check = mysql_query("SELECT username FROM users WHERE username='$user'");
$username_check = mysql_num_rows($sql_username_check);
if ($username_check > 0) {
echo "The username you chose is already in use!<br><br>Please go back and try again.";
exit();
}
else {
//MD5 encrypt password
$db_pass = md5($pass);
//Write information to database
mysql_query("INSERT INTO user (name, email, username, password, id, active) VALUES('$name', '$email', '$user', '$db_pass', '$id', 'no')") or die(mysql_error());
//E-Mail validation
$subject = "MySite Account Activation";
$message = "Dear $name,
Please click on the link below to activate your account:
http://www.mysite.com/activate.php?id=$id
Once activated, you can login with the following information
Username: $user
Password: $pass
Regards,
MySite, http://www.MySite.com
<b>Please note: This is an automated response, Please do not reply!</b>
//Send email to user
mail('$email', '$subject', '$message', 'From: Admin<admin@mysite.com>\nX-Mailer: PHP/' . phpversion());
//Include finsih function
include ('finish.php');
}
}
//Close database connection
mysql_close();
?>
When i checked it, the line 90 is this part "?>"
now hows that causing a problem?
