![]() |
|||||||||
|
Contact Us Contact us by phone at 860.347.1704, fax at 860.346.3707 or via email using the form below. "Joan Gillespie, Executive Director", "asc" => "Andy Gardner, Associate Director", "sys" => "Richard Widlansky, Systems Manager", "nst" => "Matthew Beardsley, PC Network Manager", "om" => "Patty Hovick, Office Manager", "cat" => "Karan Conover, Cataloger"); // ------------------------ emailId emailAddress var $validEmailList = array('wbr' => 'wbrstaff@lioninc.org', 'jra' => 'jrabin@ci.woodbridge.ct.us', 'wal' => 'walform@lioninc.org', 'oly' => 'pgn-lib@oldlyme.lioninc.org', 'dir' => 'jgillespie@lioninc.org', 'asc' => 'agardner@lioninc.org', 'sys' => 'rwidlans@lioninc.org', 'tst' => 'imagejin@yahoo.com', 'nst' => 'mbeards@lioninc.org', 'om' => 'phovick@lioninc.org', 'cat' => 'kconover@lioninc.org'); var $_contactMethodList = array("email" => "Email", "phone" => "Phone"); var $_parameterMap = array("recipient" => "recipient", "realname" => "realname", "email" => "email", "phone" => "phone", "contact" => "contact", "subject" => "subject", "body_text" => "bodyText", "return_link_url" => "returnLinkUrl", "return_link_title" => "returnLinkTitle", "PHP_SELF" => "_phpSelf", "HTTP_HOST" => "_httpHost", "SCRIPT_NAME" => "_scriptName", "HTTP_REFERER" => "_referrer", "current_state" => "currentState"); function _grabValues($inputArray, $mapping) { if (is_array($inputArray) && is_array($mapping)) { foreach ($inputArray as $rawName => $value) { if (isset($mapping[$rawName])) { eval("\$this->" . $mapping[$rawName] . " = \"$value\";"); } } } } function MailForm($get, $post, $cookie, $server, $parameterMap = false) { if (! is_array($parameterMap)) { $parameterMap = $this->_parameterMap; } $this->currentState = "showForm"; $this->_grabValues($get, $parameterMap); $this->_grabValues($post, $parameterMap); $this->_grabValues($cookie, $parameterMap); $this->_grabValues($server, $parameterMap); } function Run() { for ( ; ; ) { // *** DEBUG *** print "MailForm->Run: " . $this->currentState . "\n\n"; if ($this->currentState && method_exists($this, $this->currentState)) { $StateHandlerCall = "\$this->currentState = \$this->" . $this->currentState . "();"; $retValue = eval($StateHandlerCall); } else { $this->currentState = false; break; } } } function showForm() { ?> return false; } function validateInput() { $retValue = true; // Assume the best but don't be disappointed. // Empty out the list of errors. $this->errors = array(); // Comment the next line if you want to test referrer against a // constant value otherwise the system will try to figure out what // this page is from the $_SERVER variables. $validReferrer = "http://" . $this->_httpHost . $this->_scriptName; // $validReferrer = VALID_REFERRER; // Uncomment this next stanza if you want to test the referrer // page. It's really not all that great a test though. // // // if ($this->_referrer != $validReferrer) { // $this->errors[] = "Invalid referrer page: \"" . $this->_referrer . "\"! Expected: $validReferrer"; // $retValue = false; // } // // The email recipient must be on the list. if (! isset($this->validEmailList[$this->recipient])) { $this->errors[] = ("The recipient: " . $this->recipient . " is invalid. Please choose a recipient from the list."); $retValue = false; } // None of the input parameters which control the headers should // contain a carriage return or a line feed. If they do it's // probably someone poisoning the headers to spam people through // our form. $headerFields = array("realname" => $this->realname, "email" => $this->email, "phone" => $this->phone, "subject" => $this->subject); $badHeaderChars = array("\n", "\r"); foreach ($headerFields as $fieldName => $checkField) { foreach ($badHeaderChars as $testCh) { $testArray = explode($testCh, $checkField); if (count($testArray) > 1) { $this->realname = ""; $this->email = ""; $this->phone = ""; $this->subject = ""; $this->errors[] = "Invalid characters in header: $fieldName -- Possible header poisoning attack."; $retValue = false; } } } if ($this->realname == "") { $this->errors[] = ("Please enter your name."); $retValue = false; } if (! isset($this->_contactMethodList[$this->contact])) { $this->errors[] = ("Invalid contact method: \"" . $this->contact . "\"."); $retValue = false; } if ($this->contact == "phone") { if ($this->phone == "") { $this->errors[] = "Please enter your phone number."; $retValue = false; } } elseif ($this->contact == "email") { if ($this->email == "") { $this->errors[] = "Please enter your email address."; $retValue = false; } } return $retValue; } function invalidParameters() { print " The form had the following errors: \n"; foreach ($this->errors as $errMsg) { print "$errMsg\nPlease fix them and try again:\n\n"; return "showForm"; } function sendMail() { $headers = ""; $msg = ""; if (! $this->validateInput()) { return "invalidParameters"; } // Translate the emailId for the recipient into an emailAddress. $recipient = $this->validEmailList[$this->recipient]; // If this guy has specified that he wants to be contacted by // phone then fake up an email for him and make absolutly certain // that his name and phone number appear in the message. if ($this->contact == "phone") { $realname = $this->realname . " - " . $this->phone; $email = "www@lioninc.org"; $this->bodyText .= "\n\n----------------------------------------\n$realname\n"; } else { $realname = $this->realname; $email = $this->email; } // Calculate the fullEmail address. $fullEmail = "\"" . $realname . "\" <" . $email . ">"; // Format the message. $headers = "To: " . $recipient . "\n"; $headers .= "From: " . $fullEmail . "\n"; $headers .= "Subject: " . $this->subject . "\n"; $msg = $this->bodyText; $mailCommand = escapeshellcmd(SENDMAIL_PATH . " -i -t -f ". $email); // $mailCommand = escapeshellcmd(SENDMAIL_PATH . " -i -t"); if ($mailStream = popen($mailCommand, "w")) { fwrite($mailStream, $headers); fwrite($mailStream, "\n"); fwrite($mailStream, $msg); pclose($mailStream); $this->result = "Mail sent!"; } else { $this->result = "Mail command failed!"; } return "showResult"; } function showResult() { ?> Thank you for your comments. We will review them and contact you.
|
||||||||||||||
Home
About Us Member
Services Lion Libraries
Board Documents 100 Riverview Center Suite 252 Middletown, CT 860-347-1704 Fax: 860-346-3707 |
|||||||||||||||