setError(checkRequired($post,$required)); if(!empty($post['email'])){ if(!is_email($post['email'])) $errors->setError('Email is invalid format.'); } if(!empty($post['security_code'])){ if($post['security_code'] != $_SESSION['code']) $errors->setError('You have entered an invalid security code.'); } $error = $errors->getError(); if(!$error){ $post['ip'] = $_SERVER['REMOTE_ADDR']; $mail = new main; $mail->Template('sendmail'); $mail->Parameter('name',SITE_NAME.' Admin'); $mail->Parameter('email_body','A user has submitted a request or comments using the contact us form. Here is the details of the request.

Name:'.$post['name'].'
Email:'.$post['email'].'
Comments:'.cleanHTML(nl2br($post['comments'])).'
IP:'.$post['ip'].'
'); $mail->Parameter('base_url',BASE_URL); $mail->Parameter('site_name',SITE_NAME); $msg = $mail->Display(); sendemail(SITE_NAME,SITE_EMAIL,SITE_EMAIL,SITE_NAME.' - Contact Us',$msg); $post['status'] = 1; $post['date_added'] = 'NOW()'; insertRecords('contact_us',$post,'request'); exit; } } $class = new main; $class->Template('main'); $class->Parameter('stylesheets',includeStylesheets(array('main','home','png','menu'))); $class->Parameter('scripts',includeScripts(array('jquery','menu'))); $class->Parameter('meta_tags',NULL); $class->Parameter('title',SITE_NAME); displayOtherTags($class); $class->Parameter('contents',(!$sText) ? displayTemplate('contact_us') : $sText); $fields = array('name','email','comments'); foreach($fields as $sKey) $class->Parameter($sKey,$post[$sKey]); $class->Parameter('code',''); $class->Parameter('site_name',SITE_NAME); $class->Parameter('site_contact_number',SITE_CONTACT_NUMBER); $class->Parameter('error',($error) ? ''.$error.'' : NULL); echo $class->Display(); include('footer.php'); /**************** private functions ***********/ ?>