?
Current Path : /home1/savoy/www/old_site/application/models/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/www/old_site/application/models/mastermodel.php |
<?php class Mastermodel extends CI_Model { function __construct() { parent::__construct(); } function htmlmail($to,$subject,$content,$from) { $this->mail->send($content, $to,$subject,'isrishti.technologies@gmail.com','Savoy Insurance','gm@crunchc2*#','smtp.gmail.com'); } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function insert_feedback($postdata) { $SpamCheck = "Y"; // Y or N $SpamReplaceText = "*content removed*"; $data=array(); $this->db->trans_begin(); $name = $postdata['name']; $contact_no = $postdata['contact_no']; $email = $postdata['email']; $subject = $postdata['subject']; $message = $postdata['message']; $datetime = date("Y-m-d H:i:s"); $tbl1Values=array('name'=>$name, 'email'=>$email, 'contactno'=>$contact_no, 'subject'=>$subject, 'comments'=>$message, 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('contactus', $tbl1Values); $content='<table> <tr><td colspan="2">Savoysinsurance.com Contact form was submitted with the following information:</td></tr> <tr><td>Name :</td><td>'.$name.'</td></tr> <tr><td>Email:</td><td>'.$email.'</td></tr> <tr><td>Contact No:</td><td>'.$contact_no.'</td></tr> <tr><td>Subject:</td><td>'.$subject.'</td></tr> <tr><td>Message:</td><td>'.$message.'</td></tr> </table>'; if ($SpamCheck == "Y") { // Check for Website URL's in the form input boxes as if we block website URLs from the form, // then this will stop the spammers wastignt ime sending emails if (preg_match("/http/i", "$name")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$email")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$contact_no")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$subject")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$message")) {echo "$SpamErrorMessage"; exit();} // Patterm match search to strip out the invalid charcaters, this prevents the mail injection spammer $pattern = '/(;|\||`|>|<|&|^|"|'."\n|\r|'".'|{|}|[|]|\)|\()/i'; // build the pattern match string $name = preg_replace($pattern, "", $name); $email = preg_replace($pattern, "", $email); $contact_no = preg_replace($pattern, "", $contact_no); $subject = preg_replace($pattern, "", $subject); $message = preg_replace($pattern, "", $message); // Check for the injected headers from the spammer attempt // This will replace the injection attempt text with the string you have set in the above config section $find = array("/bcc\:/i","/Content\-Type\:/i","/cc\:/i","/to\:/i"); $name = preg_replace($find, "$SpamReplaceText", $name); $email = preg_replace($find, "$SpamReplaceText", $email); $contact_no = preg_replace($find, "$SpamReplaceText", $contact_no); $subject = preg_replace($find, "$SpamReplaceText", $subject); $message = preg_replace($find, "$SpamReplaceText", $message); // Check to see if the fields contain any content we want to ban if(stristr($name, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($email, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($contact_no, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($subject, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($message, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("jerry.babu@savoysinsurance.com","Website Contact form Filled",$content,$email); $this->db->trans_commit(); $data['res']=1; return $data; } } function checkexistence($table,$field,$value) { $this->db->from($table); $this->db->where($field, $value); $count= $this->db->count_all_results(); return $count; } function saverequest() { $this->db->insert('request', $_POST); } } ?>