The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-General - Registration help
Discuss Registration help in the PHP Development forum on Dev Shed. Registration help PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 5th, 2012, 07:15 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 2
Time spent in forums: 16 m 23 sec
Reputation Power: 0
|
|
|
PHP-General - Registration help
Hi, i'm currently updating a clients site which includes a login and registration page. I am having trouble with the registration page, when submitted it hangs on a white page, i've got error reporting on but no errors are displayed and there aren't any syntax errors either.
If a fresh pair of eyes could look at it that would be much appreciated.
Please find attached the code for the registration page, I will display the submit code on another post.
PHP Code:
<?php
include 'dbconx.php';
$query = mysql_query("SELECT * FROM pages WHERE id = '4'") or die (mysql_error());
while ($r = mysql_fetch_array($query)) {
$meta_key = $r["meta_key"];
$meta_desc = $r["meta_desc"];
$header_title = $r["header_title"];
$text = $r["text"];
}
include 'header.php';
?>
<script type="text/javascript">
function displayLoading() {
if (document.getElementById('upload-progress')) {
document.getElementById('upload-progress').style.display='block';
document.getElementById('upload_hide').style.display='none';
}
}
</script><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<?php
echo $text;
?>
<?php
$ParentsName = $_POST["ParentsName"];
$Err_ParentsName = $_POST["Err_ParentsName"];
$firstname = $_POST["firstname"];
$Err_firstname = $_POST["Err_firstname"];
$surname = $_POST["surname"];
$Err_surname = $_POST["Err_surname"];
$address1 = $_POST["address1"];
$Err_address1 = $_POST["Err_address1"];
$address2 = $_POST["address2"];
$city = $_POST["city"];
$Err_city = $_POST["Err_city"];
$county = $_POST["county"];
$Err_county = $_POST["Err_county"];
$postcode = $_POST["postcode"];
$Err_postcode = $_POST["Err_postcode"];
$email_address = $_POST["email_address"];
$Err_email_address = $_POST["Err_email_address"];
$telephone = $_POST["telephone"];
$Err_telephone = $_POST["Err_telephone"];
$mobile = $_POST["mobile"];
$Err_mobile = $_POST["Err_mobile"];
$sex = $_POST["sex"];
$Err_sex = $_POST["Err_sex"];
$dob_day = $_POST["dob_day"];
$dob_month = $_POST["dob_month"];
$dob_year = $_POST["dob_year"];
$height = $_POST["height"];
$Err_height = $_POST["Err_height"];
$hairlength = $_POST["hairlength"];
$Err_hairlength = $_POST["Err_hairlength"];
$haircolour = $_POST["haircolour"];
$Err_haircolour = $_POST["Err_haircolour"];
$eyecolour = $_POST["eyecolour"];
$Err_eyecolour = $_POST["Err_eyecolour"];
$ethnicorigin = $_POST["ethnicorigin"];
$Err_ethnicorigin = $_POST["Err_ethnicorigin"];
$ShoeSize = $_POST["shoesize"];
$Err_ShoeSize = $_POST["Err_shoesize"];
$loginname = $_POST["loginname"];
$Err_loginname = $_POST["Err_loginname"];
$passwd = $_POST["passwd"];
$Err_passwd = $_POST["Err_passwd"];
$repeat_passwd = $_POST["repeat_passwd"];
?>
<div id="register">
<div class="RegisterForm">
<h3>Apply To Register Your Child With Kids Management</h3>
<form action="register-submit.php" method="post" enctype="multipart/form-data" onsubmit="displayLoading();">
<fieldset>
<legend>Personal Information</legend>
<div class="RegisterNotes"><h3>Personal Information Notes</h3></div>
<div class="RegisterField">
<? if ($Err_ParentsName) {
echo "<li class='err'>$Err_ParentsName</li>";
}
?>
<label for="ParentsName">Parents Name: </label>
<input type="text" name="ParentsName" size="40" value="<? echo $ParentsName
?>" />
</div>
<div class="RegisterField">
<? if ($Err_firstname) {
echo "<li class='err'>$Err_firstname</li>";
}
?>
<label for="FirstName">Childs First Name: </label>
<input type="text" name="FirstName" size="40" value="<? echo $firstname ?>" />
</div>
<div class="RegisterField">
<? if ($Err_surname) {
echo "<li class='err'>$Err_surname</li>";
}
?>
<label for="Surname">Childs Surname: </label>
<input type="text" name="Surname" size="40" value="<? echo $surname ?>" />
</div>
<div class="RegisterField">
<? if ($Err_address1) {
echo "<li class='err'>$Err_address1</li>";
}
?>
<label for="Address_1">Address: </label>
<input type="text" name="Address_1" size="40" value="<? echo $address1 ?>" />
</div>
<div class="RegisterField">
<label for="Address_2" > </label>
<input type="text" name="Address_2" size="40" value="<? echo $address2 ?>" />
</div>
<div class="RegisterField">
<? if ($Err_city) {
echo "<li class='err'>$Err_city</li>";
}
?>
<label for="City">City / Town: </label>
<input type="text" name="City" size="40" value="<? echo $city ?>" />
</div>
<div class="RegisterField">
<? if ($Err_county) {
echo "<li class='err'>$Err_county</li>";
}
?>
<label for="County">County: </label>
<select name="County">
<option value="">Please Select</option>
<?
if (isset($_POST["county"])) { ?>
<option value="<? echo $county ?>" selected="selected"><? echo $county?></option>
<option value="">------------------</option>
<?
} ?>
<option value="Avon"> Avon</option>
<option value="Bedfordshire"> Bedfordshire</option>
<option value="Berkshire"> Berkshire</option>
<option value="Buckinghamshire"> Buckinghamshire</option>
<option value="Cambridgeshire"> Cambridgeshire</option>
<option value="Cheshire"> Cheshire</option>
<option value="Cleveland"> Cleveland</option>
<option value="Cornwall"> Cornwall</option>
<option value="Cumbria"> Cumbria</option>
<option value="Derbyshire"> Derbyshire</option>
<option value="Devon"> Devon</option>
<option value="Dorset"> Dorset</option>
<option value="Durham"> Durham</option>
<option value="Essex"> Essex</option>
<option value="Gloucestershire"> Gloucestershire</option>
<option value="Greater London"> Greater London</option>
<option value="Greater Manchester"> Greater Manchester</option>
<option value="Hampshire"> Hampshire</option>
<option value="Hereford & Worcestershire"> Hereford & Worcestershire</option>
<option value="Hertfordshire"> Hertfordshire</option>
<option value="Humberside"> Humberside</option>
<option value="Isle of Man"> Isle of Man</option>
<option value="Isle of Wight"> Isle of Wight</option>
<option value="Kent"> Kent</option>
<option value="Lancashire"> Lancashire</option>
<option value="Leicestershire"> Leicestershire</option>
<option value="Lincolnshire"> Lincolnshire</option>
<option value="Merseyside"> Merseyside</option>
<option value="Norfolk"> Norfolk</option>
<option value="Northamptonshire"> Northamptonshire</option>
<option value="Northumberland"> Northumberland</option>
<option value="Nottinghamshire"> Nottinghamshire</option>
<option value="Oxfordshire"> Oxfordshire</option>
<option value="Shropshire"> Shropshire</option>
<option value="Somerset"> Somerset</option>
<option value="Staffordshire"> Staffordshire</option>
<option value="Suffolk"> Suffolk</option>
<option value="Surrey"> Surrey</option>
<option value="Sussex"> Sussex</option>
<option value="Warwickshire"> Warwickshire</option>
<option value="West Midlands"> West Midlands</option>
<option value="Wiltshire"> Wiltshire</option>
<option value="Yorkshire"> Yorkshire</option>
</select>
</div>
<div class="RegisterField">
<? if ($Err_postcode) {
echo "<li class='err'>$Err_postcode</li>";
}
?>
<label for="Postcode">Postcode: </label>
<input type="text" name="Postcode" size="40" value="<? echo $postcode ?>" />
</div>
</fieldset>
<fieldset>
<legend>Contact Information</legend>
<div class="RegisterNotes"><h3>Contact Information Notes</h3></div>
<div class="RegisterField">
<? if ($Err_email_address) {
echo "<li class='err'>$Err_email_address</li>";
}
?>
<label for="EmailAddress">Email Address: </label>
<input type="text" name="EmailAddress" size="40" value="<? echo $email_address ?>" />
</div>
<div class="RegisterField">
<? if ($Err_telephone) {
echo "<li class='err'>$Err_telephone</li>";
}
?>
<label for="Telephone">Home Telephone: </label>
<input type="text" name="Telephone" size="40" value="<? echo $telephone ?>" />
</div>
<div class="RegisterField">
<? if ($Err_mobile) {
echo "<li class='err'>$Err_mobile</li>";
}
?>
<label for="Mobile">Mobile: </label>
<input type="text" name="Mobile" size="40" value="<? echo $mobile ?>" />
</div>
</fieldset>
<fieldset>
<legend>Profile Information</legend>
<div class="RegisterNotes"><h3>Profile Information Notes</h3></div>
<div class="RegisterField">
<? if (isset($_POST["firstname"])) {
echo "<li class='err'>Please Select Your Childs Skills</li>";
}
?>
<label for="Skills">Skills: </label>
<select name="Skills[]" size="5" multiple="multiple">
<option value="dancing">Dancing</option>
<option value="acting">Acting</option>
<option value="singing">Singing</option>
<option value="sports">Sports</option>
</select>
</div>
<div class="RegisterField">
<? if ($Err_sex) {
echo "<li class='err'>$Err_sex</li>";
}
?>
<label for="Sex">Sex: </label>
<input type="radio" name="Sex" value="Male"<? if ($sex == 'Male') { ?> checked="checked"<? } ?> /> Male <input type="radio" name="Sex" value="Female"<? if ($sex == 'Female') { ?> checked="checked"<? } ?> /> Female
</div>
<div class="RegisterField">
<label for="DOB_day">Date of Birth: </label>
<select name="DOB_day"><?
for ($i = 1; $i <= 31; $i++) {
?>
<option value="<? echo $i ?>"<? if ($i == $dob_day) { ?> selected="selected"<? } ?>><? echo $i ?></option>
<?
}
?>
</select>
<select name="DOB_month"><?
$Month = strtotime("01-01-2009");
for ($i = 0; $i <= 11; $i++) {
$month = date("F", strtotime("+$i months", $Month));
?>
<option value="<? echo ($i + 1); ?>"<? if ($month == $dob_month) { ?> selected="selected"<? } ?>><? echo $month ?></option>
<?
}
?>
</select>
<select name="DOB_year"><?
$Year = strtotime("01-01-". date("Y", time() + (8 * 3600)));
for ($i = 0; $i <= 20; $i++) {
$year = date("Y", strtotime("-$i years", $Year));
?>
<option value="<? echo $year ?>"<? if ($year == $dob_year) { ?> selected="selected"<? } ?>><? echo $year ?></option>
<?
}
?>
</select>
</div>
<div class="RegisterField">
<? if ($Err_height) {
echo "<li class='err'>$Err_height</li>";
}
?>
<label for="Height">Height: </label>
<input type="text" name="Height" size="20" value="" />
</div>
<div class="RegisterField">
<? if ($Err_hairlength) {
echo "<li class='err'>$Err_hairlength</li>";
}
?>
<label for="HairLength">Hair Length: </label>
<select name="HairLength">
<option value="">Please Select</option>
<option value="long"<? if ($hairlength == 'long') { ?> selected="selected"<? } ?>>Long</option>
<option value="medium"<? if ($hairlength == 'medium') { ?> selected="selected"<? } ?>>Medium</option>
<option value="short"<? if ($hairlength == 'short') { ?> selected="selected"<? } ?>>Short</option>
</select>
</div>
<div class="RegisterField">
<? if ($Err_haircolour) {
echo "<li class='err'>$Err_haircolour</li>";
}
?>
<label for="HairColour">Hair Colour: </label>
<select name="HairColour">
<option value="">Please Select</option>
<option value="black"<? if ($haircolour == 'black') { ?> selected="selected"<? } ?>>Black</option>
<option value="brown"<? if ($haircolour == 'brown') { ?> selected="selected"<? } ?>>Brown</option>
<option value="light_brown"<? if ($haircolour == 'light_brown') { ?> selected="selected"<? } ?>>Light Brown</option>
<option value="blonde"<? if ($haircolour == 'blonde') { ?> selected="selected"<? } ?>>Blonde</option>
<option value="dark_blonde"<? if ($haircolour == 'dark_blonde') { ?> selected="selected"<? } ?>>Dark Blonde</option>
<option value="red"<? if ($haircolour == 'red') { ?> selected="selected"<? } ?>>Red</option>
<option value="auburn"<? if ($haircolour == 'auburn') { ?> selected="selected"<? } ?>>Auburn</option>
</select>
</div>
<div class="RegisterField">
<? if ($Err_eyecolour) {
echo "<li class='err'>$Err_eyecolour</li>";
}
?>
<label for="EyeColour">Eye Colour: </label>
<select name="EyeColour">
<option value="">Please Select</option>
<option value="blue"<? if ($eyecolour == 'blue') { ?> selected="selected"<? } ?>>Blue</option>
<option value="green"<? if ($eyecolour == 'green') { ?> selected="selected"<? } ?>>Green</option>
<option value="black"<? if ($eyecolour == 'black') { ?> selected="selected"<? } ?>>Black</option>
<option value="brown"<? if ($eyecolour == 'brown') { ?> selected="selected"<? } ?>>Brown</option>
<option value="hazel"<? if ($eyecolour == 'hazel') { ?> selected="selected"<? } ?>>Hazel</option>
<option value="blue_green"<? if ($eyecolour == 'blue_green') { ?> selected="selected"<? } ?>>Blue/Green</option>
<option value="blue_grey"<? if ($eyecolour == 'blue_grey') { ?> selected="selected"<? } ?>>Blue/Grey</option>
<option value="green_grey"<? if ($eyecolour == 'green_grey') { ?> selected="selected"<? } ?>>Green/Grey</option>
</select>
</div>
<div class="RegisterField">
<? if ($Err_ethnicorigin) {
echo "<li class='err'>$Err_ethnicorigin</li>";
}
?>
<label for="EthnicOrigin">Ethnic Origin: </label>
<select name="EthnicOrigin">
<option value="">Please Select</option>
<option value="white"<? if ($ethnicorigin == 'white') { ?> selected="selected"<? } ?>>White</option>
<option value="mixed"<? if ($ethnicorigin == 'mixed') { ?> selected="selected"<? } ?>>Mixed Race</option>
<option value="black"<? if ($ethnicorigin == 'black') { ?> selected="selected"<? } ?>>Black</option>
<option value="asian"<? if ($ethnicorigin == 'asian') { ?> selected="selected"<? } ?>>Asian</option>
<option value="oriental"<? if ($ethnicorigin == 'oriental') { ?> selected="selected"<? } ?>>Oriental</option>
</select>
</div>
<div class="RegisterField">
<? if ($Err_ShoeSize) {
echo "<li class='err'>$Err_ShoeSize</li>";
}
?>
<label for="ShoeSize">Shoe Size: </label>
<input type="text" name="ShoeSize" size="10" value="<? echo $ShoeSize ?>" />
</div>
</fieldset>
<fieldset>
<legend>Profile Photos</legend>
<?
if (isset($_POST["firstname"])) {
if ($firstname == '') { ?>
<div class="RegisterNotes"><h3>Photo Upload Notes</h3></div>
<div class="RegisterImgField">
<label for="UploadImg1">Picture to Upload 1</label>
<input type="file" name="UploadImg1" />
</div>
<div class="RegisterImgField">
<label for="UploadImg2">Picture to Upload 2</label>
<input type="file" name="UploadImg2" />
</div>
<div class="RegisterImgField">
<label for="UploadImg3">Picture to Upload 3</label>
<input type="file" name="UploadImg3" />
</div>
<div class="RegisterImgField">
<label for="UploadImg4">Picture to Upload 4</label>
<input type="file" name="UploadImg4" />
</div>
<?
} else {
echo "<p>Your Photos have been uploaded, no need to upload them again</p>";
}
} else { ?>
<div class="RegisterNotes"><h3>Photo Upload Notes</h3></div>
<div class="RegisterImgField">
<label for="UploadImg1">Picture to Upload 1</label>
<input type="file" name="UploadImg1" />
</div>
<div class="RegisterImgField">
<label for="UploadImg2">Picture to Upload 2</label>
<input type="file" name="UploadImg2" />
</div>
<div class="RegisterImgField">
<label for="UploadImg3">Picture to Upload 3</label>
<input type="file" name="UploadImg3" />
</div>
<div class="RegisterImgField">
<label for="UploadImg4">Picture to Upload 4</label>
<input type="file" name="UploadImg4" />
</div>
<?
}
?>
</fieldset>
<fieldset>
<legend>Login Information</legend>
<div class="RegisterNotes"><h3>Login Information Notes</h3></div>
<div class="RegisterField">
<? if ($Err_loginname) {
echo "<li class='err'>$Err_loginname</li>";
}
?>
<label for="LoginName">Desired Login Username: </label>
<input type="text" name="LoginName" size="40" value="<? echo $loginname ?>" />
</div>
<div class="RegisterField">
<? if ($Err_passwd) {
echo "<li class='err'>$Err_passwd</li>";
}
?>
<label for="passwd">Desired Password: </label>
<input type="password" name="passwd" size="40" value="<? echo $passwd ?>" />
</div>
<div class="RegisterField">
<label for="repeat_passwd">Desired Password Again: </label>
<input type="password" name="repeat_passwd" size="40" value="<? echo $repeat_passwd ?>" />
</div>
</fieldset>
<div id="upload_hide"><input type="submit" name="Submit" value="Submit Your Application" class="SubmitButton" /></div>
<div id="upload-progress" style="display:none; margin-left:339px;"><img src="images/loading.gif" alt="Uploading Files" title="Uploading Files"</div>
</form>
</div>
</div>
|

November 5th, 2012, 07:21 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 2
Time spent in forums: 16 m 23 sec
Reputation Power: 0
|
|
Please find below the php code for when the submit button is pressed.
PHP Code:
<?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 .= '<input type="hidden" name="Err_ParentsName" value="You must enter the parents name" />';
}
if (empty($firstname)) {
$error = true;
$message .= '<input type="hidden" name="Err_firstname" value="You must enter the childs first name" />';
}
if (empty($surname)) {
$error = true;
$message .= '<input type="hidden" name="Err_surname" value="You must enter the childs surname" />';
}
if (empty($address1)) {
$error = true;
$message .= '<input type="hidden" name="Err_address1" value="You must enter an address" />';
}
if (empty($city)) {
$error = true;
$message .= '<input type="hidden" name="Err_city" value="You must enter a city" />';
}
if (empty($county)) {
$error = true;
$message .= '<input type="hidden" name="Err_county" value="You must enter a county" />';
}
if (empty($email_address)) {
$error = true;
$message .= '<input type="hidden" name="Err_email_address" value="You must enter a valid Email Address" />';
}
if (empty($telephone)) {
$error = true;
$message .= '<input type="hidden" name="Err_telephone" value="You must enter a telephone number" />';
}
if (empty($mobile)) {
$error = true;
$message .= '<input type="hidden" name="Err_mobile" value="You must enter a mobile contact number" />';
}
if (empty($sex)) {
$error = true;
$message .= '<input type="hidden" name="Err_sex" value="You must enter a sex" />';
}
if (empty($height)) {
$error = true;
$message .= '<input type="hidden" name="Err_height" value="You must enter a height" />';
}
if (empty($hairlength)) {
$error = true;
$message .= '<input type="hidden" name="Err_hairlength" value="You must enter a hairlength" />';
}
if (empty($haircolour)) {
$error = true;
$message .= '<input type="hidden" name="Err_haircolour" value="You must enter a hair colour" />';
}
if (empty($eyecolour)) {
$error = true;
$message .= '<input type="hidden" name="Err_eyecolour" value="You must enter an eye colour" />';
}
if (empty($ethnicorigin)) {
$error = true;
$message .= '<input type="hidden" name="Err_ethnicorigin" value="You must enter an ethnic origin" />';
}
if (empty($shoesize)) {
$error = true;
$message .= '<input type="hidden" name="Err_ShoeSize" value="You must enter the childs shoe size" />';
}
if (empty($loginname)) {
$error = true;
$message .= '<input type="hidden" name="Err_loginname" value="You must enter a desired login name" />';
}
if (empty($passwd)) {
$error = true;
$message .= '<input type="hidden" name="Err_passwd" value="You must enter a login password" />';
}
if ($passwd == $repeat_passwd) {
} else {
$error = true;
$message .= '<input type="hidden" name="Err_passwd" value="The passwords entered do not match." />';
}
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="emailaddress";
$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);
link to a thankyou page
}
}
?>
|

November 5th, 2012, 08:35 AM
|
|
|
|
If you are getting a white page then there is most likely a fatal PHP error. When that occurs not even errors can be displayed on your page. You need to look at the httpd logs to see the PHP error(s) causing this.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|