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_model','sms'); } //added by winter... public function model_send_sms($sms,$to){ //SMS notification... $p=trim(str_replace(' ' ,"", $to)); $s=str_replace('-' ,"", $p); $s=str_replace('(' ,"", $s); $s=str_replace(')' ,"", $s); $t=substr($s, -9); if(strlen($t)<9){ echo 'imekosewa'; }else{ $newto='255'.$t; $smstext =$sms; ### API TO SEND SMS $arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), ); $to = $newto; $sms = $smstext; $from = urlencode("AFELSCHOOL"); $sms = urlencode($smstext); $send = file_get_contents("https://www.sms.co.tz/api.php?do=sms&username=afeltechnologies&password=AFELSMS123&senderid=$from&dest=$to&msg=$sms", false, stream_context_create($arrContextOptions)); } } public function fasthub_send($batch_id){ #select sms gateway credentions $this->db->where('status',1); $gateway = $this->db->get('sms_token'); foreach($gateway->result() as $token){ $channel = $token->channel; $password = $token->password; } ## the function to send sms via fasthub ## Cheking if the user has the SMS header $this->db->select('header'); $this->db->where('school_id',$this->session->userdata('school_id')); $user = $this->db->get('sms_headers'); $header = 'AFELSCHOOL'; foreach($user->result() as $h){ $header = $h->header; } $messages_array = array(); $sms_count = 0; //$sms_from_db = $this->db->where('school_id',$this->session->userdata('school_id'))->where('checked',1)->where('batch_id',$batch_id) //->limit(49, 97)->get('sent_sms')->result(); //select distinct round for insert sms in < 50 limit $this->db->distinct(); $this->db->select('round'); $this->db->where('batch_id',$batch_id); $get_round = $this->db->get('sent_sms')->result(); foreach($get_round as $sms_round){ $round = $sms_round->round; //empty array $messages_array = [];$sms_count=0; $sms_from_db = $this->db->where('school_id',$this->session->userdata('school_id'))->where('checked',1)->where('batch_id',$batch_id) ->where('round',$round)->get('sent_sms')->result(); foreach($sms_from_db as $sm){ $sms_count = $sms_count + ceil(strlen($sm->sms)/158); $messages_array[] = array( 'text' => $sm->sms, 'msisdn' => $sm->sms_to, 'source' => $header, ); } $postData = array( 'channel' => array( // 'channel' => 118994, //'password' => "Y2M2YWUwNjc2ZWVmM2UzNWU5MzcwN2M1YTFlYTUxM2M0MTA2MjA4NzJiNWMyNDM5MzBiNGQ5MmFhNTJlOWNiMw==" 'channel' => trim($channel), 'password' => trim($password), ), 'messages' => $messages_array ); $ch = curl_init('https://bulksms.fasthub.co.tz/fasthub/messaging/json/api'); curl_setopt_array($ch, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), CURLOPT_POSTFIELDS => json_encode($postData) )); $responseData = curl_exec($ch); if (curl_error($ch)) { //echo 'not working!:' . curl_error($ch); //return 0; }else{ $data = json_decode($responseData); $sms_id = $data->reference_id; $this->db->where('batch_id',$batch_id); $this->db->update('sent_sms',array('sms_id'=>$sms_id)); $balance = $this->sms->balance_update($sms_count); } } return 1; } public function fasthub_send11($batch_id){ #select sms gateway credentions $this->db->where('status',1); $gateway = $this->db->get('sms_token'); foreach($gateway->result() as $token){ $channel = $token->channel; $password = $token->password; } ## the function to send sms via fasthub ## Cheking if the user has the SMS header $header=""; $this->db->select('header'); $this->db->where('school_id',$this->session->userdata('school_id')); $user = $this->db->get('sms_headers'); foreach($user->result() as $h){ $header = $h->header; } if($user->num_rows() == 0){ $header = 'AFELSCHOOL'; } $messages_array = array(); $sms_count = 0; $sms_from_db = $this->db->where('checked',1)->where('batch_id',$batch_id)->limit(49)->get('sent_sms')->result(); //$sms_from_db = $this->db->where('checked',1)->where('batch_id',$batch_id)->limit(50, 50)->get('sent_sms')->result(); foreach($sms_from_db as $sm){ $sms_count = $sms_count + ceil(strlen($sm->sms)/158); $messages_array[] = array( 'text' => $sm->sms, 'msisdn' => $sm->sms_to, 'source' => $header, ); } $postData = array( 'channel' => array( //'channel' => 118994, //'password' => "Y2M2YWUwNjc2ZWVmM2UzNWU5MzcwN2M1YTFlYTUxM2M0MTA2MjA4NzJiNWMyNDM5MzBiNGQ5MmFhNTJlOWNiMw==" 'channel' => trim($channel), 'password' => trim($password), ), 'messages' => $messages_array ); /* $smsbatch = array( 'batch'=>json_encode($postData), 'school_id'=>$this->session->userdata('school_id'), 'timestamp'=>date('Y-m-d H:i:s'), ); $this->db->insert('sms_batches',$smsbatch); */ $ch = curl_init('https://bulksms.fasthub.co.tz/fasthub/messaging/json/api'); curl_setopt_array($ch, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), CURLOPT_POSTFIELDS => json_encode($postData) )); $responseData = curl_exec($ch); if (curl_error($ch)) { //echo 'not working!:' . curl_error($ch); return 0; }else{ $data = json_decode($responseData); $sms_id = $data->reference_id; $this->db->where('batch_id',$batch_id); $this->db->update('sent_sms',array('sms_id'=>$sms_id)); $balance = $this->sms->balance_update($sms_count); return 1; } } public function validate_balance($sms){ # $sms = Number of sms $this->db->where('school_id',$this->session->userdata('school_id')); $user = $this->db->get('billing_update')->row(); $amount = $user->amount; $price = $this->db->get('sms_price')->row(); $price = $price->amount; $user_sms = round($amount/$price); if($user_sms >= $sms){ return true; }else{ return false; } } public function send($sms){ # $sms = messages ## Cheking if the user has the SMS header $this->db->select('header'); $this->db->where('school_id',$this->session->userdata('school_id')); $user = $this->db->get('sms_headers'); $header = 'AFELSCHOOL'; foreach($user->result() as $h){ $header = $h->header; } $sms_count = 0; $arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), ); $header = urlencode($header); $sent = 0; $messages = array(); foreach($sms as $text){ $to = $text['sms_to']; $sms = urlencode($text['sms']); $sms_count = $sms_count + ceil(strlen($text['sms'])/160); $dataz = file_get_contents("https://www.sms.co.tz/api.php?do=sms&username=afeltechnologies&password=AFELSMS123&senderid=$header&dest=$to&msg=$sms", false, stream_context_create($arrContextOptions)); $data = array( "sms_id"=>$dataz ); $this->db->where('sms_id',$text['sms_id']); $this->db->update('sent_sms',$data); } ## Now update the sms balance $balance = $this->sms->balance_update($sms_count); return $sms_count; } public function balance_update($n){ # $n = number of sms $amount=0; if($this->session->userdata('school_id')){ $this->db->where('school_id',$this->session->userdata('school_id')); $user = $this->db->get('billing_update')->row(); $amount = $user->amount; }else{ $this->db->where('district_id',$this->session->userdata('district')); $user = $this->db->get('billing_update_dc')->row(); $amount = $user->amount; } $price = $this->db->get('sms_price')->row(); $price = $price->amount; $amount_taken = $price*$n; $new_amount = $amount - $amount_taken; $update = array('amount'=>$new_amount); if($this->session->userdata('school_id')){ $this->db->where('school_id',$this->session->userdata('school_id')); $this->db->update('billing_update',$update); }else{ $this->db->where('district_id',$this->session->userdata('district')); $this->db->update('billing_update_dc',$update); } if($this->session->userdata('school_id')){ $data = array( 'amount'=>$amount_taken, 'school_id'=>$this->session->userdata('school_id'), 'date'=>date("Y-m-d h:i:sa"), ); $this->db->insert('billing_transactions',$data); } } }