I crack Photoshop!
Posts: 3
30 credits Members referred : 0
« on: Jun 23, 2007, 08:37:54 am »
Does anyone know of a free php form processing script that would allow me to set some fields as required, can both send to an email address and populate a flat file (something I could export to Excel) AND is easy to set up?
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Jun 23, 2007, 10:49:33 am »
its not so hard for someone with moderate php skills
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #2 on: Jun 23, 2007, 11:23:47 am »
I've always wanted to release a class for form processing, but I guess you will have to wait a little for this
public function addRule($fieldName, $rule, $message, $value = '') { $this->rules[] = array($fieldName, $rule, $message, $value); }
private function checkEMail($email) { if ((preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) || (preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/', $email))) { if (!function_exists('checkdnsrr')) { function checkdnsrr($hostName, $recType = '') { return true; //does not work properly on Windows
if (strlen($hostName) > 0) { if ($recType == '') $recType = "MX";
//check each line to find the one that starts with the host //name. If it exists then the function succeeded. foreach ($result as $line) { if (eregi("^$hostName", $line)) { return true; } }
//otherwise there was no mail handler for the domain return false; } return false; } }
$host = substr(strrchr($email, '@'), 1);
if (checkdnsrr($host . '.', 'MX')) return true; if (checkdnsrr($host . '.', 'A')) return true; if (checkdnsrr($host . '.', 'CNAME')) return true; }
return false; }
public function validateForm($requestArray = array()) { if (!is_array($requestArray) || (count($requestArray) == 0)) { $requestArray = $_REQUEST; }