In Association with Amazon.in   Flipkart

Sunday, September 15, 2019

PHP Sample Admin Controller Code for Codeigniter Frame Work


class Admin extends CI_Controller {


    public function __construct() {

        parent::__construct();

    }

//================================================

     public function index() {

       $this->is_login();

       $urole= $this->session->userdata('admin_data')[0]->role;

       if($urole === 'Admin')
       redirect(base_url().'admin/dashboard', 'refresh');
       else if($urole === 'Employee')
       redirect(base_url().'employee/dashboard', 'refresh');

       $data='';

       $this->load->view('admin/index',$data);

    }

//===================================================


    public function dashboard() {

     $this->is_login();

    $data['tot_cands']=$this->user_model->getValueQry("SELECT count(*) as val FROM `cc_candidates`");
     $data['tot_candexs']=$this->user_model->getValueQry("SELECT count(*) as val FROM `cc_cand_exams`");

     $data['tot_qus']=$this->user_model->getValueQry("SELECT count(*) as val FROM `cc_questions`");

     $data['tot_exams']=$this->user_model->getValueQry("SELECT count(*) as val FROM `cc_topics`");

/*

  $data['tot_activedeals']=$this->user_model->getValueQry("SELECT count(*) as val FROM `deals` WHERE CURRENT_DATE BETWEEN `from_date` AND to_date");

*/

  $data['mnu']='dash';

  $this->load->view('admin/dashboard',$data);

  }


    // ******************************************

    public function feedback_questions() {

     $this->is_login();

    $data['resp'] = $this->user_model->getData("feedback_q");
    $data['mnu']='fqus';

    $this->load->view('admin/feedback_questions', $data);
  }  

// =====================================

      public function new_feedback_ques_sub() {

     $this->is_login();

           $data['ques'] = strip_tags(trim($this->input->post('ques')));
           if($data['ques']!=''){

              if($this->user_model->insertRow('feedback_q', $data))
             $this->session->set_flashdata('messagePr', '

Success! New Feedback Ques Created Successfully..!

' ); } redirect('admin/feedback_questions','refresh'); } // ****************************************** public function candidates_feedbacks($fid='', $fname='') { $this->is_login(); if($fid!=''){ $data['frow'] = $this->user_model->getDataByid("faculties", 'id', $fid); $data['cq_resp'] = $this->user_model->run_query("select * from cand_feedback where fac_id = '$fid' order by id desc"); $data['mnu']='facu'; $this->load->view('admin/candidates_feedbacks', $data); } } // ****************************************** public function faculties() { $this->is_login(); $data['fac_resp'] = $this->user_model->getData("faculties"); $data['mnu']='facu'; $this->load->view('admin/faculties',$data); } // =================================== public function new_faculty_sub() { $this->is_login(); if(count($_POST)){ $data['faculty_name'] = strip_tags(trim($this->input->post('faculty_name'))); $data['course'] = strip_tags(trim($this->input->post('course'))); $data['pic']='default_photo.png'; foreach($_FILES as $name => $fileInfo) { if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($ext === 'jpeg' || $ext === 'jpg' || $ext === 'png'){ $newname= uniqid()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/photos/".$newname)) { $data['pic']=$newname; } } } } if($this->user_model->insertRow('faculties', $data)) $this->session->set_flashdata('messagePr', '

Success! New Faculty Created Successfully..!

' ); } redirect('admin/faculties','refresh'); } // ****************************************** public function delete_faculty($id='') { $this->is_login(); $sql="Delete FROM `faculties` where md5(id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) { $sql2="Delete FROM `cand_feedback` where md5(fac_id) = '$id';"; $this->user_model->run_query($sql2); $this->session->set_flashdata('messagePr', '

Success! Faculty Deleted Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/faculties', 'refresh'); } // *************************************** public function candidates($course_id='', $batch_id='', $status='') { $this->is_login(); $flag = 0; $sqry=''; if(isset($_POST)) { $course_id= strip_tags($this->input->post('course_id')); $batch_id= strip_tags($this->input->post('batch_id')); $status= strip_tags($this->input->post('status')); $flag = 1; } if($batch_id != '') { $sqry.=" AND batch_id = '$batch_id' "; $flag = 1; } if($course_id != '') { $sqry.=" AND course_id = '$course_id' "; $flag = 1; } if($status!= ''){ $sqry.=" AND status = '$status' "; $flag = 1; } if($flag == 1) { $sql="SELECT * FROM cc_candidates WHERE 1 $sqry order by cand_id desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); } else $data['total']=0; $data['alltotal']=$this->user_model->getValue('count(*)', 'cc_candidates'); $data['course_id']=$course_id; $data['batch_id']=$batch_id; $data['status']=$status; $data['mnu']='cand'; $this->load->view('admin/candidates',$data); } // ------------------------------------ public function new_candidate() { $this->is_login(); $data['mnu']='cand'; $sql2="SELECT * FROM `states` WHERE country_id = '101';"; $data['stres']=$this->user_model->run_query($sql2); $this->load->view('admin/new_candidate',$data); } // ------------------------------------ public function upload_candidates() { $this->is_login(); $data['mnu']='cand'; // $sql2="SELECT * FROM `states` WHERE country_id = '101';"; // $data['stres']=$this->user_model->run_query($sql2); $this->load->view('admin/upload_candidates',$data); } // ------------------------------------ public function upload_candidates_sub() { $this->is_login(); $data['course_id']=strip_tags(trim($this->input->post('course_id'))); $data['batch_id']=strip_tags(trim($this->input->post('batch_id'))); $data['status']='Active'; // strip_tags(trim($this->input->post('status'))); if($data['batch_id']!='') { // --------- for inserting Ex file foreach($_FILES as $name => $fileInfo) { if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($ext === 'xlsx' || $ext === 'xls' || $ext === 'csv' || $ext === 'ods'){ $newname= time()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/excel_files/".$newname)) { require('excel-reader-master/php-excel-reader/excel_reader2.php'); require('excel-reader-master/SpreadsheetReader.php'); $Reader = new SpreadsheetReader('media/excel_files/'.$newname); $i=0; $c=0; foreach ($Reader as $Row) { if($i>0 && count($Row) == 4) { $data['full_name']=strip_tags($Row[2]); $data['gender']=strip_tags($Row[3]); $data['reg_id']=strip_tags($Row[1]); $data['login_pwd']= rand(19999,99999); //print_r($Row); $this->user_model->insertRow('cc_candidates', $data); $c++; } $i++; } $this->session->set_flashdata('messagePr', '

Success! ('.$c.') Candidates Uploaded Successfully..!

' ); } } else { $this->session->set_flashdata('messagePr', '

Failed! Invalid File Type! Please Try Again..!

' ); redirect('admin/upload_candidates','refresh'); } } } // ----- files upload ends ---- } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect('admin/candidates','refresh'); } // --------------------------------------------- public function new_candidate_sub() { $this->is_login(); $data['title']=strip_tags(trim($this->input->post('title'))); $data['full_name']=strip_tags(ucwords(trim($this->input->post('full_name')))); $data['gender']=strip_tags(trim($this->input->post('gender'))); $data['higher_qlfy']=strip_tags(trim($this->input->post('higher_qlfy'))); $data['dob']=strip_tags(trim($this->input->post('dob'))); $data['blood_group']=strip_tags(ucwords(trim($this->input->post('blood_group')))); $data['religion']=strip_tags(ucwords(trim($this->input->post('religion')))); $data['course_id']=strip_tags(trim($this->input->post('course_id'))); $data['batch_id']=strip_tags(trim($this->input->post('batch_id'))); $data['fathers_name']=strip_tags(trim($this->input->post('fathers_name'))); $data['mothers_name']=strip_tags(trim($this->input->post('mothers_name'))); $data['email']=strip_tags(trim($this->input->post('email'))); $data['mobile_no']=strip_tags(trim($this->input->post('mobile_no'))); $data['landline_no']=strip_tags(trim($this->input->post('landline_no'))); $data['address_line1']=strip_tags(trim($this->input->post('address_line1'))); $data['address_line2']=strip_tags(trim($this->input->post('address_line2'))); $data['city']=strip_tags(trim($this->input->post('city'))); $data['state']=strip_tags(trim($this->input->post('state'))); $data['pincode']=strip_tags(trim($this->input->post('pincode'))); $data['reg_id']=strip_tags(trim($this->input->post('reg_id'))); $data['login_pwd']=strip_tags(trim($this->input->post('login_pwd'))); $data['joined_courses']=strip_tags(trim($this->input->post('joined_courses'))); $data['total_fee']=strip_tags(trim($this->input->post('total_fee'))); $data['doj']=strip_tags(trim($this->input->post('doj'))); $data['acc_exp_date']=strip_tags(trim($this->input->post('acc_exp_date'))); $data['remarks']=strip_tags(trim($this->input->post('remarks'))); $data['status']=strip_tags(trim($this->input->post('status'))); if($data['full_name']!='') { /* --------- for inserting Qfile -- */ foreach($_FILES as $name => $fileInfo) { if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($name == 'photo') { if($ext === 'jpeg' || $ext === 'jpg' || $ext === 'png'){ $newname= time()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/photos/".$newname)) { $data['photo']=$newname; // $this->user_model->updateRow('tnm', 'trf_id', $trf_id, $ddoc); } } } if($name == 'resume') { if($ext === 'doc' || $ext === 'docx' || $ext === 'pdf'){ $newname= time()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/resumes/".$newname)) { $data['resume']=$newname; } } } } } // ----- files upload ends ---- $data7['cand_id']=$this->user_model->insertRow('cc_candidates', $data); $this->session->set_flashdata('messagePr', '

Success! New Candidate Created Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect('admin/candidates','refresh'); } // --------------------------------------------- public function edit_candidate($id='') { $this->is_login(); $sql="SELECT * FROM `cc_candidates` WHERE md5(cand_id) = '$id';"; $response=$this->user_model->run_query($sql); foreach ($response->result() as $data['res']); $sql2="SELECT * FROM `states` WHERE country_id = '101';"; $data['stres']=$this->user_model->run_query($sql2); $data['mnu']='cand'; $this->load->view('admin/edit_candidate',$data); } // --------------------------------------------- public function edit_candidate_sub($id='') { $this->is_login(); if($id!=''){ // $data['title']=strip_tags(trim($this->input->post('title'))); $data['full_name']=strip_tags(ucwords(trim($this->input->post('full_name')))); $data['gender']=strip_tags(trim($this->input->post('gender'))); $data['course_id']=strip_tags(trim($this->input->post('course_id'))); $data['batch_id']=strip_tags(trim($this->input->post('batch_id'))); $data['reg_id']=strip_tags(trim($this->input->post('reg_id'))); $data['login_pwd']=strip_tags(trim($this->input->post('login_pwd'))); $data['status']=strip_tags(trim($this->input->post('status'))); /* $data['higher_qlfy']=strip_tags(trim($this->input->post('higher_qlfy'))); $data['dob']=strip_tags(trim($this->input->post('dob'))); $data['blood_group']=strip_tags(ucwords(trim($this->input->post('blood_group')))); $data['religion']=strip_tags(ucwords(trim($this->input->post('religion')))); $data['fathers_name']=strip_tags(trim($this->input->post('fathers_name'))); $data['mothers_name']=strip_tags(trim($this->input->post('mothers_name'))); $data['email']=strip_tags(trim($this->input->post('email'))); $data['mobile_no']=strip_tags(trim($this->input->post('mobile_no'))); $data['landline_no']=strip_tags(trim($this->input->post('landline_no'))); $data['address_line1']=strip_tags(trim($this->input->post('address_line1'))); $data['address_line2']=strip_tags(trim($this->input->post('address_line2'))); $data['city']=strip_tags(trim($this->input->post('city'))); $data['state']=strip_tags(trim($this->input->post('state'))); $data['pincode']=strip_tags(trim($this->input->post('pincode'))); $data['joined_courses']=strip_tags(trim($this->input->post('joined_courses'))); $data['total_fee']=strip_tags(trim($this->input->post('total_fee'))); $data['doj']=strip_tags(trim($this->input->post('doj'))); $data['acc_exp_date']=strip_tags(trim($this->input->post('acc_exp_date'))); $data['remarks']=strip_tags(trim($this->input->post('remarks'))); */ if($data['full_name']!='') { /*/ --------- for inserting Qfile foreach($_FILES as $name => $fileInfo) { if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($name == 'photo') { if($ext === 'jpeg' || $ext === 'jpg' || $ext === 'png'){ $newname= time()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/photos/".$newname)) { $data['photo']=$newname; // $this->user_model->updateRow('tnm', 'trf_id', $trf_id, $ddoc); } } } if($name == 'resume') { if($ext === 'doc' || $ext === 'docx' || $ext === 'pdf'){ $newname= time()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/resumes/".$newname)) { $data['resume']=$newname; } } } } } // ----- files upload ends ----*/ $data7['cand_id']=$this->user_model->updateRow('cc_candidates', 'cand_id', $id, $data); $this->session->set_flashdata('messagePr', '

Success! Candidate Details Updated Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect('admin/candidates','refresh'); } // --------------------------------------------- public function delete_candidate($id='') { $this->is_login(); $sql="Delete FROM `cc_candidates` where md5(cand_id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) { $sql2="Delete FROM `cc_cand_exams` where md5(cand_id) = '$id';"; $this->user_model->run_query($sql2); $sql2="Delete FROM `cc_cand_exam_qus` where md5(cand_id) = '$id';"; $this->user_model->run_query($sql2); $this->session->set_flashdata('messagePr', '

Success! Candidate Deleted Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/candidates', 'refresh'); } // ****************************************** public function delete_cand_exam($id='', $cid='') { $this->is_login(); $sql="Delete FROM `cc_cand_exams` where md5(cand_exam_id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) { $sql2="Delete FROM `cc_cand_exam_qus` where cand_id = '$cid';"; $this->user_model->run_query($sql2); $this->session->set_flashdata('messagePr', '

Success! Candidate Exam Deleted Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/candidates_exams', 'refresh'); } // ****************************************** public function online_exams($typ='') { $this->is_login(); $sqry=''; if($typ=='GRAND' || $typ=='MODEL') $sqry=" WHERE exam_type = '$typ' "; $sql="SELECT * FROM `cc_exams` $sqry order by start_date desc"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['alltot']= $this->user_model->getValue('count(*)', 'cc_exams', '', ''); $data['gtot']= $this->user_model->getValue('count(*)', 'cc_exams', 'exam_type', 'GRAND'); $data['mtot']= $this->user_model->getValue('count(*)', 'cc_exams', 'exam_type', 'MODEL'); $data['type']= $typ; $data['mnu']='exam'; $this->load->view('admin/online_exams',$data); } // ------------------------------------ public function new_model_test() { $this->is_login(); $data['mnu']='exam'; $this->load->view('admin/new_model_test',$data); } // ------------------------------------ public function new_model_test_sub() { $this->is_login(); $data['exam_type']='MODEL'; //strip_tags(trim($this->input->post('exam_type'))); $data['courses']=strip_tags(trim($this->input->post('courses'))); $data['exam_title']=strip_tags(trim($this->input->post('exam_title'))); $data['exam_lang']=strip_tags(trim($this->input->post('exam_lang'))); $data['max_marks']=strip_tags(trim($this->input->post('max_marks'))); $data['pass_marks']=strip_tags(trim($this->input->post('pass_marks'))); $data['start_date']=strip_tags(trim($this->input->post('start_date'))); $data['end_date']=strip_tags(trim($this->input->post('end_date'))); if($data['exam_title']!='') { $data7['exam_id']=$this->user_model->insertRow('cc_exams', $data); $subj_id=$this->input->post('subj_id'); $no_of_qus=$this->input->post('noq'); $time_minutes=$this->input->post('timem'); $po_marks=$this->input->post('pmrk'); $ne_marks=$this->input->post('nmrk'); $secs=count($subj_id); if($secs) { for($i=0; $i<$secs; $i++) { $data7['subj_id'] = $subj_id[$i]; $data7['no_of_qus'] = $no_of_qus[$i]; $data7['time_minutes'] = $time_minutes[$i]; $data7['po_mark'] = $po_marks[$i]; $data7['ne_mark'] = $ne_marks[$i]; $this->user_model->insertRow('cc_exam_sections', $data7); } } $this->session->set_flashdata('messagePr', '

Success! New Exam Created Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect('admin/online_exams/MODEL','refresh'); } // ------------------------------------ public function new_grand_test() { $this->is_login(); $data['mnu']='exam'; $this->load->view('admin/new_grand_test',$data); } // ------------------------------------ public function new_grand_test_sub() { $this->is_login(); $subj_id= strip_tags(trim($this->input->post('subj_id'))); $subj= $this->user_model->getValue('subject_name', 'cc_subjects', 'subj_id', $subj_id); $title= strip_tags(trim($this->input->post('exam_title'))); $data['exam_type']='GRAND'; //strip_tags(trim($this->input->post('exam_type'))); $data['courses']=strip_tags(trim($this->input->post('courses'))); $data['subj_id'] = $subj_id; $data['exam_title']=strtoupper($subj.' '.$title); $data['exam_lang']=strip_tags(trim($this->input->post('exam_lang'))); $data['max_marks']=strip_tags(trim($this->input->post('max_marks'))); $data['pass_marks']=strip_tags(trim($this->input->post('pass_marks'))); $data['start_date']=strip_tags(trim($this->input->post('start_date'))); $data['end_date']=strip_tags(trim($this->input->post('end_date'))); if($data['exam_title']!='') { $data7['exam_id']=$this->user_model->insertRow('cc_exams', $data); $topic_id=$this->input->post('topic_id'); $no_of_qus=$this->input->post('noq'); $time_minutes=$this->input->post('timem'); $po_marks=$this->input->post('pmrk'); $ne_marks=$this->input->post('nmrk'); $secs=count($topic_id); if($secs) { for($i=0; $i<$secs; $i++) { $data7['subj_id'] = $subj_id; $data7['topic_id'] = $topic_id[$i]; $data7['no_of_qus'] = $no_of_qus[$i]; $data7['time_minutes'] = $time_minutes[$i]; $data7['po_mark'] = $po_marks[$i]; $data7['ne_mark'] = $ne_marks[$i]; $this->user_model->insertRow('cc_exam_sections', $data7); } } $this->session->set_flashdata('messagePr', '

Success! New Exam Created Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect('admin/online_exams/GRAND','refresh'); } // --------------------------------------------- public function edit_exam($id='') { $this->is_login(); $sql="SELECT * FROM `cc_exams` WHERE md5(exam_id) = '$id';"; $response=$this->user_model->run_query($sql); foreach ($response->result() as $data['res']); $sql2="SELECT * FROM `cc_exam_sections` WHERE md5(exam_id) = '$id';"; $data['secres']=$this->user_model->run_query($sql2); $data['mnu']='exam'; $this->load->view('admin/edit_exam',$data); } // --------------------------------------------- public function edit_exam_sub($id='') { $this->is_login(); redirect('admin/online_exams','refresh'); } // --------------------------------------------- public function delete_exam($id='') { $this->is_login(); $sql="Delete FROM `cc_exams` where md5(exam_id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) { $sql2="Delete FROM `cc_exam_sections` where md5(exam_id) = '$id';"; $this->user_model->run_query($sql2); $this->session->set_flashdata('messagePr', '

Success! Exam Deleted Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/online_exams', 'refresh'); } // ***************************************** public function candidates_exams($batch_id='', $course_id='', $status='') { $this->is_login(); $flag = 0; $sqry=''; if(isset($_POST)) { $course_id= strip_tags($this->input->post('course_id')); $batch_id= strip_tags($this->input->post('batch_id')); $status= strip_tags($this->input->post('status')); } if($batch_id != '') { $sqry.=" AND batch_id = '$batch_id' "; } else if($course_id != '') { $sqry.=" AND subj_id = '$course_id' "; } else { $flag = 1; } if($status!= '') $sqry.=" AND status = '$status' "; if($flag) { $sql="SELECT * FROM cc_cand_exams WHERE 1 order by cand_exam_id desc limit 1000;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); // $data['total']= $this->user_model->getValueQry("SELECT count(*) as val FROM `cc_candidates`;"); } else { $sql="SELECT * FROM cc_cand_exams WHERE 1 $sqry order by cand_exam_id desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); } $data['course_id']=$course_id; $data['batch_id']=$batch_id; $data['status']=$status; $data['mnu']='cand'; $this->load->view('admin/candidates_exams',$data); } // ************************************ public function new_question($qus_type='', $lang='', $topic_id='') { $this->is_login(); $data['mnu']='ques'; $data['qus_type']=$qus_type; $data['lang']=$lang; // $data['subj_id']=$subj_id; $data['topic_id']=$topic_id; $this->load->view('admin/new_question',$data); } // --------------------------------------------- public function new_question_sub() { $this->is_login(); if(isset($_POST)) { $data['qus_type']= 'T'; //strip_tags(trim($this->input->post('qus_type'))); $data['lang']=strip_tags(trim($this->input->post('lang'))); $data['qus_marks']= 1; //strip_tags(trim($this->input->post('qus_marks'))); // $data['subj_id']=strip_tags(trim($this->input->post('subj_id'))); $data['topic_id']=strip_tags(trim($this->input->post('topic_id'))); // if($data['qus_type'] === 'T') { $data['question']=strip_tags(trim($this->input->post('question'))); $data['op1']=strip_tags(trim($this->input->post('op1'))); $data['op2']=strip_tags(trim($this->input->post('op2'))); $data['op3']=strip_tags(trim($this->input->post('op3'))); $data['op4']=strip_tags(trim($this->input->post('op4'))); // $data['op5']=strip_tags(trim($this->input->post('op5'))); // } else { /* --------- for inserting Qfile $flag=0; foreach($_FILES as $name => $fileInfo); if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($ext === 'jpeg' || $ext === 'jpg' || $ext === 'png'){ $newname= time()."_".rand(99,999).".".$ext; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/qus_imgs/".$newname)) { $data['question']=$newname; // $this->user_model->updateRow('tnm', 'trf_id', $trf_id, $ddoc); } else $flag = '1'; } else $flag = '1'; } else $flag = '1'; */ // $this->session->set_flashdata('messagePr', '

Error! Please Try Again..!

' ); $data['ans']=strip_tags(trim($this->input->post('ans'))); if($this->user_model->insertRow('cc_questions', $data)) $this->session->set_flashdata('messagePr', '

Success! New Question Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/new_question/'.$data['qus_type'].'/'.$data['lang'].'/'.$data['topic_id'].'/', 'refresh'); } } // ---------------------------------------- public function exam_questions($topic_id='') { $this->is_login(); $sqry = ''; $data['topic_id']=$topic_id; $data['qus_type'] = 'T'; $data['lang'] = 'Eng'; $data['alltotal']= $this->user_model->getValueQry("SELECT count(*) as val FROM `cc_questions`;"); if($topic_id!='') { $data['topic']=$this->user_model->getValue('topic_name', 'cc_topics', 'topic_id', $topic_id); $sqry = " AND topic_id = '$topic_id' "; } else $data['topic']='All'; $sql="SELECT * FROM cc_questions WHERE qus_type = '".$data['qus_type']."' AND lang = '".$data['lang']."' $sqry order by q_id desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='ques'; $this->load->view('admin/exam_questions',$data); } // ------------------------------------ public function upload_questions() { $this->is_login(); $data['mnu']='ques'; $this->load->view('admin/upload_questions',$data); } // ------------------------------------ public function upload_questions_sub() { $this->is_login(); // $data['subj_id']=strip_tags(trim($this->input->post('course_id'))); $data['topic_id']=strip_tags(trim($this->input->post('topic_id'))); $data['lang']=strip_tags(trim($this->input->post('lang'))); $data['qus_type']='T'; if($data['topic_id']!='') { // --------- for inserting Ex file foreach($_FILES as $name => $fileInfo) { if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($ext === 'xlsx' || $ext === 'xls' || $ext === 'csv' || $ext === 'ods'){ $newname= time()."_".$filename; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/excel_files/".$newname)) { require('excel-reader-master/php-excel-reader/excel_reader2.php'); require('excel-reader-master/SpreadsheetReader.php'); $Reader = new SpreadsheetReader('media/excel_files/'.$newname); $i=0; $c=0; foreach ($Reader as $Row) { if($i>0 && count($Row) == 7) { $data['question']=trim($Row[1]); $data['op1']=trim($Row[2]); $data['op2']=trim($Row[3]); $data['op3']=trim($Row[4]); $data['op4']=trim($Row[5]); $data['ans']=trim($Row[6]); $this->user_model->insertRow('cc_questions', $data); $c++; } $i++; } $this->session->set_flashdata('messagePr', '

Success! ('.$c.') Questions Uploaded Successfully..!

' ); } } else { $this->session->set_flashdata('messagePr', '

Failed! Invalid File Type! Please Try Again..!

' ); redirect('admin/upload_questions','refresh'); } } } // ----- files upload ends ---- } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect('admin/exam_questions','refresh'); } // --------------------------------------------- public function edit_question($id='') { $this->is_login(); $sql="SELECT * FROM `cc_questions` WHERE md5(q_id) = '$id';"; $response=$this->user_model->run_query($sql); foreach ($response->result() as $data['res']); $data['mnu']='ques'; $this->load->view('admin/edit_question',$data); } // ------------------------------------------------- public function delete_question($id='') { $this->is_login(); $sql="Delete FROM `cc_questions` where md5(q_id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) $this->session->set_flashdata('messagePr', '

Success! Question Deleted Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/exam_questions', 'refresh'); } // ****************************************** public function courses() { $this->is_login(); $sql="SELECT * FROM `cc_courses` order by course_name;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='cour'; $this->load->view('admin/courses',$data); } // --------------------------------------------- public function new_course_sub() { $this->is_login(); $data['course_name']=strip_tags(ucwords(trim($this->input->post('course_name')))); if($this->user_model->insertRow('cc_courses', $data)) $this->session->set_flashdata('messagePr', '

Success! New Courses Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/courses', 'refresh'); } // ------------------------------------------------- public function delete_course($id='') { $this->is_login(); $sql="Delete FROM `cc_courses` where md5(c_id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) $this->session->set_flashdata('messagePr', '

Success! Course Deleted Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/courses', 'refresh'); } // ****************************************** public function edit_subject_sub($subjid='') { $this->is_login(); $data['subject_name']=strip_tags(strtoupper(trim($this->input->post('subject_name')))); $data['unm']=strip_tags(trim($this->input->post('cunm'))); $data['pwd']=strip_tags(trim($this->input->post('cpwd'))); $data['status']=strip_tags(trim($this->input->post('status'))); if($this->user_model->updateRow('cc_subjects', 'md5(subj_id)', $subjid, $data)) $this->session->set_flashdata('messagePr', '

Success! Collage/Institute Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/exam_subjects', 'refresh'); } // ****************************************** public function exam_subjects($id='') { $this->is_login(); $data['res']=''; if($id!=''){ $data['res']=$this->user_model->getDataByid('cc_subjects', 'md5(subj_id)', $id); } $sql="SELECT * FROM `cc_subjects` order by subject_name;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['tot_qus']=$this->user_model->getValueQry("SELECT count(*) as val FROM `cc_questions` "); $data['mnu']='subj'; $this->load->view('admin/exam_subjects',$data); } // --------------------------------------------- public function new_subject_sub() { $this->is_login(); $data['subject_name']=strip_tags(strtoupper(trim($this->input->post('subject_name')))); $data['unm']=strip_tags(strtoupper(trim($this->input->post('cunm')))); $data['pwd']=strip_tags(strtoupper(trim($this->input->post('cpwd')))); if($this->user_model->insertRow('cc_subjects', $data)) $this->session->set_flashdata('messagePr', '

Success! New Collage/Institute Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/exam_subjects', 'refresh'); } // ------------------------------------------------- public function delete_subject($id='') { $this->is_login(); $sql="Delete FROM `cc_subjects` where md5(subj_id) = '$id' limit 1;"; if($this->user_model->run_query($sql)) { $this->user_model->delete_id('cc_topics' , 'md5(subj_id)', $id); $this->session->set_flashdata('messagePr', '

Success! Course Deleted Successfully..!

' ); } else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); redirect( base_url().'admin/exam_subjects', 'refresh'); } // ****************************************** public function subject_topics($id='', $subjnm='') { $this->is_login(); $data['res']=''; $sqry=''; if($id!='' && $subjnm=='') { $sql2="SELECT * FROM `cc_topics` where md5(topic_id) = '$id';"; $resp=$this->user_model->run_query($sql2); foreach ($resp->result() as $data['res']); } if($id!='' && $subjnm!='') $sqry=" Where subj_id = '$id' "; $sql="SELECT * FROM `cc_topics` $sqry order by subj_id, topic_name asc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='topi'; $data['subj_id']=$id; $this->load->view('admin/subject_topics',$data); } // ---------------------------------------------- public function subject_topic_sub() { $this->is_login(); $data['topic_name']=strip_tags(trim($this->input->post('topic_name'))); // $data['subj_id']=strip_tags(trim($this->input->post('subj_id'))); $data['max_marks']=strip_tags(trim($this->input->post('max_marks'))); $data['exam_ques']=strip_tags(trim($this->input->post('exam_ques'))); if($data['topic_name'] != '' ){ if($this->user_model->insertRow('cc_topics', $data)) $this->session->set_flashdata('messagePr', '

Success! Subject Topic Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/subject_topics/', 'refresh'); } // ---------------------------------------------- public function update_subject_topic($id='') { $this->is_login(); $data['topic_name']=strip_tags(trim($this->input->post('topic_name'))); // $data['subj_id']=strip_tags(trim($this->input->post('subj_id'))); $data['max_marks']=strip_tags(trim($this->input->post('max_marks'))); $data['exam_ques']=strip_tags(trim($this->input->post('exam_ques'))); if($data['topic_name'] != '' && $id != ''){ if($this->user_model->updateRow('cc_topics', 'md5(topic_id)', $id, $data)) $this->session->set_flashdata('messagePr', '

Success! Subject Topic Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/subject_topics', 'refresh'); } // ------------------------------------------- public function delete_subject_topic($id='') { $this->is_login(); if($id != '') { $this->user_model->delete_id('cc_topics' , 'md5(topic_id)', $id); $this->session->set_flashdata('messagePr', '

Success! Subject Topic Deleted Successfully..!

' ); } redirect(base_url().'admin/subject_topics/', 'refresh'); } // ********************************************* public function home_page_slider() { $this->is_login(); $sql="SELECT * FROM `cc_home_slides` order by sort_id;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='slid'; $this->load->view('admin/home_page_slider',$data); } // ---------------------------------------------- public function home_page_slider_sub() { $this->is_login(); // --------- for inserting img foreach($_FILES as $name => $fileInfo) { if(!empty($_FILES[$name]['size'])){ $filename=$_FILES[$name]['name']; $exp=explode('.', $filename); $ext=strtolower(end($exp)); if($ext === 'jpeg' || $ext === 'jpg' || $ext === 'png'){ $newname= rand(1,999).'_'.time().".".$ext; $tmpname= $_FILES[$name]['tmp_name']; if(move_uploaded_file($tmpname,"media/slides/".$newname)) { $data['slide_url']=$newname; $this->user_model->insertRow('cc_home_slides', $data); } } } } } // ------------------------------------------- public function delete_home_page_slider($id='', $nm='') { $this->is_login(); if($id != '' && $nm != '') { $this->user_model->delete_id('cc_home_slides' , 'md5(slide_id)', $id); $file="media/slides/".$nm; unlink($file); $this->session->set_flashdata('messagePr', '

Success! Slide Deleted Successfully..!

' ); } redirect(base_url().'admin/home_page_slider', 'refresh'); } // ****************************************** public function batches($id='', $filter='') { $this->is_login(); $data['res']=''; if($id!='' && $filter=='') { $sql2="SELECT * FROM `cc_batches` where md5(batch_id) = '$id';"; $resp=$this->user_model->run_query($sql2); foreach ($resp->result() as $data['res']); } $sub_qry = ""; if($id!='' && $filter!='') $sub_qry = " WHERE course_id = '$id' "; $sql="SELECT * FROM `cc_batches` $sub_qry order by post_date desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='batc'; $data['subj_id']=$id; $this->load->view('admin/batches',$data); } // ---------------------------------------------- public function new_batch_sub() { $this->is_login(); $data['course_id']=strip_tags(trim($this->input->post('course_id'))); $data['batch_name']=strip_tags(trim($this->input->post('batch_name'))); // $data['test_id']=strip_tags(trim($this->input->post('test_id'))); // $data['status']=strip_tags(trim($this->input->post('status'))); if($data['batch_name'] != '' ){ if($this->user_model->insertRow('cc_batches', $data)) $this->session->set_flashdata('messagePr', '

Success! New Batch Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/batches', 'refresh'); } // ---------------------------------------------- public function update_batch($id='') { $this->is_login(); $data['course_id']=strip_tags(trim($this->input->post('course_id'))); $data['batch_name']=strip_tags(trim($this->input->post('batch_name'))); $data['test_id']=strip_tags(trim($this->input->post('test_id'))); $data['status']=strip_tags(trim($this->input->post('status'))); if($data['batch_name'] != '' && $id != ''){ if($this->user_model->updateRow('cc_batches', 'md5(batch_id)', $id, $data)) $this->session->set_flashdata('messagePr', '

Success! Batch Details Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/batches', 'refresh'); } // ------------------------------------------- public function delete_batch($id='') { $this->is_login(); if($id != '') { $this->user_model->delete_id('cc_batches' , 'md5(batch_id)', $id); $this->session->set_flashdata('messagePr', '

Success! Batch Deleted Successfully..!

' ); } redirect(base_url().'admin/batches', 'refresh'); } // ****************************************** public function exam_results($id='') { $this->is_login(); $data['res']=''; if($id!='') { $sql2="SELECT * FROM `cc_results` where md5(res_id) = '$id';"; $resp=$this->user_model->run_query($sql2); foreach ($resp->result() as $data['res']); } $sql="SELECT * FROM `cc_results` order by post_date desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='resu'; $this->load->view('admin/exam_results',$data); } // ---------------------------------------------- public function exam_result_sub() { $this->is_login(); $data['result_title']=strip_tags(trim($this->input->post('result_title'))); $data['link_url']=strip_tags(trim($this->input->post('link_url'))); $data['status']=strip_tags(trim($this->input->post('status'))); if($data['result_title'] != '' ){ if($this->user_model->insertRow('cc_results', $data)) $this->session->set_flashdata('messagePr', '

Success! Result Notification Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/exam_results', 'refresh'); } // ---------------------------------------------- public function update_exam_result($id='') { $this->is_login(); $data['result_title']=strip_tags(trim($this->input->post('result_title'))); $data['link_url']=strip_tags(trim($this->input->post('link_url'))); $data['status']=strip_tags(trim($this->input->post('status'))); if($data['result_title'] != '' && $id != ''){ if($this->user_model->updateRow('cc_results', 'md5(res_id)', $id, $data)) $this->session->set_flashdata('messagePr', '

Success! Result Notification Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/exam_results', 'refresh'); } // ------------------------------------------- public function delete_exam_result($id='') { $this->is_login(); if($id != '') { $this->user_model->delete_id('cc_results' , 'md5(res_id)', $id); $this->session->set_flashdata('messagePr', '

Success! 1 Result Deleted Successfully..!

' ); } redirect(base_url().'admin/exam_results', 'refresh'); } // ********************************************* public function job_notifications($id='') { $this->is_login(); $data['res']=''; if($id!='') { $sql2="SELECT * FROM `cc_notifications` where md5(noti_id) = '$id';"; $resp=$this->user_model->run_query($sql2); foreach ($resp->result() as $data['res']); } $sql="SELECT * FROM `cc_notifications` order by post_date desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='noti'; $this->load->view('admin/job_notifications',$data); } // ---------------------------------------------- public function job_notification_sub() { $this->is_login(); $data['noti_title']=strip_tags(trim($this->input->post('noti_title'))); $data['noti_url']=strip_tags(trim($this->input->post('noti_url'))); $data['status']=strip_tags(trim($this->input->post('status'))); $data['job_type']=strip_tags(trim($this->input->post('job_type'))); if($data['noti_title'] != '' ){ if($this->user_model->insertRow('cc_notifications', $data)) $this->session->set_flashdata('messagePr', '

Success! Notification Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/job_notifications', 'refresh'); } // ---------------------------------------------- public function update_job_notification($id='') { $this->is_login(); $data['noti_title']=strip_tags(trim($this->input->post('noti_title'))); $data['noti_url']=strip_tags(trim($this->input->post('noti_url'))); $data['status']=strip_tags(trim($this->input->post('status'))); $data['job_type']=strip_tags(trim($this->input->post('job_type'))); if($data['noti_title'] != '' && $id != ''){ if($this->user_model->updateRow('cc_notifications', 'md5(noti_id)', $id, $data)) $this->session->set_flashdata('messagePr', '

Success! Notification Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/job_notifications', 'refresh'); } // ------------------------------------------- public function delete_job_notification($id='') { $this->is_login(); if($id != '') { $this->user_model->delete_id('cc_notifications' , 'md5(noti_id)', $id); $this->session->set_flashdata('messagePr', '

Success! Notification Deleted Successfully..!

' ); } redirect(base_url().'admin/job_notifications', 'refresh'); } // ****************************************** public function flash_news($id='') { $this->is_login(); $data['res']=''; if($id!='') { $sql2="SELECT * FROM `cc_flash_news` where md5(news_id) = '$id';"; $resp=$this->user_model->run_query($sql2); foreach ($resp->result() as $data['res']); } $sql="SELECT * FROM `cc_flash_news` order by start_date desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='flas'; $this->load->view('admin/flash_news',$data); } // ---------------------------------------------- public function new_flash_news_sub() { $this->is_login(); $data['news_title']=strip_tags(strtoupper(trim($this->input->post('news_title')))); $data['link_url']=strip_tags(trim($this->input->post('link_url'))); $data['start_date']=strip_tags(trim($this->input->post('start_date'))); $data['end_date']=strip_tags(trim($this->input->post('end_date'))); if($data['news_title'] != '' ){ if($this->user_model->insertRow('cc_flash_news', $data)) $this->session->set_flashdata('messagePr', '

Success! Flash News Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/flash_news', 'refresh'); } // ---------------------------------------------- public function update_flash_news($id='') { $this->is_login(); $data['news_title']=strip_tags(trim($this->input->post('news_title'))); $data['link_url']=strip_tags(trim($this->input->post('link_url'))); $data['start_date']=strip_tags(trim($this->input->post('start_date'))); $data['end_date']=strip_tags(trim($this->input->post('end_date'))); if($data['news_title'] != '' && $id != ''){ if($this->user_model->updateRow('cc_flash_news', 'md5(news_id)', $id, $data)) $this->session->set_flashdata('messagePr', '

Success! Flash News Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/flash_news', 'refresh'); } // ------------------------------------------- public function delete_flash_news($id='') { $this->is_login(); if($id != '') { $this->user_model->delete_id('cc_flash_news' , 'md5(news_id)', $id); $this->session->set_flashdata('messagePr', '

Success! Flash News Deleted Successfully..!

' ); } redirect(base_url().'admin/flash_news', 'refresh'); } // ****************************************** public function useful_links($id='') { $this->is_login(); $data['res']=''; if($id!='') { $sql2="SELECT * FROM `cc_useful_links` where md5(link_id) = '$id';"; $resp=$this->user_model->run_query($sql2); foreach ($resp->result() as $data['res']); } $sql="SELECT * FROM `cc_useful_links` order by link_id desc;"; $data['response']=$this->user_model->run_query($sql); $data['total']= $data['response']->num_rows(); $data['mnu']='usef'; $this->load->view('admin/useful_links',$data); } // ---------------------------------------------- public function new_useful_link_sub() { $this->is_login(); $data['link_title']=strip_tags(trim($this->input->post('link_title'))); $data['link_url']=strip_tags(trim($this->input->post('link_url'))); if($data['link_title'] != '' ){ if($this->user_model->insertRow('cc_useful_links', $data)) $this->session->set_flashdata('messagePr', '

Success! Useful Link Created Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/useful_links', 'refresh'); } // ---------------------------------------------- public function update_useful_link($id='') { $this->is_login(); $data['link_title']=strip_tags(trim($this->input->post('link_title'))); $data['link_url']=strip_tags(trim($this->input->post('link_url'))); if($data['link_title'] != '' && $id != ''){ if($this->user_model->updateRow('cc_useful_links', 'md5(link_id)', $id, $data)) $this->session->set_flashdata('messagePr', '

Success! Useful Link Updated Successfully..!

' ); else $this->session->set_flashdata('messagePr', '

Failed! Please Try Again..!

' ); } redirect( base_url().'admin/useful_links', 'refresh'); } // ------------------------------------------- public function delete_useful_link($id='') { $this->is_login(); if($id != '') { $this->user_model->delete_id('cc_useful_links' , 'md5(link_id)', $id); $this->session->set_flashdata('messagePr', '

Success! 1 Useful Link Deleted Successfully..!

' ); } redirect(base_url().'admin/useful_links', 'refresh'); } // ****************************************** public function download_file($filenm='', $exldata='') { if($filenm!='' && count($exldata)) { $export_data=$exldata; //print_r($export_data); if ($export_data) { function filterData(&$str) { $str = preg_replace("/\t/", "\\t", $str); $str = preg_replace("/\r?\n/", "\\n", $str); if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"'; } // headers for download header("Content-Disposition: attachment; filename=\"$filenm\""); header("Content-Type: application/vnd.ms-excel"); foreach($export_data as $row) { // filter data array_walk($row, 'filterData'); echo implode("\t", array_values($row)) . "\n"; } } } return; } // ****************************************** public function login() { $this->session->unset_userdata('admin_data'); $data=''; $this->load->view('admin/index',$data); } // ******************************************* public function login_auth(){ $return = $this->user_model->auth_admin(); if(empty($return) || $return == 'not_varified') { $this->session->set_flashdata("messagePr", '

Invalid Login Credentials..!

'); redirect( base_url().'admin/login', 'refresh' ); } $this->session->set_userdata('admin_data',$return); $admin_id = $this->session->userdata('admin_data')[0]->a_id; $urole = $this->session->userdata('admin_data')[0]->role; $dt = date('Y-m-d H:i:s'); $qry="update cc_admin set visits = (visits+1), last_login = '$dt' WHERE a_id = '$admin_id';"; $this->user_model->run_query($qry); if($urole === 'Admin') redirect(base_url().'admin/dashboard', 'refresh'); else if($urole === 'Employee') redirect(base_url().'employee/dashboard', 'refresh'); } // ******************************************* public function is_login(){ if(!empty($this->session->userdata('admin_data')[0]->a_id)){ return true; } else { redirect( base_url().'admin/login', 'refresh'); } } // =========================================================== /** * This function is used to logout user */ public function logout(){ $this->session->unset_userdata('admin_data'); // $this->session->unset_userdata('emp_data'); redirect( base_url().'admin/login', 'refresh'); } // ****************== Jquery ===**************************** }

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...