?
Current Path : /home1/savoy/public_html/savoyglobal.net/old_site/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/public_html/savoyglobal.net/old_site/models/mastermodel.php |
<?php class Mastermodel extends CI_Model { function __construct() { parent::__construct(); } function htmlmail($to,$subject,$content,$from) { $theboundary = "-----" . md5(uniqid("EMAIL")); $headers = "Date: " . date("r", time()) . "\r\n" . "From: $from" . "\r\n"; $baseContentType = "multipart/mixed"; $headers .= "X-Mailer: " . "PHP-EMAIL, Samplephpcodes.com" . "\r\n" . "MIME-Version: 1.0" . "\r\n" . "Content-Type: $baseContentType; " . "boundary=\"$theboundary\"" . "\r\n" . "\r\n"; $theemailtype = "text/html"; $Charset = "iso-8859-1"; $thebody = "--$theboundary" . "\r\n" . "Content-Type: $theemailtype; charset=$Charset" . "\r\n" . "Content-Transfer-Encoding: 8bit" . "\r\n" . "\r\n" . $content . "\r\n" . "\r\n"; $thebody .= "--$theboundary--"; return mail($to, $subject, $thebody, $headers); } function getdatas($table,$sortfield="",$sorttype="asc",$pagenum="") { $data = array(); $count= $this->db->count_all_results($table); $arr=$this->fpaginate->paginate($pagenum,$count); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $start=$arr[2]; $perpage=$arr[3]; $data['count']=$count; if(!empty($pagenum)) $this->db->limit($perpage, $start); if(!empty ($sortfield)) { $this->db->order_by($sortfield, $sorttype); } $data['results'] = $this->db->get($table); return $data; } function get_data($table,$id,$field,$sortfield="",$sorttype="asc",$pagenum="") { $data = array(); $this->db->where($field,$id); $this->db->get($table); $count= $this->db->count_all_results(); $arr=$this->fpaginate->paginate($pagenum,$count); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $start=$arr[2]; $perpage=$arr[3]; $data['count']=$count; $this->db->where($field,$id); if(!empty($sortfield)) { $this->db->order_by($sortfield, $sorttype); } $data['results'] = $this->db->get($table); return $data; } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function get_data_srow($table,$id,$field,$sortfield="") { $data = array(); $this->db->where($field,$id); if(!empty($sortfield)) { $this->db->order_by($sortfield,'asc'); } $Q= $this->db->get($table); $row=$Q->row(); return $row; } function deletedata($table,$field,$id) { $this->db->where($field,$id); $res=$this->db->delete($table); return $res; } function get_num_rows($table,$field,$value) { $this->db->where($field,$value); $Q= $this->db->get($table); return $Q->num_rows(); } function insert_contact($postdata) { $SpamCheck = "Y"; // Y or N $SpamReplaceText = "*content removed*"; $data=array(); $this->db->trans_begin(); $name = $postdata['q1_fullName1']['first']." ".$postdata['q1_fullName1']['last']; $organization = $postdata['q7_organization']; $contact_no = $postdata['q3_phoneNumber3']['area'].$postdata['q3_phoneNumber3']['phone']; $email = $postdata['q4_email4']; $website = $postdata['q5_website']; $type = $postdata['q8_inWhat8']; $comments = $postdata['q6_comments']; $tbl1Values=array('name'=>$name, 'organization'=>$organization, 'contact_no'=>$contact_no, 'email'=>$email, 'website'=>$website, 'type'=>$type, 'reference'=>$comments, 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('contact', $tbl1Values); $content='<table> <tr><td colspan="2">Savoyglobal.net contact form was submitted with the following information:</td></tr> <tr><td>Name :</td><td>'.$name.'</td></tr> <tr><td>Organization:</td><td>'.$organization.'</td></tr> <tr><td>Contact No:</td><td>'.$contact_no.'</td></tr> <tr><td>Email:</td><td>'.$email.'</td></tr> <tr><td>Website:</td><td>'.$website.'</td></tr> <tr><td>Type:</td><td>'.$type.'</td></tr> <tr><td>Comments:</td><td>'.$comments.'</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", "$organization")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$contact_no")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$email")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$website")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$type")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$comments")) {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); $organization = preg_replace($pattern, "", $organization); $contact_no = preg_replace($pattern, "", $contact_no); $email = preg_replace($pattern, "", $email); $website = preg_replace($pattern, "", $website); $type = preg_replace($pattern, "", $type); $reference = preg_replace($pattern, "", $comments); // 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); $organization = preg_replace($find, "$SpamReplaceText", $organization); $email = preg_replace($find, "$SpamReplaceText", $email); $contact_no = preg_replace($find, "$SpamReplaceText", $contact_no); $website = preg_replace($find, "$SpamReplaceText", $website); $type = preg_replace($find, "$SpamReplaceText", $type); $reference = preg_replace($find, "$SpamReplaceText", $comments); // Check to see if the fields contain any content we want to ban if(stristr($name, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($organization, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($email, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($contact_no, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($website, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($type, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($comments, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("jerrybabu@savoyglobal.net","Website Contact Form Filled",$content,$email); $this->db->trans_commit(); $data['res']=1; return $data; } } function insert_feedback($postdata) { $SpamCheck = "Y"; // Y or N $SpamReplaceText = "*content removed*"; $data=array(); $this->db->trans_begin(); $name = $postdata['q1_fullName1']['first']." ".$postdata['q1_fullName1']['last']; $contact_no = $postdata['q3_phoneNumber3']['area'].$postdata['q3_phoneNumber3']['phone']; $email = $postdata['q4_email4']; $comments = $postdata['q6_comments']; $datetime = date("Y-m-d H:i:s"); $tbl1Values=array('name'=>$name, 'contact_no'=>$contact_no, 'email'=>$email, 'message'=>$comments, 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('feedback', $tbl1Values); $content='<table> <tr><td colspan="2">SavoyGlobal.net feedback form was submitted with the following information:</td></tr> <tr><td>Name :</td><td>'.$name.'</td></tr> <tr><td>Contact No:</td><td>'.$contact_no.'</td></tr> <tr><td>Email:</td><td>'.$email.'</td></tr> <tr><td>Message:</td><td>'.$comments.'</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", "$contact_no")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$email")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$comments")) {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); $contact_no = preg_replace($pattern, "", $contact_no); $email = preg_replace($pattern, "", $email); $comments = preg_replace($pattern, "", $comments); // 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); $comments = preg_replace($find, "$SpamReplaceText", $comments); // 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($comments, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("jerrybabu@savoyglobal.net","Website Feedback form Filled",$content,$email); $this->db->trans_commit(); $data['res']=1; return $data; } } function insert_registration($postdata) { $SpamCheck = "Y"; // Y or N $SpamReplaceText = "*content removed*"; $data=array(); $this->db->trans_begin(); $name = $postdata['q1_fullName1']['first']." ".$postdata['q1_fullName1']['last']; $contact_no = $postdata['q3_phoneNumber3']['area'].$postdata['q3_phoneNumber3']['phone']; $email = $postdata['q4_email4']; $comments = $postdata['q6_comments']; $datetime = date("Y-m-d H:i:s"); $tbl1Values=array('name'=>$name, 'contact_no'=>$contact_no, 'email'=>$email, 'message'=>$comments, 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('feedback', $tbl1Values); $content='<table> <tr><td colspan="2">SavoyGlobal.net EELPS registration form was submitted with the following information:</td></tr> <tr><td>Name :</td><td>'.$name.'</td></tr> <tr><td>Contact No:</td><td>'.$contact_no.'</td></tr> <tr><td>Email:</td><td>'.$email.'</td></tr> <tr><td>Message:</td><td>'.$comments.'</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", "$contact_no")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$email")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$comments")) {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); $contact_no = preg_replace($pattern, "", $contact_no); $email = preg_replace($pattern, "", $email); $comments = preg_replace($pattern, "", $comments); // 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); $comments = preg_replace($find, "$SpamReplaceText", $comments); // 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($comments, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("jerrybabu@savoyglobal.net,sajan@savoyglobal.net","EELPS Regsitration Received",$content,$email); $this->db->trans_commit(); $data['res']=1; return $data; } } function insert_training_registration($postdata) { $SpamCheck = "Y"; // Y or N $SpamReplaceText = "*content removed*"; $data=array(); $this->db->trans_begin(); $name = $postdata['q3_name']['first'].$postdata['q3_name']['last']; $organization = $postdata['q6_organization']; $contact_no = $postdata['q5_contactNumber']['area'].$postdata['q5_contactNumber']['phone']; $email = $postdata['q4_email4']; $website = $postdata['q7_website']; $type = $postdata['q8_inWhat']; $location = $postdata['q17_location']; $reference = $postdata['q9_howDid']; $training_title = $postdata['q11_trainingService']; $tbl1Values=array('name'=>$postdata['q3_name']['first'].$postdata['q3_name']['last'], 'organization'=>$postdata['q6_organization'], 'contact_no'=>$postdata['q5_contactNumber']['area'].$postdata['q5_contactNumber']['phone'], 'email'=>$postdata['q4_email4'], 'website'=>$postdata['q7_website'], 'type'=>$postdata['q8_inWhat'], 'reference'=>$postdata['q9_howDid'], 'location'=>$postdata['q17_location'], 'training_id'=>$postdata['q12_trainingService_id'], 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('training_registration', $tbl1Values); $content='<table> <tr><td colspan="2">SavoyGlobal.net feedback form was submitted with the following information:</td></tr> <tr><td>Name :</td><td>'.$name.'</td></tr> <tr><td>Organization:</td><td>'.$organization.'</td></tr> <tr><td>Contact No:</td><td>'.$contact_no.'</td></tr> <tr><td>Email:</td><td>'.$email.'</td></tr> <tr><td>Website:</td><td>'.$website.'</td></tr> <tr><td>Type:</td><td>'.$type.'</td></tr> <tr><td>Reference:</td><td>'.$reference.'</td></tr> <tr><td>Location:</td><td>'.$location.'</td></tr> <tr><td>Training Service:</td><td>'.$training_title.'</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", "$organization")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$contact_no")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$email")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$website")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$type")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$reference")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$location")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/i", "$training_title")) {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); $organization = preg_replace($pattern, "", $organization); $contact_no = preg_replace($pattern, "", $contact_no); $email = preg_replace($pattern, "", $email); $website = preg_replace($pattern, "", $website); $type = preg_replace($pattern, "", $type); $reference = preg_replace($pattern, "", $reference); $location = preg_replace($pattern, "", $location); $training_title = preg_replace($pattern, "", $training_title); // 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); $organization = preg_replace($find, "$SpamReplaceText", $organization); $email = preg_replace($find, "$SpamReplaceText", $email); $contact_no = preg_replace($find, "$SpamReplaceText", $contact_no); $website = preg_replace($find, "$SpamReplaceText", $website); $type = preg_replace($find, "$SpamReplaceText", $type); $reference = preg_replace($find, "$SpamReplaceText", $reference); $location = preg_replace($find, "$SpamReplaceText", $location); $training_title = preg_replace($find, "$SpamReplaceText", $training_title); // Check to see if the fields contain any content we want to ban if(stristr($name, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($organization, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($email, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($contact_no, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($website, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($type, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($reference, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($location, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} if(stristr($training_title, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("jerrybabu@savoyglobal.net","Training Registration Received",$content,$email); $this->db->trans_commit(); $data['res']=1; return $data; } } } ?>