• 0

Estimate form stopped working


Question

I created an estimate form for a friends business website a few months ago, but recently he noticed the form no longer works. The page would just reload after pressing submit instead of showing

"Your form was successfully sent."

The form is located here - http://solidremodelersinc.com/index-2.php

I have no idea what might have happened anyone got a clue??

<?php
// OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!




function isBot() {
	$bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot");
	$isBot = false;

	foreach ($bots as $bot)
	if (strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
		$isBot = true;

	if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
		$isBot = true;

	return $isBot;
}

if ($_SERVER['REQUEST_METHOD'] == "POST") {
	if (isBot())
		exit("Bots not allowed.</p>");

	function clean($data) {
		$data = trim(stripslashes(strip_tags($data)));
		return $data;
	}

	// lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. 
	// score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam :)
	$points = (int)0;

	$badwords = array("adult", "beastial", "bestial", "*******", "clit", "######", "cunilingus", "cunillingus", "cunnilingus", "****", "ejaculate", "***", "felatio", "fellatio", "****", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "porn", "*******", "*****", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur");
	$exploits = array("content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");

	foreach ($badwords as $word)
		if (strpos($_POST['comments'], $word) !== false)
			$points += 2;

	foreach ($exploits as $exploit)
		if (strpos($_POST['comments'], $exploit) !== false)
			$points += 2;

	if (strpos($_POST['comments'], "http://") === true || strpos($_POST['comments'], "www.") === true)
		$points += 2;
	if (isset($_POST['nojs']))
		$points += 1;
	if (preg_match("/(<.*>)/i", $_POST['comments']))
		$points += 2;
	if (strlen($_POST['name']) < 3)
		$points += 1;
	if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
		$points += 2;
	// end score assignments

	if (empty($_POST['name'])) {
		$error_msg .= "Name is required. \n";
	} elseif (strlen($_POST['name']) > 15) {
		$error_msg .= "The name field is limited at 15 characters. Your first name or nickname will do! \n";
	} elseif (!ereg("^[A-Za-z' -]*$", $_POST['name'])) {
		$error_msg .= "The name field must not contain special characters. \n";

	} elseif (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i', $_POST['url']))
		$error_msg .= "Invalid website url.";

	if ($error_msg == NULL && $points <= $maxPoints) {
		$subject = "Automatic Form Email";

		$message = "You received this e-mail message through your website: \n\n";
		foreach ($_POST as $key => $val) {
			$message .= ucwords($key) . ": $val \r\n";
		}
		$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
		$message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
		$message .= 'Points: '.$points;

		if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
			$headers   = "From: $yourEmail \r\n";
			$headers  .= "Reply-To: {$_POST['email']}";
		} else {
			$headers   = "From: $yourWebsite <$yourEmail> \r\n";
			$headers  .= "Reply-To: {$_POST['email']}";
		}

		if (mail($yourEmail,$subject,$message,$headers)) {
			echo '<p>Your form was successfully sent.</p>';
		} else {
			echo '<p>Your mail could not be sent this time.</p>';
		}
	}
}
function get_data($var) {
	if (isset($_POST[$var]))
		echo htmlspecialchars($_POST[$var]);
}
if ($error_msg != NULL) {
	echo '<p><strong style="color: red;">ERROR:</strong><br />';
	echo nl2br($error_msg) . "</p>";
}
?>
                        <form action="index-2.php" method="post">
                          <noscript>
		<input type="hidden" name="nojs" id="nojs" />
</noscript>
<fieldset>
  <legend>Contact Information:</legend>

  <label for="name" class="required">Name: </label>
  <input type="text" id="name" name="name" tabindex="1" value="" title="name">

  <label for="address1" class="required label2"> Address: </label>
  <input type="text" id="streetaddress1" name="address1" tabindex="2" title="street address1">

  <label for="city" class="required label2">City: </label>
  <input type="text" id="city" name="city" tabindex="3" title="city">

  <label for="zip" class="required label2">Zip: </label>
  <input type="text" id="zip" name="zip" tabindex="4" title="zip">

  <br>        
  <label for="email1">Email: </label>
  <input type="text" id="email1" name="email1" tabindex="5" title="email address">

  <label for="phoneMain" class="required label2">Main phone: </label>
  <input type="text" id="phoneMain" name="phoneMain" tabindex="6" title="main phone">

  <label for="phoneCell" class="label2">Cell: </label>
  <input type="text" id="phoneCell" name="phoneCell" tabindex="7" title="cell phone">

  <label for="phoneFax" class="label2">Fax: </label>

  <input type="text" id="phoneFax" name="phoneFax" tabindex="8" title="fax number">

  <!--    <label for="address2" class="required">Address (cont):</label>
	<input type="text" id="streetaddress2" name="address2" tabindex="5" title="street address2">-->

  </fieldset>

                          <fieldset>
                            <legend>Project Site Information</legend>

                            <label for="units">Deck Type: </label>

                            <select name="deckType" size="1" id="DeckType" tabindex="9" title="deck type">
                              <option value="" selected></option>

                              <option value="Garage">Garage</option>
                              <option value="Rooftop">Rooftop</option>
                              <option value="Ground Level">Ground Level</option>
                            </select>
                            <br>
                            <label for="location">Porch Location: </label>

                            <select name="porchLocation" size="1" id="PorchLocation" tabindex="10" title="porch location">
                              <option value="" selected></option>

                              <option value="Front">Front</option>
                              <option value="Rear">Rear</option>
                            </select>

                            <label for="" class="label2">Type: </label>

                            <select name="porchType" size="1" id="PorchType" tabindex="11" title="porch type">
                              <option value="" selected></option>
                              <option value="Open">Open</option>

                              <option value="Enclosed">Enclosed</option>
                            </select>

                            <label for="stories" class="label2"># Stories: </label>

                            <select class="small" name="numStories" size="1" id="Stories" tabindex="12" title="stories">
                              <option value="" selected></option>
                              <option value="1">1</option>
                              <option value="2">2</option>

                              <option value="3">3</option>
                              <option value="4+">4+</option>
                            </select>

                            <label for="units" class="label2"># Units: </label>

                            <select class="small" name="numUnits" size="1" id="Units" tabindex="13" title="units">
                              <option value="" selected></option>
                              <option value="1">1</option>

                              <option value="2">2</option>
                              <option value="3">3</option>
                              <option value="4-6">4-6</option>
                              <option value="6-10">6-10</option>
                              <option value="10+">10+</option>
                            </select>
                            <br>

                            <label for="siteAddress1" class="required">Site Address: </label>
                            <input type="text" id="siteAddress1" name="siteAddress1" tabindex="14" title="site address1">

                            <label for="siteCity" style="width:85px" class="required label2">City: </label>
                            <input type="text" id="siteCity" name="siteCity" tabindex="15" title="site city">

                            <label for="siteZip" style="width:85px" class="required label2">Zip: </label>
                            <input type="text" style="width:50px" id="siteZip" name="siteZip" tabindex="16" title="site zip">
                            <br>
                            <label for="violation">Violation Notice? </label>

                            <label for="violationYes" class="labelsmall">Yes</label>

                            <input class="small" name="violationNotice" type="radio" id="Yes" title="yes" tabindex="17" value="Yes">

                            <label for="violationNo" class="labelsmall">No</label>
                            <input class="small" name="violationNotice" type="radio" id="No" title="no" tabindex="18" value="No">

                          </fieldset>

                          <fieldset>

                            <legend>Access Information</legend>

<p>
  <label for="entryContactName" class="required">Contact for Entry:</label>
  <input type="text" id="entryContactName" name="name1" tabindex="22" value="" title="name1">

  <label for="entryContactPhone" class="required label2">Phone: </label>
  <input type="text" id="entryContactPhone" name="phone" tabindex="23" title="phone">

  <!--<label for="entryContactTime" class="required">Best time to call? </label>
		<input type="text" id="entryContactTime" name="best time to call" tabindex="24" title="contactTime"><br>
-->
  <label for="entryContactTime">Best time to call? </label>

  <select name="best time to call?" size="1" id="entryContactTime" tabindex="24" title="contactTime">
    <option value="" selected></option>
    <option value="8AM-10AM">8AM-10AM</option>
    <option value="10AM-2PM">10AM-2PM</option>

    <option value="2PM-6PM">2PM-6PM</option>
  </select>


  <label for="propertyAccess" class="label3">The property is open and an estimator can gain access anytime? </label>

  <label for="propertyAccessYes" class="labelsmall">Yes</label>
  <input name="propertyAccess" type="radio" class="small" tabindex="26" title="yes" value="Yes">

  <label for="propertyAccessNo" class="labelsmall">No</label>
  <input name="propertyAccess" type="radio" class="small" tabindex="27" title="no" value="No">

  <br>

  <label for="gateAccess" class="label3">The gates are locked but we will leave them open if you call us the night before? </label>

  <label for="gateAccessYes" class="labelsmall">Yes</label>
  <input name="gateAccess" type="radio" class="small" id="Yes" tabindex="28" title="yes" value="Yes">

  <label for="gateAccessNo" class="labelsmall">No</label>
  <input name="gateAccess" type="radio" class="small" id="No" tabindex="29" title="no" value="No">

  <br>

  <label for="appointment" class="label3">An APPOINTMENT is necessary to view the property (not willing to leave gate open or must access deck through the house or condo unit)? </label>

  <label for="appointmentYes" class="labelsmall">Yes</label>
  <input name="appointment" type="radio" class="small" id="Yes" tabindex="30" title="yes" value="Yes">

  <label for="appointmentNo" class="labelsmall">No</label>
  <input name="appointment" type="radio" class="small" id="No" tabindex="31" title="no" value="No">

  <br>

  <label for="appointmentAvailability" class="label3">If an appointment is necessary please leave information as to when you are generally available: </label>
  <input style="width:195px" type="text" id="appointmentAvail" name="appt. availability" tabindex="32" value="" title="appt. availability">

  <br>

  <label for="comments" class="label3">Additional comments or notes: </label>
  <textarea  style="width:195px" cols="17" rows="1" name="comments" id="comments" tabindex="33" title="additional comments"></textarea>

  <input type="hidden" style="width:0" name="form_order" value="default">
  <input type="hidden" style="width:0" name="form_delivery" value="default">
  <input type="hidden" style="width:0" name="form_format" value="csv">
  <input type="hidden" style="width:0" name="n05p4m" value="n05p4m">
  <input class="submit" type="submit" name="Submit" id="submit" value="submit" tabindex="34">
  <input class="submit" type="reset" name="Reset" id="reset" value="reset" tabindex="35">
  <br />
  </fieldset>                          
</form>

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

What control panel is provided from the hosting company? Either way if he has access to a default email account, have him look it up to see what bounced emails he's receiving as well as have him look at error logs if there are any.

If anything it could be that a.) the IP address is blacklist for spam, b.) there's an issue with sending mail through php();.

Link to comment
Share on other sites

  • 0

From a quick glance...

if ($error_msg == NULL && $points <= $maxPoints) {

You don't have $maxPoints set to anything above that line... so that line will fail everytime.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.