?
Current Path : /home1/savoy/public_html/savoyglobal.net/talentquest2013/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/talentquest2013/application/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_registration($postdata) { $this->db->trans_begin(); $tbl1Values=array( 'registration_school_name'=>$postdata['school_name'], 'contact_person'=>$postdata['contact_person'], 'contact_no'=>$postdata['contact_no'], 'contact_email'=>$postdata['contact_email'], 'active'=>$postdata['active']); $this->db->where('registration_id', $postdata['registration_id']); $this->db->update('registration', $tbl1Values); $i=1; $this->db->where('registration_id', $postdata['registration_id']); $this->db->delete('registration_partcipant'); while(isset($postdata['participant_name_'.$i])) { $tbl1Values=array( 'registration_id'=>$postdata['registration_id'], 'participant_name'=>$postdata['participant_name_'.$i], 'participant_qatar_id'=>$postdata['participant_qatar_id_'.$i], 'participant_class'=>$postdata['participant_class_'.$i]); $this->db->insert('registration_partcipant', $tbl1Values); $i++; } 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 editData() { $a=$_POST['registration_school_name']; $b=$_POST['contact_person']; $c=$_POST['contact_no']; $d=$_POST['contact_email']; $e=$_POST['datetime']; $f=$_POST['participant_name']; $g=$_POST['participant_qatar_id']; $h=$_POST['participant_class']; $i=$_POST['active']; echo "$f"; } function get_contacts_list($event_array) { $data = array(); $event_string=''; //var_dump($event_array); foreach($event_array as $event) $event_string .= $event.','; $event_string=rtrim($event_string, ","); $query = "select * from registration join event on event.event_id = registration_event_id where registration_event_id in ($event_string) order by datetime"; $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); } } } ?>