Hi gurus! im new to php ,hoping you might be able to help.
This is wat happened when i run my code “Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\register.php on line 83” :’(
code:
Register <?php //Script 11.6 - register.php /*This script registers a user by storing their information in a text file and creating a directory for them. *///display error
ini_set(‘display_error’,1);
if(isset($_POST[‘submitted’])) { //Handle the form.
$problem = FALSE; //No problem so far.
//Check for each value....
if (empty($_POST['username'])) {
$problem = TRUE;
print '<p class="error">Please enter a username!</p>';
}
if(empty($_POST['password1'])) {
$problem = TRUE;
print '<p class="error">Please enter a password!</p>';
}
if($_POST['password1'] !=$_POST['password2']) {
$problem = TRUE;
print '<p class="error">Your password did not match your confirmed password!</p>';
}
if(!$problem) { //if there weren't any problems....
if($fp = fopen('/users.txt','ab')) { // open the file
//create the data to be written:
$dir = time().rand(0,4596);
$data = $_POST['username']."\t".md5(trim($_POST['password1']))."\t".$dir."\n";//\r\n on Windows
//write the data and close the file:
fwrite($fp,$data);
fclose($fp);
//create the directory:
mkdir("/users/$dir");
//print a message:
print'<p>You are now registered!</p>';
}else { //could't write to the file.
print '<p class="error">You could not be registered due to a system error.</p>';
}
}else { //////forgot a field
print '<p class="error">Please go back and try again!</p>';
}
}else { //display the form
/////////////////Leave PHP and display the form:
?>
Username:
Password:
Confirm Password:
<?php} //end of submission ?>
Thx in advance