php registration form

Hi, I’ve been updating a clients site that already had a registration page with php init. I’ve looked at the code and cant see why it’s not working there are no errors displayed but on submit the form hangs on a white page, any help would be much appreciated, my php knowledge is not great.
Please find my code below:
[php]

<?php <?php ini_set('display_errors', 'On'); // sometimes it's needed when overridden to Off error_reporting(E_ALL); include 'dbconx.php'; $parents_name = $_POST["ParentsName"]; $firstname = $_POST["FirstName"]; $surname = $_POST["Surname"]; $address1 = $_POST["Address_1"]; $address2 = $_POST["Address_2"]; $city = $_POST["City"]; $county = $_POST["County"]; $postcode = $_POST["Postcode"]; $email_address = $_POST["EmailAddress"]; $telephone = $_POST["Telephone"]; $mobile = $_POST["Mobile"]; $sex = $_POST["Sex"]; $dob_day = $_POST["DOB_day"]; $dob_month = $_POST["DOB_month"]; $dob_year = $_POST["DOB_year"]; $date_of_birth = $dob_year."-".$dob_month."-".$dob_day; $height = $_POST["Height"]; $hairlength = $_POST["HairLength"]; $haircolour = $_POST["HairColour"]; $eyecolour = $_POST["EyeColour"]; $ethnicorigin = $_POST["EthnicOrigin"]; $shoesize = $_POST["ShoeSize"]; $folder_date = date("d-m-Y", time() + (8 * 3600)); if ($firstname == '') { } else { $bad_folder = array(' ', ' ', ' ', ' ', ' ', '\'', '&', '&', '/','Á', 'á', 'É', 'é', 'Í', 'í', 'Ó', 'ó', 'Ú', 'ú', 'Ñ', 'ñ', '(', ')', ',', '.', '´', '~'); $good_folder = array('-', '-', '-', '-', '-', '', 'and', 'and', '-', 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'N', 'n', '', '', '', '', '', '-'); $page_name = $firstname."-".$surname."-".$folder_date ; $page2 = str_replace($bad_folder, $good_folder, $page_name); $folder = strtolower($page2) ; $page_url = $folder; $im = 0; for ($i = 1; $i <= 4; $i++) { if(!is_uploaded_file($_FILES["UploadImg".$i]['tmp_name'])){ } else { $file_type = $_FILES['UploadImg'.$i]['type']; $file_name = $_FILES['UploadImg'.$i]['name']; $file_size = $_FILES['UploadImg'.$i]['size']; $file_tmp = $_FILES['UploadImg'.$i]['tmp_name']; $im++; // CREATE AN UPLOAD FOLDER FOR THE APPLICATION PHOTOS - SAVE THEM FOR RETRIEVAL AT LATER DATE if(!is_dir("images/uploads/$folder")) { mkdir("images/uploads/$folder", 0777); } //get the new width variable. $ThumbWidth = 400; $SmallThumbWidth = 150; //keep image type if($file_size){ $image_result = $firstname."-".$surname."-".$im ; $image_result_large = $image_result."_large".$ext; $image_result_thumb = $image_result."_thumb"; //list width and height and keep height ratio. list($width, $height) = getimagesize($file_tmp); $imgratio=$width/$height; $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; $newSmallwidth = $SmallThumbWidth; $newSmallheight = $SmallThumbWidth/$imgratio; //function for resize image. $new_size = $newwidth ."x". $newheight; $new_Header_size = $newHeaderwidth."x".$newHeaderheight; $new_Small_size = $newSmallwidth."x".$newSmallheight; exec("/usr/bin/convert -resize $new_size! -quality 85 -sharpen 1 -strip /$file_tmp images/uploads/$folder/$image_result.jpg"); exec("/usr/bin/convert -resize $new_Small_size! -quality 85 -sharpen 1 -strip /$file_tmp images/uploads/$folder/$image_result_thumb.jpg"); copy("/$file_tmp", "images/uploads/$folder/$image_result_large"); } } } $loginname = $_POST["LoginName"]; $passwd = $_POST["passwd"]; $repeat_passwd = $_POST["repeat_passwd"]; $error = false; if (empty($parents_name)) { $error = true; $message .= ''; } if (empty($firstname)) { $error = true; $message .= ''; } if (empty($surname)) { $error = true; $message .= ''; } if (empty($address1)) { $error = true; $message .= ''; } if (empty($city)) { $error = true; $message .= ''; } if (empty($county)) { $error = true; $message .= ''; } if (empty($email_address)) { $error = true; $message .= ''; } if (empty($telephone)) { $error = true; $message .= ''; } if (empty($mobile)) { $error = true; $message .= ''; } if (empty($sex)) { $error = true; $message .= ''; } if (empty($height)) { $error = true; $message .= ''; } if (empty($hairlength)) { $error = true; $message .= ''; } if (empty($haircolour)) { $error = true; $message .= ''; } if (empty($eyecolour)) { $error = true; $message .= ''; } if (empty($ethnicorigin)) { $error = true; $message .= ''; } if (empty($shoesize)) { $error = true; $message .= ''; } if (empty($loginname)) { $error = true; $message .= ''; } if (empty($passwd)) { $error = true; $message .= ''; } if ($passwd == $repeat_passwd) { } else { $error = true; $message .= ''; } if ($error == true) { ?>
	<html>
	<head>
	<title>Form Error</title>
	</head>
	
	<body>
	<form action="register.php" method="post" id="error_form">
	<input type="hidden" name="parents_name" value="<? echo $ParentsName ?>" />
	<input type="hidden" name="firstname" value="<? echo $firstname ?>" />
	<input type="hidden" name="surname" value="<? echo $surname ?>" />
	<input type="hidden" name="address1" value="<? echo $address1 ?>" />
	<input type="hidden" name="address2" value="<? echo $address2 ?>" />
	<input type="hidden" name="city" value="<? echo $city ?>" />
	<input type="hidden" name="county" value="<? echo $county ?>" />
	<input type="hidden" name="postcode" value="<? echo $postcode ?>" />
	<input type="hidden" name="email_address" value="<? echo $email_address ?>" />
	<input type="hidden" name="telephone" value="<? echo $telephone ?>" />
	<input type="hidden" name="mobile" value="<? echo $mobile ?>" />
	<input type="hidden" name="sex" value="<? echo $sex ?>" />
	<input type="hidden" name="dob_day" value="<? echo $dob_day ?>" />
	<input type="hidden" name="dob_month" value="<? echo $dob_month ?>" />
	<input type="hidden" name="dob_year" value="<? echo $dob_year ?>" />
	<input type="hidden" name="height" value="<? echo $height ?>" />
	<input type="hidden" name="hairlength" value="<? echo $hairlength ?>" />
	<input type="hidden" name="haircolour" value="<? echo $haircolour ?>" />
	<input type="hidden" name="eyecolour" value="<? echo $eyecolour ?>" />
	<input type="hidden" name="ethnicorigin" value="<? echo $ethnicorigin ?>" />
	<input type="hidden" name="shoesize" value="<? echo $shoesize ?>" />
	<input type="hidden" name="loginname" value="<? echo $loginname ?>" />
	<input type="hidden" name="passwd" value="<? echo $passwd ?>" />
	<input type="hidden" name="repeat_passwd" value="<? echo $repeat_passwd ?>" />
	<? echo $message ?>
	</form>
	
	<script language="JavaScript" type="text/javascript">
	<!--
	document.getElementById('error_form').submit();
	//-->
	</script>	
	</body>
	</html>
<?
} else {
	// INSERT THE APPLICATION INTO THE DATABASE FOR SAFE KEEPING AND EASY UPDATE OF NEW MEMBER
	if (file_exists("images/uploads/$folder/$firstname-$surname-1.jpg")) {
		$image_1 = "images/uploads/$folder/$firstname-$surname-1.jpg";
	} else {
		$image_1 = "";
	}
	if (file_exists("images/uploads/$folder/$firstname-$surname-2.jpg")) {
		$image_2 = "images/uploads/$folder/$firstname-$surname-2.jpg";
	} else {
		$image_2 = "";
	}
	if (file_exists("images/uploads/$folder/$firstname-$surname-3.jpg")) {
		$image_3 = "images/uploads/$folder/$firstname-$surname-3.jpg";
	} else {
		$image_3 = "";
	}
	if (file_exists("images/uploads/$folder/$firstname-$surname-4.jpg")) {
		$image_4 = "images/uploads/$folder/$firstname-$surname-4.jpg";
	} else {
		$image_4 = "";
	}
	$insert = mysql_query("INSERT INTO registrations (page_url, parents_name, firstname, surname, address1, address2, city, county, postcode, email_address, telephone, mobile, sex, date_of_birth, height, hairlength, haircolour, eyecolour, ethnic_origin, shoesize, image_1, image_2, image_3, image_4, username, passwd) VALUES ('$page_url', '$parents_name', '$firstname', '$surname', '$address1', '$address2', '$city', '$county', '$postcode', '$email_address', '$telephone', '$mobile', '$sex', '$date_of_birth', '$height', '$hairlength', '$haircolour', '$eyecolour', '$ethnicorigin', '$shoesize', '$image_1', '$image_2', '$image_3', '$image_4', '$loginname', '$passwd')") or die (mysql_error());
	
	$id = mysql_insert_id();
	
	$skills = $_POST["Skills"];
	foreach($skills as $value) {
		$skills_insert_query = mysql_query("INSERT INTO registration_skills (registrant_id, skill) VALUES ('$id', '$value')") or die (mysql_error());
	}
	// SEND THE APPLICANTS DETAILS TO STEVE AND KAREN

	$to="myemail@domain, [email protected]";
	$subject="New Kids Management Application";
	
	// get the sender's name and email address
	// we'll just plug them a variable to be used later
	$from = stripslashes($_POST['ParentsName'])."<".stripslashes($_POST['EmailAddress']).">";
	
	// generate a random string to be used as the boundary marker
	$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
	
	// now we'll build the message headers
	$headers = "From: $from\r\n" .
	"MIME-Version: 1.0\r\n" .
	"Content-Type: multipart/mixed;\r\n" .
	" boundary=\"{$mime_boundary}\"";
	
	// here, we'll start the message body.
	// this is the text that will be displayed
	// in the e-mail
	$message = 
	"You have received a new appilcation for representation from the Kids Management website:\r\n\r\n".
	"Parent Name: $parents_name\r\n\r\n".
	"Childs Name: $firstname $surname\r\n\r\n".
	"Address $address1\r\n".
	"$address2\r\n".
	"$city\r\n".
	"$county\r\n".
	"$postcode\r\n\r\n".
	"Email Address: $email_address\r\n\r\n".
	"Contact Telephone: $telephone\r\n\r\n".
	"Mobile Number: $mobile\r\n\r\n".
	"Childs Sex: $sex\r\n\r\n".
	"Date of Birth: $date_of_birth\r\n\r\n".
	"Height: $height\r\n\r\n".
	"Hair Length: $hairlength\r\n\r\n".
	"Hair Colour: $haircolour\r\n\r\n".
	"Eye Colour: $eyecolour\r\n\r\n".
	"Ethnic Origin: $ethnicorigin\r\n\r\n".
	"Shoe Size: $shoesize\r\n\r\n".
	"Website Login Name: $loginname\r\n\r\n";
	
	// next, we'll build the invisible portion of the message body
	// note that we insert two dashes in front of the MIME boundary 
	// when we use it
	$message = "This is a multi-part message in MIME format.\n\n" .
	"--{$mime_boundary}\n" .
	"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
	"Content-Transfer-Encoding: 7bit\n\n" .
	$message . "\n\n";
	
	// now we'll process our uploaded files
	for($i = 1; $i <= 4; $i++){		
		// if the upload succeded, the file will exist
		if (file_exists("images/uploads/$folder/$firstname-$surname-$i.jpg")) {
			
			$size = getimagesize("images/uploads/$folder/$firstname-$surname-$i.jpg");
			$tmp_name = "images/uploads/$folder/$firstname-$surname-$i.jpg";
			$name = "$firstname-$surname-$i.jpg";
			$type = $size['mime'];
			// open the file for a binary read
			$file = fopen($tmp_name,'rb');
		
			// read the file content into a variable
			$data = fread($file,filesize($tmp_name));
	
			// close the file
			fclose($file);
		
			// now we encode it and split it into acceptable length lines
			$data = chunk_split(base64_encode($data));
		
			 // now we'll insert a boundary to indicate we're starting the attachment
			 // we have to specify the content type, file name, and disposition as
			 // an attachment, then add the file content.
			 // NOTE: we don't set another boundary to indicate that the end of the 
			 // file has been reached here. we only want one boundary between each file
			 // we'll add the final one after the loop finishes.
			$message .= "--{$mime_boundary}\n" .
			"Content-Type: {$type};\n" .
			" name=\"{$name}\"\n" .
			"Content-Disposition: attachment;\n" .
			" filename=\"{$name}\"\n" .
			"Content-Transfer-Encoding: base64\n\n" .
			$data . "\n\n";
		}
	}
	// here's our closing mime boundary that indicates the last of the message
	$message.="--{$mime_boundary}--\n";
	// now we just send the message
	mail($to, $subject, $message, $headers);
	
          $url = 'http://www.mydomain.co.uk/example-page.php'; 
	
}

}
?>
[/php]

I will upoload the register page next…

Are you trying to upload files? If the file is large it could be a browser timeout causing the white page.

You should also remove any personal information like emails and domains.

I don’t find emails sensitive personal information however i removed from the codes

Sponsor our Newsletter | Privacy Policy | Terms of Service