need help...register problem

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” :’(


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

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:
		//create the directory:
		//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:




Confirm Password:

<?php} //end of submission ?>

Thx in advance :slight_smile:

put a space in this line:
//it should be

<?php } // notice the space after the php tag. [/php]

because of the spacing i cant run the code :o i’m using few hours to check the code :-X
thank you so much pointing out the error :smiley:

your very welcome

Sponsor our Newsletter | Privacy Policy | Terms of Service