?
Current Path : /home1/savoy/public_html/savoyglobal.net/chess2015open/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/chess2015open/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_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_registration_details($postdata) { $this->db->trans_begin(); $tbl1Values = array( 'name' => $postdata['name'], 'gender' => $postdata['gender'], 'school_name' => $postdata['school_name'], 'date_of_birth' => $this->mastermodel->convertdateformat($postdata['date_of_birth']), 'father_name' => $postdata['father_name'], 'father_mobile' => $postdata['father_mobile'], 'father_email' => $postdata['father_email'], 'mother_name' => $postdata['mother_name'], 'mother_mobile' => $postdata['mother_mobile'], 'mother_email' => $postdata['mother_email'], 'status' => $postdata['status'] ); $this->db->where('registration_id', $postdata['registration_id']); $this->db->update('registration', $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); // } function set_student_status($id, $status, $reg_code, $parent_email, $name, $category) { $this->db->trans_begin(); $br = "<br/>"; $subject = "SAVOY GLOBAL OPEN CHESS TOURNAMENT 2015 (UNDER 14)"; $content = "Dear $name ,$br Greetings from Savoy! $br Your registration for the SAVOY GLOBAL OPEN CHESS TOURNAMENT 2015 (UNDER 14) on February 21, 2015 (Saturday) at 9:00 AM onwards is approved in the $category category.$br Your registration number is $reg_code. Please be present 30 minutes before commencement of the tournament at Savoy Education Center premises. The rules of the game is given at www.savoyglobal.net/chess2015open $br QAR 30/- as registration cum entry fee will have to be paid at the counter to collect your table number. The tournament will commence at 09:00 a.m$br Looking forward to see you there. All the best for the championship..$br$br Regards$br Team Savoy."; $tbl1Values = array('status' => $status, 'registration_no' => $reg_code ); $this->db->where('registration_id', $id); $this->db->update('registration', $tbl1Values); if ($status == 'Approved') { $this->mail->send($content, $subject, 'info@savoyglobal.net', 'Savoy Global Open Chess Tournament', 'savoy987', 'smtp.gmail.com', 0, $parent_email); } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 'Error On Updating Record'; } else { return 'Approved Successfully'; } } function mail_before_two_days() { $br = "<br/>"; $subject = "SAVOY GLOBAL OPEN CHESS TOURNAMENT 2015 (UNDER 14)"; $content = "Dear $name ,$br Greetings from Savoy! $br You had Registered for the SAVOY GLOBAL OPEN CHESS TOURNAMENT 2015 (UNDER 14) on February 21, 2015 (Saturday) at 9:00 AM onwards. Your registration number is $reg_code. Please be present at Savo Education Center premises on 21 Feb 2015 at 08:30 hrs. Kindly bring QAR 30/- as entry and registration fee to be paid at the counter where you will be told your table number.$br For any assistance you may contact us at + 974 44323006 All the very best for the Championship. Regards$br Team Savoy. "; if ($status == 'Approved') { $this->mail->send($content, $subject, 'info@savoyglobal.net', 'Savoy Global Open Chess Tournament', 'savoy987', 'smtp.gmail.com', 0, $parent_email); } } } ?>