?
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/adminmodel.php |
<?php class Adminmodel extends CI_Model { function __construct() { parent::__construct(); } function authenticate($username,$password) { $passwordmd5=md5($password); $query= $this->db->query("select * from user where username='$username' and password='$passwordmd5'"); $data['numrows']=$query->num_rows(); if($query->num_rows()>0) { $result= $query->row(); $data['userid']= $result->user_id; $data['username']=$username; return $data; } else return 0; } function update_singles($postdata) { $this->db->trans_begin(); $tbl1Values=array( 'registration_singles_company_name'=>$postdata['registration_singles_company_name'], 'registration_singles_player_name'=>$postdata['registration_singles_player_name'], 'registration_singles_player_designation'=>$postdata['registration_singles_player_designation'], 'registration_singles_qatar_id'=>$postdata['registration_singles_qatar_id'], 'registration_singles_contact_no'=>$postdata['registration_singles_contact_no'], 'registration_singles_email'=>$postdata['registration_singles_email'], 'active'=>$postdata['active']); $this->db->where('registration_singles_id', $postdata['registration_singles_id']); $this->db->update('registration_singles', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_doubles($postdata) { $this->db->trans_begin(); $tbl1Values=array( 'registration_doubles_company_name'=>$postdata['registration_doubles_company_name'], 'registration_doubles_player_name_1'=>$postdata['registration_doubles_player_name_1'], 'registration_doubles_player_designation_1'=>$postdata['registration_doubles_player_designation_1'], 'registration_doubles_qatar_id_1'=>$postdata['registration_doubles_qatar_id_1'], 'registration_doubles_contact_no_1'=>$postdata['registration_doubles_contact_no_1'], 'registration_doubles_email_1'=>$postdata['registration_doubles_email_1'], 'registration_doubles_player_name_2'=>$postdata['registration_doubles_player_name_2'], 'registration_doubles_designation_2'=>$postdata['registration_doubles_designation_2'], 'registration_doubles_qatar_id_2'=>$postdata['registration_doubles_qatar_id_2'], 'registration_doubles_contact_no_2'=>$postdata['registration_doubles_contact_no_2'], 'registration_doubles_email_2'=>$postdata['registration_doubles_email_2'], 'active'=>$postdata['active']); $this->db->where('registration_doubles_id', $postdata['registration_doubles_id']); $this->db->update('registration_doubles', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_mixed($postdata) { $this->db->trans_begin(); $tbl1Values=array( 'registration_mixed_company_name'=>$postdata['registration_mixed_company_name'], 'registration_mixed_player_name_1'=>$postdata['registration_mixed_player_name_1'], 'registration_mixed_player_designation_1'=>$postdata['registration_mixed_player_designation_1'], 'registration_mixed_qatar_id_1'=>$postdata['registration_mixed_qatar_id_1'], 'registration_mixed_contact_no_1'=>$postdata['registration_mixed_contact_no_1'], 'registration_mixed_email_1'=>$postdata['registration_mixed_email_1'], 'registration_mixed_player_name_2'=>$postdata['registration_mixed_player_name_2'], 'registration_mixed_designation_2'=>$postdata['registration_mixed_designation_2'], 'registration_mixed_qatar_id_2'=>$postdata['registration_mixed_qatar_id_2'], 'registration_mixed_contact_no_2'=>$postdata['registration_mixed_contact_no_2'], 'registration_mixed_email_2'=>$postdata['registration_mixed_email_2'], 'active'=>$postdata['active']); $this->db->where('registration_mixed_id', $postdata['registration_mixed_id']); $this->db->update('registration_mixed', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_password($postdata) { $tbl1Values=array('password'=>md5($postdata['password'])); $this->db->where('user_id', '1'); $this->db->update('user', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function get_contacts_list($singles,$doubles,$mixed) { $data = array(); $query=''; if($singles==1) $query = "(select registration_singles_company_name as company_name, registration_singles_player_name as player_name, registration_singles_player_designation as designation, registration_singles_contact_no as contact_no, registration_singles_email as email_id, 'Men\'s Singles' AS event_name from registration_singles order by datetime) UNION"; if($doubles==1) { $query .= " (select registration_doubles_company_name as company_name, registration_doubles_player_name_1 as player_name, registration_doubles_player_designation_1 as designation, registration_doubles_contact_no_1 as contact_no, registration_doubles_email_1 as email_id, 'Men\'s Doubles' AS event_name from registration_doubles order by datetime) UNION"; $query .= " (select registration_doubles_company_name as company_name, registration_doubles_player_name_2 as player_name, registration_doubles_designation_2 as designation, registration_doubles_contact_no_2 as contact_no, registration_doubles_email_2 as email_id, 'Men\'s Doubles' AS event_name from registration_doubles order by datetime) UNION"; } if($mixed==1) { $query .= " (select registration_mixed_company_name as company_name, registration_mixed_player_name_1 as player_name, registration_mixed_player_designation_1 as designation, registration_mixed_contact_no_1 as contact_no, registration_mixed_email_1 as email_id, 'Mixed Doubles' AS event_name from registration_mixed order by datetime) UNION"; $query .= " (select registration_mixed_company_name as company_name, registration_mixed_player_name_2 as player_name, registration_mixed_designation_2 as designation, registration_mixed_contact_no_2 as contact_no, registration_mixed_email_2 as email_id, 'Mixed Doubles' AS event_name from registration_mixed order by datetime)"; } $query=preg_replace('/UNION$/', '', $query); $Q=$this->db->query($query); if ($Q->num_rows() > 0) { foreach ($Q->result_array() as $row) { $data[] = $row; } } $Q->free_result(); return $data; } function send_email($postdata) { foreach($postdata['email_checkbox'] as $email) $this->mail->send($postdata['content'], $postdata['subject'],'ajmal@savoyglobal.net','Mohamed Ajmal','mohamedajmal','smtp.gmail.com',0,$email); } } ?>