?
Current Path : /home1/savoy/public_html/savoyglobal.net/badminton2013/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/public_html/savoyglobal.net/badminton2013/application/models/mastermodel.php |
<?php class Mastermodel extends CI_Model { function __construct() { parent::__construct(); } function htmlmail($subject,$content) { $this->mail->send($content, $subject,'info@savoyglobal.net','Savoy Badminton Tournament 2013','savoy1975','smtp.gmail.com',1); } 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']; $comments = $postdata['q6_comments']; $tbl1Values=array('name'=>$name, 'organization'=>$organization, 'contact_no'=>$contact_no, 'email'=>$email, 'website'=>$website, 'reference'=>$comments, 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('contact', $tbl1Values); $content='<table> <tr><td colspan="2">Savoyglobal.net/badminton2012 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>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", "$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); $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); $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($comments, $SpamReplaceText) !== FALSE) {echo "$SpamErrorMessage"; exit();} } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("Badminton Website Contact Form Filled",$content); $this->db->trans_commit(); $data['res']=1; return $data; } } function insert_registration($postdata) { if($postdata['registration_type']==1) { $tbl1Values=array( 'registration_singles_company_name'=>$postdata['q1_company'], 'registration_singles_player_name'=>$postdata['q17_name'], 'registration_singles_player_designation'=>$postdata['q18_designation'], 'registration_singles_qatar_id'=>$postdata['q19_qatar_id'], 'registration_singles_contact_no'=>$postdata['q20_contact_no'], 'registration_singles_email'=>$postdata['q21_email'], 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('registration_singles', $tbl1Values); $content='<table> <tr><td colspan="2">Savoyglobal.net/badminton2013 registration form for singles event was submitted with the following information:</td></tr> <tr><td>Company Name :</td><td>'.$postdata['q1_company'].'</td></tr> <tr><td>Player Name:</td><td>'.$postdata['q17_name'].'</td></tr> <tr><td>Designation:</td><td>'.$postdata['q18_designation'].'</td></tr> <tr><td>Qatar Id:</td><td>'.$postdata['q19_qatar_id'].'</td></tr> <tr><td>Contact No:</td><td>'.$postdata['q20_contact_no'].'</td></tr> <tr><td>Email:</td><td>'.$postdata['q21_email'].'</td></tr> </table>'; } if($postdata['registration_type']==2) { $tbl1Values=array( 'registration_doubles_company_name'=>$postdata['q1_company'], 'registration_doubles_player_name_1'=>$postdata['q27_name'], 'registration_doubles_player_designation_1'=>$postdata['q28_designation'], 'registration_doubles_qatar_id_1'=>$postdata['q29_qatar_id'], 'registration_doubles_contact_no_1'=>$postdata['q30_contact_no'], 'registration_doubles_email_1'=>$postdata['q31_email'], 'registration_doubles_player_name_2'=>$postdata['q271_name'], 'registration_doubles_designation_2'=>$postdata['q281_designation'], 'registration_doubles_qatar_id_2'=>$postdata['q291_qatar_id'], 'registration_doubles_contact_no_2'=>$postdata['q301_contact_no'], 'registration_doubles_email_2'=>$postdata['q302_email'], 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('registration_doubles', $tbl1Values); $content='<table> <tr><td colspan="2">Savoyglobal.net/badminton2013 registration form for doubles event was submitted with the following information:</td></tr> <tr><td>Company Name :</td><td>'.$postdata['q1_company'].'</td></tr> <tr><td></td><td></td></tr> <tr><td>Player1 Name:</td><td>'.$postdata['q27_name'].'</td></tr> <tr><td>Designation:</td><td>'.$postdata['q28_designation'].'</td></tr> <tr><td>Qatar Id:</td><td>'.$postdata['q19_qatar_id'].'</td></tr> <tr><td>Contact No:</td><td>'.$postdata['q30_contact_no'].'</td></tr> <tr><td>Email:</td><td>'.$postdata['q31_email'].'</td></tr> <tr><td></td><td></td></tr> <tr><td>Player2 Name:</td><td>'.$postdata['q271_name'].'</td></tr> <tr><td>Designation:</td><td>'.$postdata['q281_designation'].'</td></tr> <tr><td>Qatar Id:</td><td>'.$postdata['q291_qatar_id'].'</td></tr> <tr><td>Contact No:</td><td>'.$postdata['q301_contact_no'].'</td></tr> <tr><td>Email:</td><td>'.$postdata['q302_email'].'</td></tr> </table>'; } if($postdata['registration_type']==3) { $tbl1Values=array( 'registration_mixed_company_name'=>$postdata['q1_company'], 'registration_mixed_player_name_1'=>$postdata['q37_name'], 'registration_mixed_player_designation_1'=>$postdata['q38_designation'], 'registration_mixed_qatar_id_1'=>$postdata['q39_qatar_id'], 'registration_mixed_contact_no_1'=>$postdata['q40_contact_no'], 'registration_mixed_email_1'=>$postdata['q41_email'], 'registration_mixed_player_name_2'=>$postdata['q371_name'], 'registration_mixed_designation_2'=>$postdata['q381_designation'], 'registration_mixed_qatar_id_2'=>$postdata['q391_qatar_id'], 'registration_mixed_contact_no_2'=>$postdata['q401_contact_no'], 'registration_mixed_email_2'=>$postdata['q402_email'], 'datetime'=>date("Y-m-d H:i:s")); $this->db->insert('registration_mixed', $tbl1Values); $content='<table> <tr><td colspan="2">Savoyglobal.net/badminton2013 registration form for mixed doubles event was submitted with the following information:</td></tr> <tr><td>Company Name :</td><td>'.$postdata['q1_company'].'</td></tr> <tr><td></td><td></td></tr> <tr><td>Player1 Name:</td><td>'.$postdata['q37_name'].'</td></tr> <tr><td>Designation:</td><td>'.$postdata['q38_designation'].'</td></tr> <tr><td>Qatar Id:</td><td>'.$postdata['q39_qatar_id'].'</td></tr> <tr><td>Contact No:</td><td>'.$postdata['q40_contact_no'].'</td></tr> <tr><td>Email:</td><td>'.$postdata['q41_email'].'</td></tr> <tr><td></td><td></td></tr> <tr><td>Player2 Name:</td><td>'.$postdata['q371_name'].'</td></tr> <tr><td>Designation:</td><td>'.$postdata['q381_designation'].'</td></tr> <tr><td>Qatar Id:</td><td>'.$postdata['q391_qatar_id'].'</td></tr> <tr><td>Contact No:</td><td>'.$postdata['q401_contact_no'].'</td></tr> <tr><td>Email:</td><td>'.$postdata['q402_email'].'</td></tr> </table>'; } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->mastermodel->htmlmail("Badminton Website Regsitration Form Filled",$content); $this->db->trans_commit(); $data['res']=1; return $data; } } function get_data_table($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); if ($Q->num_rows() > 0) { foreach ($Q->result_array() as $row) { $data[] = $row; } } $Q->free_result(); return $data; } } ?>