ajetrumpet
Banned
- Local time
- Today, 11:50
- Joined
- Jun 22, 2007
- Messages
- 5,638
all,
i have a script that runs when visitors submit a form to me via the website. the script is not perfect, and it certainly can be shortened, but it works fine as is. my ? is...are there any unforseen consequences when two people try to submit the form and call the script at the same time? i had this happen today, and I didn't get the information from one of the form submissions. it's an obvious concern, so i'm looking for a way around it...either that or a better script to send the info to me. here is the relevant portions of the script I run when they push the "submit" button...
i have a script that runs when visitors submit a form to me via the website. the script is not perfect, and it certainly can be shortened, but it works fine as is. my ? is...are there any unforseen consequences when two people try to submit the form and call the script at the same time? i had this happen today, and I didn't get the information from one of the form submissions. it's an obvious concern, so i'm looking for a way around it...either that or a better script to send the info to me. here is the relevant portions of the script I run when they push the "submit" button...
PHP:
<?PHP
$to = $_POST["email"];
$subject = "SUBJECT";
$body = "Dear " . $_POST["fname"] . "," . "\r\n" . "\r\n" . "Thank you for...";
$headers = 'From: No-Reply@MYDOMAIN.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $body, $headers);
// First we set up some parameters for the receiver
$receiver_name = 'ME';
$receiver_email = 'corp@MYDOMAIN.com';
$mydomain = 'MYDOMAIN';
// This is for the sender's name - NAME OF THE SENDER
$send_from = $_POST["fname"]. ' ' .$_POST["lname"];
// This is for the sender's email - EMAIL ADDRESS OF THE SENDER
$send_from_email = $_POST["email"];
// This is for the message phone - PHONE NUMBER
$send_phone = $_POST["phone"];
//This gives the receiver the SENDER'S NAME and EMAIL ADDRESS
$send_header = 'From: ' . $_POST["email"] . "\r\n" . 'Reply-To: ' .
$_POST["email"] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
//This gives a sentence requirement if the sender wants the Sequence Builder
if ($_POST["language"] == "on") {
if ($_POST["prestore"] == "none") {
$Sentences = "Sentences Requested: " . "\r\n" . "\r\n" .
$_POST["S1"] . "\r\n" . $_POST["S2"] . "\r\n" . $_POST["S3"] .
"\r\n" . $_POST["S4"] . "\r\n" . $_POST["S5"] . "\r\n" . $_POST["S6"]; }
else {
$Sentences = "Sentences Requested: Prestored from US"; }
}
else { $Sentences = ""; }
$send_title = 'EMAIL FROM: ' . $_POST["fname"] . ' ' .$_POST["lname"];
$send_body = 'Sender: ' . $send_from . "\r\n" . "\r\n" .
'Email: ' . $send_from_email . "\r\n" . "\r\n" . 'Phone: ' .
$send_phone . "\r\n" . "\r\n" . 'Operating System: ' .
$system . "\r\n" . "\r\n" . 'Access Version: ' .
$version . "\r\n" . "\r\n" . 'REQUESTD: ' .
$requested . "\r\n" . "\r\n" . $Sentences .
"\r\n" . "\r\n" . "\r\n" . "\r\n" .
"The following message was sent to: " .
$_POST["email"] . "\r\n" . "\r\n" . $body;
// Now we need to send the message
$deliver = mail($receiver_email, $send_title, $send_body, $send_header);
// the PHP mail() function return true if the message was processed so we check.
if ($deliver == TRUE){
$redirect = "yes";
} else {
$redirect = "no";
}
// This code will record the order submission in the orders LOG file
$path = "Logs/REQS.txt";
$s_name = $_POST["fname"] . " " . $_POST["lname"];
$s_email = $_POST["email"];
$s_date = date(DATE_COOKIE);
$Content = $s_name . "|" . $_SERVER['REMOTE_HOST'] . "|" .
$s_date . "|" . $s_email . " ";
$fh = @fopen($path,"a");
fputs($fh,$Content . "\r\n");
fclose ($fh);
if ($redirect == "yes") {
header("Location: http://www.MYDOMAIN.com/SUBMISSION.php");
} else {
echo '<p>We had a problem sending your request.
Please e-mail your message directly to us at: ME@MYDOMAIN.com
<input name="button" type="button" id="button"
onclick=javascript:MM_goToURL("parent","index.php");
return document.MM_returnValue value="Home" />';
}
}
?>
Last edited: