/    Sign up×
Community /Pin to ProfileBookmark

Form not processing

Hi

I bought a booking script from this company – [url]http://www.freecontactform.com/booking_forms.php[/url], but its not working, I have even emailed them but had no reply

[url]http://www.ruks.co.uk/booking_forms/booking/bookingform.htm[/url]

when i click on submit I dont get a confirmation email

I have attached all the files used

I need to get it up and runnying so peoplae can book but not sure what has gone wrong

thanks

ruksana

[canned-message]attachments-removed-during-migration[/canned-message]

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmSep 19.2014 — Sorry - if you want us to look at your code - find the area that is failing you and post it here. Some of us don't do zip files.
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — sorry please see code - i dont know what the problem is

[ATTACH]16343[/ATTACH]

thanks

Ruksana

[canned-message]attachments-removed-during-migration[/canned-message]
Copy linkTweet thisAlerts:
@ginerjmSep 19.2014 — Sorry - I don't look at people's files here. Never know what you are clicking on.

If you can't read or understand php, why did you EVER buy somebody's script?
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — sorry to ask you for some help, I am stress trying to figure out what has gone wrong and instead of helping your being mean

I wait for someone else to help

thanks

ruksana
Copy linkTweet thisAlerts:
@ginerjmSep 19.2014 — Being mean is running a business that sells scripts to people who have no idea what to do with them. I simply awoke you to the reality of your situation and how you put yourself in it.

Good luck in your endeavors and I hope you learn something from it.

Why won't you post your code here?
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — it won't let me post the code, it says too many characters

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<meta http-equiv="content-language" content="en" />

<title>Form</title>

<link rel="stylesheet" type="text/css" href="css/formpro_default.css" />

<meta name="viewport" content="width=device-width, initial-scale=1">

<script>

function display(n){

var d=['details1','details2','details3','details4','details5'],z0=0;

for (;z0<d.length;z0++){

document.getElementById(d[z0]).style.display=n&&n>z0?'':'none';

}

}

</script>

</head>

<body>

<div width="440px"><div class="contactformpro" style="float:left">

<!-- Form software from www.FreeContactForm.com -->

<script type="text/javascript" src="_validation.js"></script>

<script type="text/javascript">

required.add('Full_Name','NOT_EMPTY','Full Name');

required.add('Phone_Number','NOT_EMPTY','Phone Number');

required.add('Email','EMAIL','Email');

required.add('Number_of_Children','SELECT','Number of Children');

required.add('Full_Name1','NOT_EMPTY','Full Name1');

required.add('Age','NOT_EMPTY','Age');

required.add('Payment','SELECT','Payment');

</script>

<form method="post" action="_process.php" onsubmit="return validate.check(this)">

<table width="581" border="0">

<tr>

<td colspan="2">

<h2>Booking Form</h2>

<p>Fields marked with * are required.</p>

<strong>Name of Parent *
</strong><br />

</td>

</tr>

<tr>

<td width="230" valign="top">

<label for="Full_Name">Full Name<span class="required_star"> * </span></label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Full_Name" id="Full_Name" maxlength="50" value="" />

</td>

</tr>

<tr>

<td valign="top">

<label for="Phone_Number">Phone Number<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<input size="40" type="text" name="Phone_Number" id="Phone_Number" maxlength="50" value="" />

</td>

</tr>

<tr>

<td valign="top">

<label for="Mobile_Number">Mobile Number</label>

</td>

<td valign="top">

<input size="40" type="text" name="Mobile_Number" id="Mobile_Number" maxlength="50" value="" />

</td>

</tr>

<tr>

<td valign="top">

<label for="Email">Email<span class="required_star"> * </span></label>

</td>

<td valign="top">

<input size="40" type="text" name="Email" id="Email" maxlength="50" value="" />

</td>

</tr>

<tr>

<td colspan="2" valign="top"><strong>Your Children Details</strong></td>

</tr>

<tr>

<td valign="top">

<label for="Number_of_Children">Number of Children<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<select id="Number_of_Children" name="Number_of_Children" onchange="display(this.value)">

<option value="0" selected="selected">Please select</option>

<option value="1">1</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

</select>

</td>

</tr>

</table>
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — so I have split it

<table id="details1" width="581" border="0" >

<tr>

<td valign="top">

<label for="Full_Name1">Full Name<span class="required_star"> * </span></label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Full_Name1" id="Full_Name1" maxlength="50" value="" />

</td>

</tr>

<td valign="top">

<label for="Age">Age<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<select id="Age" name="Age">

<option value="0"> Please Select</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

<option value="6">6</option>

<option value="7">7</option>

<option value="8">8</option>

<option value="9">9</option>

<option value="10">10</option>

</select>

</td>

</tr>

<tr>

<td valign="top">

<label for="Allergies">Please enter any allergies this child has</label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Allergies" id="Allergies" maxlength="50" value="" />

</td>

</tr>

<tr>

<td colspan="2"><strong>Date and Venue:</strong></td>

</tr>

<tr>

<td colspan="2">Saturday 27th September 2014 - Job Marston Children's Centre, 93b School Road, Hall Green, Birmingham, B28 8JQ</td>

</tr>

<td valign="top">

<label for="Time">Time<span class="required_star"> * </span></label>

</td>

<td valign="top">

<select id="Time" name="Time">

<option value="0"> Please Select</option>

<option value="10.30am - 12.00pm - Foundation stage - (2-5years)">10.30am - 12.00pm - Foundation stage - (2-5years)</option>

<option value="1.00pm - 3.00pm - Key stage 1&2 - (6-10years)">1.00pm - 3.00pm - Key stage 1&2 - (6-10years</option>

</select>

</td>

</tr>

</table>


<table id="details2" width="581" border="0" style="display:none;" >

<tr>

<td valign="top">

<label for="Full_Name1">Full Name<span class="required_star"> * </span></label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Full_Name1" id="Full_Name1" maxlength="50" value="" />

</td>

</tr>

<td valign="top">

<label for="Age">Age<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<select id="Age" name="Age">

<option value="0"> Please Select</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

<option value="6">6</option>

<option value="7">7</option>

<option value="8">8</option>

<option value="9">9</option>

<option value="10">10</option>

</select>

</td>

</tr>

<tr>

<td valign="top">

<label for="Allergies">Please enter any allergies this child has</label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Allergies" id="Allergies" maxlength="50" value="" />

</td>

</tr>

<tr>

<td colspan="2"><strong>Date and Venue:</strong></td>

</tr>

<tr>

<td colspan="2">Saturday 27th September 2014 - Job Marston Children's Centre, 93b School Road, Hall Green, Birmingham, B28 8JQ</td>

</tr>

<td valign="top">

<label for="Time">Time<span class="required_star"> * </span></label>

</td>

<td valign="top">

<select id="Time" name="Time">

<option value="0"> Please Select</option>

<option value="10.30am - 12.00pm - Foundation stage - (2-5years)">10.30am - 12.00pm - Foundation stage - (2-5years)</option>

<option value="1.00pm - 3.00pm - Key stage 1&2 - (6-10years)">1.00pm - 3.00pm - Key stage 1&2 - (6-10years</option>

</select>

</td>

</tr>

</table>


<table id="details3" width="581" border="0" style="display:none;" >

<tr>

<td valign="top">

<label for="Full_Name1">Full Name<span class="required_star"> * </span></label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Full_Name1" id="Full_Name1" maxlength="50" value="" />

</td>

</tr>

<td valign="top">

<label for="Age">Age<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<select id="Age" name="Age">

<option value="0"> Please Select</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

<option value="6">6</option>

<option value="7">7</option>

<option value="8">8</option>

<option value="9">9</option>

<option value="10">10</option>

</select>

</td>

</tr>

<tr>

<td valign="top">

<label for="Allergies">Please enter any allergies this child has</label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Allergies" id="Allergies" maxlength="50" value="" />

</td>

</tr>

<tr>

<td colspan="2"><strong>Date and Venue:</strong></td>

</tr>

<tr>

<td colspan="2">Saturday 27th September 2014 - Job Marston Children's Centre, 93b School Road, Hall Green, Birmingham, B28 8JQ</td>

</tr>

<td valign="top">

<label for="Time">Time<span class="required_star"> * </span></label>

</td>

<td valign="top">

<select id="Time" name="Time">

<option value="0"> Please Select</option>

<option value="10.30am - 12.00pm - Foundation stage - (2-5years)">10.30am - 12.00pm - Foundation stage - (2-5years)</option>

<option value="1.00pm - 3.00pm - Key stage 1&2 - (6-10years)">1.00pm - 3.00pm - Key stage 1&2 - (6-10years</option>

</select>

</td>

</tr>

</table>


<table id="details4" width="581" border="0" style="display:none;" >

<tr>

<td valign="top">

<label for="Full_Name1">Full Name<span class="required_star"> * </span></label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Full_Name1" id="Full_Name1" maxlength="50" value="" />

</td>

</tr>

<td valign="top">

<label for="Age">Age<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<select id="Age" name="Age">

<option value="0"> Please Select</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

<option value="6">6</option>

<option value="7">7</option>

<option value="8">8</option>

<option value="9">9</option>

<option value="10">10</option>

</select>

</td>

</tr>

<tr>

<td valign="top">

<label for="Allergies">Please enter any allergies this child has</label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Allergies" id="Allergies" maxlength="50" value="" />

</td>

</tr>

<tr>

<td colspan="2"><strong>Date and Venue:</strong></td>

</tr>

<tr>

<td colspan="2">Saturday 27th September 2014 - Job Marston Children's Centre, 93b School Road, Hall Green, Birmingham, B28 8JQ</td>

</tr>

<td valign="top">

<label for="Time">Time<span class="required_star"> * </span></label>

</td>

<td valign="top">

<select id="Time" name="Time">

<option value="0"> Please Select</option>

<option value="10.30am - 12.00pm - Foundation stage - (2-5years)">10.30am - 12.00pm - Foundation stage - (2-5years)</option>

<option value="1.00pm - 3.00pm - Key stage 1&2 - (6-10years)">1.00pm - 3.00pm - Key stage 1&2 - (6-10years</option>

</select>

</td>

</tr>

</table>

<table id="details5" width="581" border="0" style="display:none;" >

<tr>

<td valign="top">

<label for="Full_Name1">Full Name<span class="required_star"> * </span></label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Full_Name1" id="Full_Name1" maxlength="50" value="" />

</td>

</tr>

<td valign="top">

<label for="Age">Age<span class="required_star"> *
</span></label>

</td>

<td valign="top">

<select id="Age" name="Age">

<option value="0"> Please Select</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

<option value="6">6</option>

<option value="7">7</option>

<option value="8">8</option>

<option value="9">9</option>

<option value="10">10</option>

</select>

</td>

</tr>

<tr>

<td valign="top">

<label for="Allergies">Please enter any allergies this child has</label>

</td>

<td width="341" valign="top">

<input size="40" type="text" name="Allergies" id="Allergies" maxlength="50" value="" />

</td>

</tr>

<tr>

<td colspan="2"><strong>Date and Venue:</strong></td>

</tr>

<tr>

<td colspan="2">Saturday 27th September 2014 - Job Marston Children's Centre, 93b School Road, Hall Green, Birmingham, B28 8JQ</td>

</tr>

<td valign="top">

<label for="Time">Time<span class="required_star"> * </span></label>

</td>

<td valign="top">

<select id="Time" name="Time">

<option value="0"> Please Select</option>

<option value="10.30am - 12.00pm - Foundation stage - (2-5years)">10.30am - 12.00pm - Foundation stage - (2-5years)</option>

<option value="1.00pm - 3.00pm - Key stage 1&2 - (6-10years)">1.00pm - 3.00pm - Key stage 1&2 - (6-10years</option>

</select>

</td>

</tr>

</table>

<table width="581" border="0">

<tr>

<td colspan="2"><strong>Cost £10 per child (Discount for 3+ siblings £8 per child)</strong> </td>

</tr>

<tr>

<td valign="top">

<label for="Number_of_Children">Select Payment<span class="required_star"> * </span></label>

</td>

<td valign="top">

<select id="Payment" name="Payment">

<option value="0"> Please Select</option>

<option value="Payment on the day">Payment on the day</option>

<option value="Payemt via PayPal">Payemt via PayPal</option>

</select>

</td>

</tr>

<tr>

<td colspan="2" style="text-align:center">

<input type="submit" value="Submit Form" />

</td>

</tr>

</table>

</form>
Copy linkTweet thisAlerts:
@ginerjmSep 19.2014 — Let's back up . Your first post said that you didn't get the email you expected. You didn't say if anything else happened, including if your form data was received and/or if a database update happened or if you got any error messages. So now you have posted a huge chunk of some very complex html code and NOT ONE bit of PHP code or anything that could possibly involved with sending an email.

As I said originally - show us the code that is involved. This html is not directly involved, but may be the source of some needed data to generate the email with. We won't know that tho until the PHP code is presented.

Please follow the forum rules and wrap your next code posting in the proper tags which are [ code ] and [ /code ] (without the spaces that I used here).
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — I had attached all the files, please the code - configuration.php

[CODE]<?php

/* Form software from www.FreeContactForm.com */

if(class_exists('required')) {
$reqobj = new required;
$reqobj->add('Full_Name','NOT_EMPTY');
$reqobj->add('Phone_Number','NOT_EMPTY');
$reqobj->add('Email','EMAIL');
$reqobj->add('Number_of_children','SELECT');
$reqobj->add('Full_Name1','NOT_EMPTY');
$reqobj->add('Age','NOT_EMPTY');
$reqobj->add('Time','SELECT');
$reqobj->add('Payment','SELECT');
}

$form_page_name = "bookingform.htm";
$email_it_to = "[email protected]";
$email_it_to_cc = "";
$email_it_to_bcc = "";
$email_it_from = "Little leap of faith";
$email_subject = "Booking Form";
$email_suspected_spam = "*SUSPECT Booking Form";
$accept_suspected_hack = "yes"; // change to "no" to NOT accept
$success_page = "thankyou.htm";
$failure_page = "_formerror.php";
$failure_accept_message = "yes";

if(phpversion() > "5.0") { date_default_timezone_set('UTC'); }
?>[/CODE]
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — Please see code - process.php

[CODE]<?php
/*

// YOU DO NOT NEED TO CHANGE ANYTHING IN HERE //
include "_validation.php";
include "_configuration.php";
$email_timestamp = date($dateformat,mktime(date("H")+($hour_offset),date("i"),date("s"),date("m"),date("d"),date("y")));


// set-up redirect page
$redirect_to = $success_page;


// make sure we dont have any extra fields
/*foreach($_POST as $field_name => $field_value) {
if(!in_array($field_name,$fieldlist)) {
error_found("unexpected field found: $field_name",$failure_accept_message,$failure_page);
die();
}
}*/


if(!eregi("@",$email_it_from) && !is_array($email_it_from)) {
$email_it_from = $_POST[$email_it_from];
}

// check for any hacking attempts
class clean {
function comments($message) {
$this->naughty = false;
$this->message = $message;
$bad = array("content-type","bcc:","to:","cc:");
$for = array("%0a", "%0d");
// use the line below to be more strict
// $for = array( "r", "n", "%0a", "%0d");

foreach($bad as $b) {
if(eregi($b, $this->message)) {
$this->naughty = true;
}
}
$this->message = str_replace($bad,"#removed#", $this->message);
$this->message = stripslashes(str_replace($for, ' ', $this->message));

// check for HTML/Scripts
$length_was = strlen($this->message);
$this->message = strip_tags($this->message);
if(strlen($this->message) < $length_was) {
$this->naughty = true;
}
}
} // class


// function to handle errors
function error_found($mes,$failure_accept_message,$failure_page) {
if($failure_accept_message == "yes") {
$qstring = "?prob=".urlencode(base64_encode($mes));
} else {
$qstring = "";
}
$error_page_url = $failure_page."".$qstring;
header("Location: $error_page_url");
die();
}

$email_message = "";

// loop through all form fields submitted
foreach($_POST as $field_name => $field_value) {

if(in_array($field_name,array("recaptcha_challenge_field","recaptcha_response_field"))) {
continue;
}

// run all submitted content through string checker
// removing any dangerous code
if(is_array($field_value)) {
$this_val = '';
$fvac = count($field_value);
$fvaci=0;
foreach($field_value as $fva) {
$fvaci++;
$this_val .= $fva;
if($fvaci < $fvac) {
$this_val .= ", ";
}
}
} else {
$ms = new clean;
$ms->comments($field_value);
$is_naughty = $ms->naughty;
$this_val = $ms->message;
}
$email_message .= str_replace("n","rn",$field_name).": ".$this_val."rnrn";
}


$email_message .= "Senders IP Address: ".$_SERVER['REMOTE_ADDR']."rn";
$email_message .= "Form submitted at: ".$email_timestamp."rn";
$email_message .= "Referring Page: ".$_SERVER['HTTP_REFERER']."rnrn";


if($is_naughty) {
if($accept_suspected_hack == "yes") {
// continue
} else {
// pretend the email was sent
header("Location: $redirect_to");
die();
}
$email_subject = $email_suspected_spam;
}


class createTheMail {
public $iso = 'iso-8859-1';
public $linebreak = "rn";
public $from = '';
public $from_name = '';
public $reply_to = '';
public $to = '';
public $subject = '';
public $message = '';
public $bcc = '';
public $cc = '';
private $uid = '';
private $attachment_data = '';

public function __construct() {
$this->uid = md5(uniqid(time()));
}

public function setBcc($name,$email) {
if(strlen(trim($this->bcc)) == 0) {
$this->bcc = $name." <$email>";
} else {
$this->bcc += ','.$name." <$email>";
}
}

public function setCc($name,$email) {
if(strlen(trim($this->cc)) == 0) {
$this->cc = $name." <$email>";
} else {
$this->cc += ','.$name." <$email>";
}
}

public function addAttachment($file, $filename, $type) {
if($type == "") { $type = "application/octet-stream"; }
$filename_actual = basename($file);
$filename_new = empty($filename) ? basename($file) : $filename;
$path = dirname($file);
$file = $path.'/'.$filename_actual;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$this->attachment_data .= "--".$this->uid."rn";
$this->attachment_data .= "Content-Type: $type; name="".$filename_new.""".$this->linebreak;
$this->attachment_data .= "Content-Transfer-Encoding: base64".$this->linebreak;
$this->attachment_data .= "Content-Disposition: attachment; filename="".$filename_new.""".$this->linebreak.$this->linebreak;
$this->attachment_data .= $content.$this->linebreak.$this->linebreak;
}

public function mail() {
if (strlen(trim($this->attachment_data)) > 0) {
$header = "From: ".$this->from_name." <".$this->from.">".$this->linebreak;
$header .= "Reply-To: ".$this->reply_to.$this->linebreak;
if(strlen(trim($this->cc)) > 5) {
$header .= "Cc: ".$this->cc.$this->linebreak;
}
if(strlen(trim($this->bcc)) > 5) {
$header .= "Bcc: ".$this->bcc.$this->linebreak;
}
$header .= "X-Mailer: createTheMail".$this->linebreak;
$header .= "MIME-Version: 1.0".$this->linebreak;
$header .= "Content-Type: multipart/mixed; boundary="".$this->uid.""".$this->linebreak.$this->linebreak;
$header .= "This is a multi-part message in MIME format.".$this->linebreak;
$header .= "--".$this->uid.$this->linebreak;
$header .= "Content-type:text/plain; charset=".$this->iso.$this->linebreak;
$header .= "Content-Transfer-Encoding: 7bit".$this->linebreak.$this->linebreak;
$header .= $this->message.$this->linebreak.$this->linebreak;
$header .= $this->attachment_data;
$header .= "--".$this->uid."--";
if (@mail($this->to, $this->subject, "", $header)) {
return true;
} else {
return false;
}
} else {

$header = "From: ".($this->from_name)." <".($this->from).">".$this->linebreak;
$header .= "Reply-To: ".($this->reply_to).$this->linebreak;
if(strlen(trim($this->cc)) > 5) {
$header .= "CC: ".$this->cc.$this->linebreak;
}
if(strlen(trim($this->bcc)) > 5) {
$header .= "BCC: ".$this->bcc.$this->linebreak;
}
$header .= "X-Mailer: createTheMail".$this->linebreak;
if (@mail($this->to, $this->subject, $this->message, $header)) {
return true;
} else {
return false;
}

}
}

}

unset($_SERVER['PHP_SELF']);
unset($_SERVER['REMOTE_ADDR']);

if(is_array($email_it_to)) {
foreach($email_it_to as $email_it_to_element) {

$myemail = new createTheMail();
$myemail->iso = "iso-8859-1";
$myemail->to = "$email_it_to_element";
$myemail->from = "$email_it_from";
$myemail->from_name = "$email_it_from";
$myemail->reply_to = "$email_it_from";
if(strlen(trim($email_it_to_cc)) > 7) {
$myemail->setCc($email_it_to_cc,$email_it_to_cc);
}
if(strlen(trim($email_it_to_bcc)) > 7) {
$myemail->setBcc($email_it_to_bcc,$email_it_to_bcc);
}
$myemail->subject = $email_subject;
$myemail->message = $email_message;

if(count($_FILES) > 0 ) {
for($i=0; $i < count($_FILES['upload']['name']); $i++) {

if(trim($_FILES['upload']['name'][$i]) == "") {
// nothing selected
} else {

$file_extension = explode(".",$_FILES['upload']['name'][$i]);
$original_filename = $_FILES['upload']['name'][$i];
$file_extension = ".".strtolower($file_extension[(count($file_extension)-1)]);
$source_name = $_FILES['upload']['tmp_name'][$i];
$source_type = $_FILES['upload']['type'][$i];
$source_size = $_FILES['upload']['size'][$i];
if($source_size == 0) {
die('The size of the file '.$original_filename.' is to big, please go back and try again with a smaller file.');
} else {
$myemail->addAttachment($source_name,$original_filename,$source_type);
}

}

}
}
$myemail->mail();

}
} else {
$myemail = new createTheMail();
$myemail->iso = "iso-8859-1";
$myemail->to = "$email_it_to";
$myemail->from = "$email_it_from";
$myemail->from_name = "$email_it_from";
$myemail->reply_to = "$email_it_from";
if(strlen(trim($email_it_to_cc)) > 7) {
$myemail->setCc($email_it_to_cc,$email_it_to_cc);
}
if(strlen(trim($email_it_to_bcc)) > 7) {
$myemail->setBcc($email_it_to_bcc,$email_it_to_bcc);
}
$myemail->subject = $email_subject;
$myemail->message = $email_message;

if(count($_FILES) > 0 ) {
for($i=0; $i < count($_FILES['upload']['name']); $i++) {

if(trim($_FILES['upload']['name'][$i]) == "") {
// nothing selected
} else {

$file_extension = explode(".",$_FILES['upload']['name'][$i]);
$original_filename = $_FILES['upload']['name'][$i];
$file_extension = ".".strtolower($file_extension[(count($file_extension)-1)]);
$source_name = $_FILES['upload']['tmp_name'][$i];
$source_type = $_FILES['upload']['type'][$i];
$source_size = $_FILES['upload']['size'][$i];
if($source_size == 0) {
die('The size of the file '.$original_filename.' is to big, please go back and try again with a smaller file.');
} else {
$myemail->addAttachment($source_name,$original_filename,$source_type);
}

}

}
}
$myemail->mail();
}

// redirect
header("Location: $redirect_to");
die("<script>location.replace('$redirect_to')</script>");
?>[/CODE]
Copy linkTweet thisAlerts:
@ruks12authorSep 19.2014 — Please see code - validation.php

[CODE]<?php

class required {
var $fields; // public
function required() { // __construct()
$this->fields = array();
}
function add($name,$type) { //public
$this->fields[$name] = $type;
}
function out() { // public
return $this->fields;
}
}

class validate {
var $error = false; // public
var $error_string; // publc
var $error_tmp = "data not valid";

function validate($ar, $post) { // __construct()
if(!is_array($ar)) {
/* no validation required */
} else {
foreach($ar as $a_name => $a_type) {
/* if no validation specified, make not_empty */
if(trim($a_type) == "") { $a_type = "NOT_EMPTY"; }
/* make sure $name is in $post */
$found = false;
if($a_type == "COMPARE") {
$found = true;
} else {
foreach($post as $p_name => $p_value) {
if($p_name == $a_name) {
$found = true;
break;
}
}
}

if(!$found) {
$this->errors($a_name." : no data submitted.<br />");
} else {

if(is_array($a_type)) {
foreach($a_type as $tp) {
if(!$this->checkit($p_value,$tp)) {
echo "<i>$p_value,$tp</i><br />";
$this->errors($a_name." : ".$this->error_tmp."<br />");
}
}
} else {
if(!$this->checkit($p_value,$a_type)) {
$this->errors($a_name." : ".$this->error_tmp."<br />");
}

if($a_type == "COMPARE") {
$tmp_z = explode(":",$a_name);
$tmp_a = $tmp_z[0];
$tmp_b = $tmp_z[1];
if($post[$tmp_a] == $post[$tmp_b]) {
// matched
} else {
$this->errors("".htmlentities($tmp_a)." DOES NOT MATCH ".htmlentities($tmp_a)." <br />");
}
}

}
}
}
}
}
/* ERRORS */
function errors($str) { // private
$this->error = true;
$this->error_string .= $str;
}
/* VALIDATE FIELD AGAINST TYPE */
function checkit($value,$type) { // private

$length = "";

switch($type) {

case "COMPARE":
return true;
break;


case "CHECKBOX_GROUP":
case "SELECT_MULTIPLE":
if(!is_array($value) || count($value) == 0) {
$this->error_tmp = "nothing selected";
return false;
} else { return true; }
break;


case "CHECKBOX_SINGLE":
case "RADIO_SINGLE":
case "RADIO_GROUP":
case "SELECT":
case "NOT_EMPTY":
$this->error_tmp = "string cannot be empty";
return $this->not_empty($value);
break;

case "ALPHA":
$exp = "^[a-z]+$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not alpha"; return false; }
break;

case "ALPHASPACE":
$exp = "^[a-z ]+$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not alphaspace"; return false; }
break;

case "ALPHANUM":
$exp = "^[a-z0-9]+$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not alphanum"; return false; }
break;

case "ALPHANUMSPACE":
$exp = "^[a-z0-9 ]+$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not alphanumspace"; return false; }
break;

case "NUMERIC":
$exp = "^[0-9]+$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not numeric"; return false; }
break;

case "NUMERICPLUS":
$exp = "^[0-9+-. ]+$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not numericplus"; return false; }
break;

case "EMAIL":
$exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "not a valid email"; return false; }
break;

case "YYYYMMDD":
$exp = "^(19|20)[0-9][0-9][- /.](0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not YYYYMMDD"; return false; }
break;

case "DDMMYYYY":
$exp = "^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[-/.](19|20)[0-9][0-9]$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not DDMMYYYY"; return false; }
break;

case "MMDDYYYY":
$exp = "^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[-/.](19|20)[0-9][0-9]$";
if($this->not_empty($value) && eregi($exp, $value)) { return true; } else { $this->error_tmp = "string not MMDDYYYY"; return false; }
break;

default:
if($this->not_empty($value) && $this->regex($type,$value)) { return true; } else { $this->error_tmp = "string not valid"; return false; }

}
}
/* NOT_EMPTY */
function not_empty($value) { // private
if(trim($value) == "") { return false; } else { return true; }
}

/* REGULAR EXPRESSION */
function regex($regex, $value) { // private
$the_regex = 'ereg("'.$regex.'", "'.$value.'")';
$the_code = '<?php if('.$the_regex.') { return true; } else { return false; } ?>';
if(!eval('?>'.$the_code.'<?php ')) { return false; } else { return true; }
}
}
?>[/CODE]
Copy linkTweet thisAlerts:
@ginerjmSep 19.2014 — This is not a trivial problem - way way way too much code to go thru with no idea what it is doing. Sorry - you bought this without support and I'm guessing no documentation so you will have to hope someone here has the time to try and understand this. It's not me.
×

Success!

Help @ruks12 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...