Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
load->model('Sms','sms'); $this->load->database(); if ($this->session->userdata('user_type') =='student') { $this->session->set_flashdata('flash_data', 'You don\'t have access!'); redirect('Learning'); }elseif($this->session->userdata('user_type') =='employee'){ $this->session->set_flashdata('flash_data', 'You don\'t have access!'); redirect('Admin'); } } function compress($source, $destination, $quality=50) { $info = getimagesize($source); if ($info['mime'] == 'image/jpeg') $image = imagecreatefromjpeg($source); elseif ($info['mime'] == 'image/gif') $image = imagecreatefromgif($source); elseif ($info['mime'] == 'image/png') $image = imagecreatefrompng($source); imagejpeg($image, $destination, $quality); return $destination; } public function search_links(){ $this->db->like('shortName',$this->input->post('keyword')); foreach($this->db->get('usefulLinks')->result() as $row){ ?>
  • avatar
    shortName ?>

    name ?>

  • load->view("includes/device_detect.php"); $detect = new Mobile_Detect; $device='unknown'; if ( $detect->isMobile() ) { $device = "Mobile"; } elseif( $detect->isTablet() ){ $device = "Tablet"; }else{ $device = "Desktop"; } $keyword = $this->input->post('keyword'); $this->db->not_like('id',$this->session->userdata('id')); $this->db->like('full_name',$keyword,'BOTH'); $this->db->order_by('id','random'); $this->db->limit(10); $get_member=$this->db->get('students'); ?>
    load->view("includes/device_detect.php"); $detect = new Mobile_Detect; $device='unknown'; if ( $detect->isMobile() ) { $device = "Mobile"; } elseif( $detect->isTablet() ){ $device = "Tablet"; }else{ $device = "Desktop"; } $category = $this->input->post('category'); $keyword = $this->input->post('keyword'); if($category > 0){ $category_id=$category; $this->db->where('category_id',$category_id); $this->db->like('title',$keyword,'BOTH'); $this->db->order_by('id','desc'); $get=$this->db->get('business_informations'); }else{ $this->db->like('title',$keyword,'BOTH'); $this->db->order_by('id','desc'); $get=$this->db->get('business_informations'); } foreach($get->result() as $row){ ?>
    db->where('information_id',$row->id)->count_all_results('informationImages'); if($count==0){ ?> db->where('information_id',$row->id); $this->db->limit(1); $gets=$this->db->get('informationImages'); foreach($gets->result() as $row_image){ ?>
    title),0,40);?>

    contents),0,50).' ...'; ?>

    title;?>

    contents),0,200).' ...'; ?>

    db->where('info_id',$row->id); $count=$this->db->count_all_results('b_informations_readers'); $count1=0; $this->db->where('info_id',$row->id); $this->db->where('reader_id',$this->session->userdata('id')); $count1=$this->db->count_all_results('b_informations_readers'); ?>

    Author: author; ?>   Published on date; $newDate = date("d-M-Y", strtotime($orgDate)); echo $newDate; ?>


    load->view("includes/device_detect.php"); $detect = new Mobile_Detect; $device='unknown'; $category = $this->input->post('category'); if ( $detect->isMobile() ) { $device = "Mobile"; } elseif( $detect->isTablet() ){ $device = "Tablet"; }else{ $device = "Desktop"; } $start = $this->input->post('start'); $limit = $this->input->post('limit'); $keyword = $this->input->post('keyword'); if($category > 0){ $category_id=$category; $this->db->where('category_id',$category_id); $this->db->order_by('id','desc'); $this->db->limit($limit,$start); $get=$this->db->get('business_informations'); }else{ $this->db->like('title',$keyword,'BOTH'); $this->db->limit($limit,$start); $this->db->order_by('id','desc'); $get=$this->db->get('business_informations'); } foreach($get->result() as $row){ ?>
    db->where('information_id',$row->id)->count_all_results('informationImages'); if($count==0){ ?> db->where('information_id',$row->id); $this->db->limit(1); $gets=$this->db->get('informationImages'); foreach($gets->result() as $row_image){ ?>
    title),0,40);?>

    contents),0,50).' ...'; ?>

    title;?>

    contents),0,200).' ...'; ?>

    db->where('info_id',$row->id); $count=$this->db->count_all_results('b_informations_readers'); $count1=0; $this->db->where('info_id',$row->id); $this->db->where('reader_id',$this->session->userdata('id')); $count1=$this->db->count_all_results('b_informations_readers'); ?>

    Author: author; ?>   Published on date; $newDate = date("d-M-Y", strtotime($orgDate)); echo $newDate; ?>


    input->post('id'); $comment = $this->input->post('comment'); $this->db->where('id',$id)->update('comments',array('comment'=>$comment)); redirect($_SERVER['HTTP_REFERER']); } } public function edit_comment_reply(){ if($_POST){ $id = $this->input->post('id'); $comment = $this->input->post('comment'); $this->db->where('id',$id)->update('comments_reply',array('comment'=>$comment)); redirect($_SERVER['HTTP_REFERER']); } } public function search_products(){ $i=0; $this->db->like('title',$_POST['title'],'BOTH'); $this->db->limit(200); $this->db->order_by('id','random'); $getres = $this->db->get('business_products'); foreach($getres->result() as $rowss){ $this->db->where('id',$rowss->student_id); $this->db->where('showProfile','active'); $count=$this->db->count_all_results('students'); if($count>0){ ?>
    Product

    title),0,50); ?>
    price==NULL || $rowss->price == 'null'){ echo 'Affordable price'; }else{ echo $rowss->unit.' Tsh ' .number_format($rowss->price); } ?>

    num_rows() == 0){ ?>
    No result found for your search
    db->like('name',$_POST['title'],'BOTH'); $this->db->order_by('id','desc'); $getres=$this->db->get('lessons'); foreach($getres->result() as $row){ $i++; $student_id=$this->session->userdata('id'); //reading percent $t=$all=0; $this->db->where('lesson_id',$row->id); $this->db->where('student_id',$student_id); $get=$this->db->get('enroll_course'); foreach($get->result() as $rowss){ $all = $rowss->read_progress; } //check if enrolled $this->db->where('lesson_id',$row->id); $this->db->where('student_id',$student_id); $count_enrolled=$this->db->count_all_results('enroll_course'); ?>
    num_rows() == 0){ ?>
    No result found for your search
    input->post('userPost'); $this->load->view("includes/device_detect.php"); $post_id = $this->input->post('post_id'); $detect = new Mobile_Detect; $device='unknown'; if ( $detect->isMobile() ) { $device = "Mobile"; } elseif( $detect->isTablet() ){ $device = "Tablet"; }else{ $device = "Desktop"; } $student_id=$this->session->userdata('id'); $limit = $this->input->post('limit'); $start = $this->input->post('start'); if($post_id > 0){ $this->db->where('id',$post_id); }else{ $this->db->order_by('id','desc')->limit($limit, $start); } if($userPost){ $this->db->where('student_id',$userPost); } $posts = $this->db->get('posts'); if($posts->num_rows() > 0){ ?> load->view("includes/device_detect.php"); $detect = new Mobile_Detect; $device='unknown'; if ( $detect->isMobile() ) { $device = "Mobile"; } elseif( $detect->isTablet() ){ $device = "Tablet"; }else{ $device = "Desktop"; } if($this->input->post('reply') > 0){ // this is the reply; $comment = array( 'student_id'=>$this->session->userdata('id'), 'post_id'=>$this->input->post('post_id'), 'comment_id'=>$this->input->post('comment_id'), 'date'=>date('Y-m-d'), 'time'=>date('H:i:s'), 'comment'=>$this->input->post('comment'), ); $this->db->insert('comments_reply',$comment); $reply_id=$this->db->insert_id(); foreach($this->db->where('id',$this->input->post('comment_id'))->get('comments')->result() as $post){ if($post->student_id != $this->session->userdata('id')){ $note = array( 'student_id'=>$post->student_id, 'notify_id'=>$this->session->userdata('id'), 'content'=>'replied on your comment', 'category'=>'reply', 'activity_id'=>$this->input->post('post_id'), 'action_id'=>$reply_id, 'audience'=>'single', 'date'=>date('Y-m-d H:i:s'), ); $this->db->insert('notifications',$note); } } }else{ $comment = array( 'student_id'=>$this->session->userdata('id'), 'post_id'=>$this->input->post('post_id'), 'date'=>date('Y-m-d'), 'time'=>date('H:i:s'), 'comment'=>$this->input->post('comment'), ); $this->db->insert('comments',$comment); $comment_id=$this->db->insert_id(); // notifications here foreach($this->db->where('id',$this->input->post('post_id'))->get('posts')->result() as $post){ if($post->student_id != $this->session->userdata('id')){ $note = array( 'student_id'=>$post->student_id, 'notify_id'=>$this->session->userdata('id'), 'content'=>'commented on your post', 'category'=>'comment', 'activity_id'=>$this->input->post('post_id'), 'action_id'=>$comment_id, 'audience'=>'single', 'date'=>date('Y-m-d H:i:s'), ); $this->db->insert('notifications',$note); } } } $this->db->where('post_id', $this->input->post('post_id')); if($this->uri->segment(3) == "forum"){ $this->db->order_by('id','desc')->limit('5'); }else{ $this->db->order_by('id','desc'); } $get=$this->db->get('comments'); foreach($get->result() as $rowComment){ foreach($this->db->where('id',$rowComment->student_id)->get('students')->result() as $rowCommenter){ $commenter_name = $rowCommenter->full_name; $commenter_photo = $rowCommenter->profile_photo; } ?>
    thumb chat-user
    commented date));?> at time;?>

    comment;?>

    $this->session->userdata('id'), 'post_id'=>$this->input->post('post_id'), 'date'=>date('Y-m-d'), 'time'=>date('H:i:s'), ); $count = $this->db->where('student_id',$this->session->userdata('id'))->where('post_id',$this->input->post('post_id'))->count_all_results('likes'); if($count > 0){ $this->db->where('student_id',$this->session->userdata('id'))->where('post_id',$this->input->post('post_id'))->delete('likes'); foreach($this->db->where('id',$this->input->post('post_id'))->get('posts')->result() as $post){ $this->db->where('student_id',$post->student_id)->where('notify_id',$this->session->userdata('id'))->where('category','like')->where('activity_id',$this->input->post('post_id'))->delete('notifications'); } }else{ $this->db->insert('likes',$array); $like_id=$this->db->insert_id(); // notifications here foreach($this->db->where('id',$this->input->post('post_id'))->get('posts')->result() as $post){ if($post->student_id != $this->session->userdata('id')){ $note = array( 'student_id'=>$post->student_id, 'notify_id'=>$this->session->userdata('id'), 'content'=>'liked your post', 'category'=>'like', 'activity_id'=>$this->input->post('post_id'), 'action_id'=>$like_id, 'audience'=>'single', 'date'=>date('Y-m-d H:i:s'), ); $this->db->insert('notifications',$note); } } } } public function my_account(){ $mobile=$this->input->post('mobile'); $mobile =str_replace("-","",$mobile); $mobile =str_replace("(","",$mobile); $mobile =str_replace(")","",$mobile); $mobile =str_replace(" ","",$mobile); $email= $this->input->post('email'); $student_id =$this->input->post('id'); if($this->input->post('password')==''){ $data_ary1 = array( 'mobile'=>$mobile, 'email'=>$email, ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary1); redirect('welcome/my_account?sent'); }else{ $length=strlen($this->input->post('password')); $old_password=""; $student_id =$this->input->post('id'); $this->db->where('id',$student_id); foreach($this->db->get('students')->result() as $row){ $old_password=$row->password1; } if($this->input->post('password') != $this->input->post('password1')){ redirect('welcome/my_account?error1'); }elseif($this->input->post('password') == $old_password){ redirect('welcome/my_account?error2'); }elseif($length<6){ redirect('welcome/my_account?error3'); } $data_ary = array( 'mobile'=>$mobile, 'password'=>md5($this->input->post('password')), 'password1'=>$this->input->post('password'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary); redirect('welcome/my_account?sent'); } } public function change_password(){ $length=strlen($this->input->post('password')); $old_password=""; $student_id =$this->input->post('id'); $old =$this->input->post('old_password'); $this->db->where('id',$student_id); foreach($this->db->get('students')->result() as $row){ $old_password=$row->password1; } if($this->input->post('password') != $this->input->post('password1')){ redirect('welcome/change_password?error1'); }elseif($this->input->post('password') == $old_password){ redirect('welcome/change_password?error2'); }elseif($old != $old_password){ redirect('welcome/change_password?error4'); }elseif($length<6){ redirect('welcome/change_password?error3'); }else{ $data_ary = array( 'password'=>md5($this->input->post('password')), 'password1'=>$this->input->post('password'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary); redirect('welcome/change_password?sent'); } } public function edit_business_profile(){ $student_id =$this->input->post('id'); $data_ary = array( 'business_name'=>$this->input->post('business_name'), 'descriptions'=>$this->input->post('descriptions'), 'business_address'=>$this->input->post('business_address'), 'business_hours'=>$this->input->post('business_hours'), 'call_number'=>$this->input->post('call_number'), 'whatsapp_number'=>$this->input->post('whatsapp_number'), 'business_email'=>$this->input->post('business_email'), 'business_website'=>$this->input->post('business_website'), 'facebook'=>$this->input->post('facebook'), 'instagram'=>$this->input->post('instagram'), 'twitter'=>$this->input->post('twitter'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('student_id',$student_id); $this->db->update('business_profiles',$data_ary); redirect('welcome/edit_business_profile?sent'); } public function enroll_course(){ $student_id =$this->session->userdata('id'); $lesson_id= $this->input->post('lesson_id'); $data_ary = array( 'student_id'=>$student_id, 'lesson_id'=>$lesson_id, 'date'=>date('Y-m-d'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('student_id',$student_id); $this->db->where('lesson_id',$lesson_id); $count=$this->db->count_all_results('enroll_course'); if($count>0){ $this->db->where('student_id',$student_id); $this->db->where('lesson_id',$lesson_id); $this->db->update('enroll_course',$data_ary); }else{ $this->db->insert('enroll_course',$data_ary); //send email to enrolled student //get course foreach($this->db->where('id',$lesson_id)->get('lessons')->result() as $row){ $course=$row->name; } foreach($this->db->where('id',$student_id)->get('students')->result() as $rowOne){ $email=$rowOne->email; } $name=$this->session->userdata('full_name'); $to = $email; $subject = "TWCC Platform Online Course Enrollment "; $url= 'https://womenchamber.or.tz/'; $message = "Dear ".$name.",

    Our records indicate that you are enrolled for a ".$course." online course at the Tanzania Women chamber of Commerce (TWCC). Please visit our website or mobile app at this time for information critical to your success in the course.



    ".$url."

    Thank you,

    Tanzania Women chamber of Commerce (TWCC) "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: ' . "\r\n"; mail($to,$subject,$message,$headers); } redirect('welcome//lessons?lesson_id='.base64_encode($lesson_id)); } public function edit_my_profile(){ if (isset($_FILES["file"])) { //if there was an error uploading the file if ($_FILES["file"]["error"] > 0) { $student_id =$this->input->post('id'); $data_ary = array( 'full_name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'mobile'=>$this->input->post('mobile'), 'other_mobile'=>$this->input->post('other_mobile'), 'location'=>$this->input->post('location'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary); redirect('welcome/edit_my_profile?sent'); } else { $filename = basename($_FILES['file']['name']); $new = time() . rand(); $ext = pathinfo($filename, PATHINFO_EXTENSION); $target = $new . '_' . $filename; $target = str_replace(" ", "_", $target); $storagename = "./template/img/students_profiles/". $target; move_uploaded_file($_FILES["file"]["tmp_name"], $storagename); function formatBytes($bytes, $precision) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } $type = explode('/',$_FILES['file']['type']); $type = $type[0]; $student_id =$this->input->post('id'); $data_ary = array( 'full_name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'mobile'=>$this->input->post('mobile'), 'other_mobile'=>$this->input->post('other_mobile'), 'location'=>$this->input->post('location'), 'profile_photo'=>$target, ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$student_id); $this->db->update('students',$data_ary); redirect('welcome/edit_my_profile?sent'); } }else{ echo 'not sent'; } } public function send_answer() { //print_r($_POST); exit; $data=$this->input->post('data');//parameters $name=$this->input->post('name');//name of data sent $text=$this->input->post('text');//data sent if($name=='student_answer'){ $p=explode('|',$data); $exam_id=$p['0']; $qn_id=$p['1']; $student_id=$p['2']; $correct_ans=$p['3']; $mark=$p['4']; //check correct answer if(strtolower($text) == strtolower($correct_ans)){ $mark=$mark; }else{ $mark=0; } $data = array( 'exam_id'=>$exam_id, 'question_id'=>$qn_id, 'student_id'=>$student_id, 'correct_answer'=>strtolower($correct_ans), 'student_answer'=>strtolower($text), 'mark'=>$mark, 'date'=>date('Y-m-d h:i'), ); $dataUpdate = array( 'student_answer'=>strtolower($text), 'mark'=>$mark, 'date'=>date('Y-m-d h:i'), ); $this->db->where('exam_id',$exam_id); $this->db->where('question_id',$qn_id); $this->db->where('student_id',$student_id); $c=$this->db->get('student_answers')->num_rows(); if($c>0){ $this->db->where('exam_id',$exam_id); $this->db->where('question_id',$qn_id); $this->db->where('student_id',$student_id); $this->db->update('student_answers',$dataUpdate); }else{ $this->db->insert('student_answers',$data); } } } public function send_post() { $target = ''; if(isset($_FILES['file'])){ $filename = basename($_FILES['file']['name']); if(strlen($filename)>0){ $epl = explode('.',$filename); $ext = end($epl); $target = time() . rand().".".$ext; $storagename = "./template/img/posts/". $target; $source_img = $_FILES["file"]["tmp_name"]; $destination_img = $storagename; $d = $this->compress($source_img, $destination_img, 50); } } $data=$this->input->post('data');//parameters $name=$this->input->post('name');//name of data sent $text=$this->input->post('text');//data sent $title=$this->input->post('title');//data sent if(trim($text)!=""){ if($name=='post'){ $p=explode('|',$data); $student_id=$p['0']; $data = array( 'student_id'=>$student_id, 'post'=>$text, 'date'=>date('Y-m-d'), 'time'=>date('h:i'), 'post_image'=>$target, 'title'=>$title, ); $this->db->insert('posts',$data); } } } public function sendAuthotEmail(){ //send email to enrolled student //get course foreach($this->db->where('id',$this->session->userdata('id'))->get('students')->result() as $row){ $emailFrom=$row->email; } $name=$this->input->post('name'); $course=$this->input->post('courseName'); $code=$this->input->post('code'); $to = $this->input->post('to'); $subject = $this->input->post('subject'); $message = $this->input->post('message')."


    Name:".$name."
    Email:".$emailFrom."
    Course Code:".$code."
    Course Name:".$course."
    "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: ' . "\r\n"; mail($to,$subject,$message,$headers); $url = $_SERVER['HTTP_REFERER'].'?updated'; redirect($url); } public function edit_my_post(){ $data = array( 'post'=>$this->input->post('post'), 'title'=>$this->input->post('title'), ); $this->db->where('id',$this->input->post('post_id')); $this->db->where('student_id',$this->input->post('student_id')); $this->db->update('posts',$data); $url = $_SERVER['HTTP_REFERER']; if(count(explode('?',$url)) > 1){ $url = $_SERVER['HTTP_REFERER'].'&updated'; }else{ $url = $_SERVER['HTTP_REFERER'].'?updated'; } redirect($url); } public function report_post(){ $data = array( 'comment'=>$this->input->post('report'), 'poster_id'=>$this->input->post('poster_id'), 'reporter_id'=>$this->session->userdata('id'), 'post_id'=>$this->input->post('post_id'), 'date'=>date('Y-m-d H:i:s'), ); $this->db->insert('post_reports',$data); $url = $_SERVER['HTTP_REFERER']; if(count(explode('?',$url)) > 1){ $url = $_SERVER['HTTP_REFERER'].'&reportsent'; }else{ $url = $_SERVER['HTTP_REFERER'].'?reportsent'; } redirect($url); } public function delete_product(){ $id=base64_decode($_REQUEST['id']); $this->db->where('id',$id); $this->db->delete('business_products'); redirect('welcome/edit_business_products?deleted'); } public function delete_post(){ $post_id=base64_decode($_REQUEST['post_id']); //fetch Image files to delete... foreach($this->db->where('id',$post_id)->get('posts')->result() as $rowsImage){ //unlink image file $Path="./template/img/posts/".$rowsImage->post_image; if (file_exists($Path)){ unlink($Path); } } $this->db->where('id',$post_id); $this->db->delete('posts'); $this->db->where('activity_id',$post_id)->where('category!=','business')->delete('notifications'); redirect('welcome/forum?deleted'); } public function delete_comment(){ $comment_id=base64_decode($_REQUEST['comment_id']); //fetch Image files to delete... foreach($this->db->where('id',$post_id)->get('comments')->result() as $rowsImage){ //unlink image file $Path="./template/img/posts/".$rowsImage->comment_image; if (file_exists($Path)){ unlink($Path); } } $this->db->where('id',$comment_id); $this->db->delete('comments'); $this->db->where('action_id',$comment_id)->where('category','comment')->delete('notifications'); $url = $_SERVER['HTTP_REFERER']; if(count(explode('?',$url)) > 1){ $url = $_SERVER['HTTP_REFERER'].'&deleted1'; }else{ $url = $_SERVER['HTTP_REFERER'].'?deleted1'; } redirect($url); } public function delete_reply(){ $reply_id=base64_decode($_REQUEST['reply_id']); //fetch Image files to delete... foreach($this->db->where('id',$reply_id)->get('comments_reply')->result() as $rowsImage){ //unlink image file $Path="./template/img/posts/".$rowsImage->reply_image; if (file_exists($Path)){ unlink($Path); } } $this->db->where('id',$reply_id); $this->db->delete('comments_reply'); $this->db->where('action_id',$reply_id)->where('category','reply')->delete('notifications'); $url = $_SERVER['HTTP_REFERER']; if(count(explode('?',$url)) > 1){ $url = $_SERVER['HTTP_REFERER'].'&deleted2'; }else{ $url = $_SERVER['HTTP_REFERER'].'?deleted2'; } redirect($url); } public function edit_business_products() { if (isset($_FILES["file"])) { //if there was an error uploading the file if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "
    "; } else { $filename = basename($_FILES['file']['name']); $new = time() . rand(); $ext = pathinfo($filename, PATHINFO_EXTENSION); $target = $new . '_' . $filename; $target = str_replace(" ", "_", $target); $storagename = "./template/img/products/". $target; move_uploaded_file($_FILES["file"]["tmp_name"], $storagename); function formatBytes($bytes, $precision) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } $type = explode('/',$_FILES['file']['type']); $type = $type[0]; $data_ary = array( 'student_id' => $this->input->post('id'), 'title' => $this->input->post('title'), 'price' => $this->input->post('price'), 'unit' => $this->input->post('unit'), 'descriptions' => $this->input->post('descriptions'), 'photo' => $target, 'date_uploaded'=>date('Y-m-d') ); $data_ary = $this->security->xss_clean($data_ary); $count=$this->db->where('student_id',$this->input->post('id'))->count_all_results('business_products'); $this->db->insert('business_products', $data_ary); redirect('welcome/edit_business_products?sent'); } } else { echo 'not sent'; } } public function edit_business_products_upate() { $pr_id = $this->input->post('id'); if (isset($_FILES["file"])) { //if there was an error uploading the file if ($_FILES["file"]["error"] > 0) { $data_ary = array( // 'student_id' => $this->input->post('id'), 'title' => $this->input->post('title'), 'unit' => $this->input->post('unit'), 'price' => $this->input->post('price'), 'descriptions' => $this->input->post('descriptions'), //'photo' => $target, //'date_uploaded'=>date('Y-m-d') ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$pr_id); $this->db->update('business_products', $data_ary); redirect('welcome/edit_business_products?sent'); } else { $filename = basename($_FILES['file']['name']); $new = time() . rand(); $ext = pathinfo($filename, PATHINFO_EXTENSION); $target = $new . '_' . $filename; $target = str_replace(" ", "_", $target); $storagename = "./template/img/products/". $target; move_uploaded_file($_FILES["file"]["tmp_name"], $storagename); function formatBytes($bytes, $precision) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } $type = explode('/',$_FILES['file']['type']); $type = $type[0]; $data_ary = array( //'student_id' => $this->input->post('id'), 'title' => $this->input->post('title'), 'price' => $this->input->post('price'), 'unit' => $this->input->post('unit'), 'descriptions' => $this->input->post('descriptions'), 'photo' => $target, //'date_uploaded'=>date('Y-m-d') ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id',$pr_id); $this->db->update('business_products', $data_ary); redirect('welcome/edit_business_products?sent'); } } else { // } } public function send_video() { if (isset($_FILES["file"])) { //if there was an error uploading the file if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "
    "; } else { $filename = basename($_FILES['file']['name']); $new = time() . rand(); $ext = pathinfo($filename, PATHINFO_EXTENSION); $target = $new . '_' . $filename; $target = str_replace(" ", "_", $target); $storagename = "./template/materials/". $target; move_uploaded_file($_FILES["file"]["tmp_name"], $storagename); function formatBytes($bytes, $precision) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } $type = explode('/',$_FILES['file']['type']); $type = $type[0]; $data_ary = array( 'owner' => $this->input->post('owner'), 'title' => $this->input->post('title'), 'amount' => $this->input->post('amount'), 'owner_percent' => $this->input->post('owner_percent'), 'release_date' => $this->input->post('release_date'), 'movie_url' => $this->input->post('movie_url'), 'movie_trailer' => $this->input->post('movie_trailer'), 'description' => $this->input->post('description'), 'photo_file' => base_url('template/materials/').$target, 'date_uploaded'=>date('Y-m-d') ); $data_ary = $this->security->xss_clean($data_ary); $this->load->database(); $this->db->insert('movies', $data_ary); redirect('Admin/upload_movies?sent'); } } else { echo 'not sent'; } } public function edit_video() { $id=$this->input->post('id'); if (isset($_FILES["file"])) { //if there was an error uploading the file if ($_FILES["file"]["error"] > 0) { $data_ary = array( 'owner' => $this->input->post('owner'), 'title' => $this->input->post('title'), 'amount' => $this->input->post('amount'), 'owner_percent' => $this->input->post('owner_percent'), 'release_date' => $this->input->post('release_date'), 'movie_url' => $this->input->post('movie_url'), 'movie_trailer' => $this->input->post('movie_trailer'), 'description' => $this->input->post('description'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id', $id); $this->db->update('movies', $data_ary); redirect('Admin/edit_movie?id='.base64_encode($id).'&sent'); } else { $filename = basename($_FILES['file']['name']); $new = time() . rand(); $ext = pathinfo($filename, PATHINFO_EXTENSION); $target = $new . '_' . $filename; $target = str_replace(" ", "_", $target); $storagename = "./template/materials/". $target; move_uploaded_file($_FILES["file"]["tmp_name"], $storagename); function formatBytes($bytes, $precision) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } $type = explode('/',$_FILES['file']['type']); $type = $type[0]; $data_ary = array( 'owner' => $this->input->post('owner'), 'title' => $this->input->post('title'), 'amount' => $this->input->post('amount'), 'owner_percent' => $this->input->post('owner_percent'), 'release_date' => $this->input->post('release_date'), 'movie_url' => $this->input->post('movie_url'), 'movie_trailer' => $this->input->post('movie_trailer'), 'description' => $this->input->post('description'), 'photo_file' => base_url('template/materials/').$target, ); $data_ary = $this->security->xss_clean($data_ary); $this->db->where('id', $id); $this->db->update('movies', $data_ary); redirect('Admin/edit_movie?id='.base64_encode($id).'&sent'); } } else { echo 'not sent'; } } public function add_owner() { if($_POST){ $data = array( 'name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'mobile'=>$this->input->post('mobile'), 'location'=>$this->input->post('location'), 'date_registered'=>date('Y-m-d H:i:s'), 'registered_by'=>$this->session->userdata('id'), ); $this->db->insert('movie_owners',$data); redirect('admin/register_movie_owners?saved'); }else{ redirect($_SERVER['HTTP_REFERER']); } } public function add_actors() { if($_POST){ $data = array( 'name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'mobile'=>$this->input->post('mobile'), 'location'=>$this->input->post('location'), 'date_registered'=>date('Y-m-d H:i:s'), 'registered_by'=>$this->session->userdata('id'), ); $this->db->insert('actors',$data); redirect('admin/register_actors?saved'); }else{ redirect($_SERVER['HTTP_REFERER']); } } public function edit_owner() { if($_POST){ $id=$this->input->post('id'); $data = array( 'name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'mobile'=>$this->input->post('mobile'), 'location'=>$this->input->post('location'), 'last_updated'=>date('Y-m-d H:i:s'), 'updated_by'=>$this->session->userdata('id'), ); $this->db->where('id',$id); $this->db->update('movie_owners',$data); redirect('admin/edit_movie_owners?id='.base64_encode($id).'&saved'); }else{ redirect($_SERVER['HTTP_REFERER']); } } public function assign_actor() { if($_POST){ $data = array( 'movie_id'=>$this->input->post('movie_id'), 'actor_id'=>$this->input->post('actor_id'), 'date_assigned'=>date('Y-m-d H:i:s'), 'assigned_by'=>$this->session->userdata('id'), ); $this->db->where('actor_id',$this->input->post('actor_id')); $this->db->where('movie_id',$this->input->post('movie_id')); $count=$this->db->count_all_results('assigned_movies'); if($count>0){ // echo 'ipo';exit; }else{ $this->db->insert('assigned_movies',$data); } redirect('admin/assign_actors?saved'); }else{ redirect($_SERVER['HTTP_REFERER']); } } public function edit_actor() { if($_POST){ $id=$this->input->post('id'); $data = array( 'name'=>$this->input->post('name'), 'email'=>$this->input->post('email'), 'mobile'=>$this->input->post('mobile'), 'location'=>$this->input->post('location'), 'last_updated'=>date('Y-m-d H:i:s'), 'updated_by'=>$this->session->userdata('id'), ); $this->db->where('id',$id); $this->db->update('actors',$data); redirect('admin/edit_actor?id='.base64_encode($id).'&saved'); }else{ redirect($_SERVER['HTTP_REFERER']); } } public function create_vouchers(){ $number_of_voucher=$this->input->post('number_of_vouchers'); $movie_id=$this->input->post('movie_id'); $amount=$this->input->post('amount'); $batch = $this->session->userdata('id').time(); for($i=0;$i<$number_of_voucher;$i++){ $size = 12; $string = strtoupper(substr(rand(100000000000,999999999999), 0, $size)); $this->db->where('voucher_no', $string); $count = $this->db->get('voucher')->num_rows(); if($count>0){ $i=$i-1; }else{ $data_ary = array( 'voucher_no' => $string, 'amount' => $amount, 'batch' => $batch, 'movie_id' => $movie_id, 'date' => date('Y-m-d'), 'reg_by' => $this->session->userdata('id'), ); $data_ary = $this->security->xss_clean($data_ary); $this->db->insert('voucher', $data_ary); echo $string.'
    '; } } if (isset($_FILES["file"])) { //if there was an error uploading the file if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "
    "; } else { $filename = basename($_FILES['file']['name']); $new = time() . rand(); $ext = pathinfo($filename, PATHINFO_EXTENSION); $target = $new . '_' . $filename; $target = str_replace(" ", "_", $target); $storagename = "./template/materials/". $target; move_uploaded_file($_FILES["file"]["tmp_name"], $storagename); function formatBytes($bytes, $precision) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); // Uncomment one of the following alternatives $bytes /= pow(1024, $pow); // $bytes /= (1 << (10 * $pow)); return round($bytes, $precision) . ' ' . $units[$pow]; } $type = explode('/',$_FILES['file']['type']); $type = $type[0]; $data_ary = array( 'batch_id' => $batch, 'photo_file' => base_url('template/materials/').$target, 'date_uploaded'=>date('Y-m-d') ); $data_ary = $this->security->xss_clean($data_ary); $this->db->insert('voucher_covers', $data_ary); } } else { echo 'not sent'; } redirect('admin/create_vouchers?sent'); } public function selectDate() { $d=base64_encode($this->input->post('date')); $mid=base64_encode($this->input->post('mid')); $pid=base64_encode($this->input->post('pid')); redirect('welcome/market_view?mid='.$mid.'&pid='.$pid.'&d='.$d); } public function get_product() { ?> db->where('category_id',$this->input->post('id'))->get('marketProduct')->result() as $cat){ ?> db->where('region_id',$this->input->post('id'))->get('markets')->num_rows(); if($c>0){ foreach($this->db->where('region_id',$this->input->post('id'))->get('markets')->result() as $cat){ ?> db->get('region')->result() as $region){ //check market $cr = $this->db->where('region_id',$region->id)->get('markets')->num_rows(); if($cr==0){ continue; } foreach($this->db->where('region_id',$region->id)->get('markets')->result() as $market){ //check product $cp = $this->db->where('product_id',$this->input->post('id'))->where('market_id',$market->id)->get('marketProductPrices')->num_rows(); if($cp==0){ continue; } foreach($this->db->where('id',$market->region_id)->get('region')->result() as $r){ ?>