turbodurso
08-20-2008, 11:11 AM
Hi, kind of new to this ... i have this form (http://www.turbodurso.dreamhosters.com/untitledmuse/site/form.html)
I'm not sure as to why the submit button does not seem to send the form to be processed by the script.
Is it the php?
<?
if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") {
exit("<p>You did not press the submit button</p>");
} else {
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i";
$profanity = "/(beastial|bestial|blowjob|clit|****|***|cunilingus|cunillingus|cunnilingus|****|ejaculate|fag|felati o|fellatio|****|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|or gasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i";
$spamwords = "/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|ba ckgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i";
$bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i";
if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) {
exit("<p>Known spam bots are not allowed.</p>");
}
foreach ($_POST as $key => $value) {
$value = trim($value);
if (empty($value)) {
exit("<p>Please fill in all the fields</p>");
} elseif (preg_match($exploits, $value)) {
exit("<p>Exploits and Malicious scripting not allowed</p>");
} elseif (preg_match($profanity, $value) || preg_match($spamwords, $value)){
exit("<p>Some words not allowed on this form</p>")
}
$_POST[$key] = stripslashes(strip_tags($value));
}
if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,6})$",strtolower($_POST["email"]))) {
exit("<p>Your email is not valid - please enter a valid e-mail address</p>");
}
$recipient = "india@mybeautifulcity.co.uk"
$subject = "Application form details"
$message = "You have received an application from : \n";
$message .= "First name: {$_POST['first_name']} \n";
$message .= "Last name: {$_POST['last_name']} \n";
$message .= "Title: {$_POST['title']} \n";
$message .= "Date of birth: {$_POST['dob']} \n";
$message .= "Gender: {$_POST['gender']} \n";
$message .= "Occupation: {$_POST['occupation']} \n";
$message .= "Job title: {$_POST['job_title']} \n";
$message = "Contact details are : \n";
$message .= "Address: {$_POST['address']} \n";
$message .= "City: {$_POST['city']} \n";
$message .= "County: {$_POST['county']} \n";
$message .= "E-mail: {$_POST['email']} \n";
if (mail($recipient,$subject,$message,$headers)) {
echo("<p>Thank you for applying, we will be in contact with you shortly</p>");
} else {
echo("<p>Sorry, there was an error processing your form - please contact UM by mail</p>")
}
?>
I'm not sure as to why the submit button does not seem to send the form to be processed by the script.
Is it the php?
<?
if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") {
exit("<p>You did not press the submit button</p>");
} else {
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i";
$profanity = "/(beastial|bestial|blowjob|clit|****|***|cunilingus|cunillingus|cunnilingus|****|ejaculate|fag|felati o|fellatio|****|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|or gasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i";
$spamwords = "/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|ba ckgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i";
$bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i";
if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) {
exit("<p>Known spam bots are not allowed.</p>");
}
foreach ($_POST as $key => $value) {
$value = trim($value);
if (empty($value)) {
exit("<p>Please fill in all the fields</p>");
} elseif (preg_match($exploits, $value)) {
exit("<p>Exploits and Malicious scripting not allowed</p>");
} elseif (preg_match($profanity, $value) || preg_match($spamwords, $value)){
exit("<p>Some words not allowed on this form</p>")
}
$_POST[$key] = stripslashes(strip_tags($value));
}
if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,6})$",strtolower($_POST["email"]))) {
exit("<p>Your email is not valid - please enter a valid e-mail address</p>");
}
$recipient = "india@mybeautifulcity.co.uk"
$subject = "Application form details"
$message = "You have received an application from : \n";
$message .= "First name: {$_POST['first_name']} \n";
$message .= "Last name: {$_POST['last_name']} \n";
$message .= "Title: {$_POST['title']} \n";
$message .= "Date of birth: {$_POST['dob']} \n";
$message .= "Gender: {$_POST['gender']} \n";
$message .= "Occupation: {$_POST['occupation']} \n";
$message .= "Job title: {$_POST['job_title']} \n";
$message = "Contact details are : \n";
$message .= "Address: {$_POST['address']} \n";
$message .= "City: {$_POST['city']} \n";
$message .= "County: {$_POST['county']} \n";
$message .= "E-mail: {$_POST['email']} \n";
if (mail($recipient,$subject,$message,$headers)) {
echo("<p>Thank you for applying, we will be in contact with you shortly</p>");
} else {
echo("<p>Sorry, there was an error processing your form - please contact UM by mail</p>")
}
?>