asif87 Newbie
Posts: 1
Threads: 1
Joined: Sep 2018
Reputation:
0
09-08-2018, 09:57 PM
I am having two (02) error when using Code. Can any one please help me.. I am attaching the files to resolve the error properly. Please help me.
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 0
Filename: views/purchase_order.php
Line Number: 98
Backtrace:
File: /application/views/purchase_order.php
Line: 98
Function: _error_handler
File: /application/controllers/Purchase_order.php
Line: 164
Function: view
File: /index.php
Line: 284
Function: require_once
----------------------------------------------------
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: views/purchase_order.php
Line Number: 98
Backtrace:
File: /application/views/purchase_order.php
Line: 98
Function: _error_handler
File: ulti_pos_0001/application/controllers/Purchase_order.php
Line: 164
Function: view
File: /index.php
Line: 284
Function: require_once
Attached Files
views-purchase_order.php (Size: 6.94 KB / Downloads: 38)
controllers-Purchase_order.php (Size: 49.05 KB / Downloads: 40)
index.php (Size: 10.51 KB / Downloads: 56)
Wouter60 Posting Freak
Posts: 851
Threads: 38
Joined: Feb 2015
Reputation:
77
09-08-2018, 11:49 PM
(This post was last modified: 09-08-2018, 11:51 PM by Wouter60 .)
I guess the problem is in your model:
PHP Code:
$statusData = $this -> Constant_model -> getDataOneColumn ( 'purchase_order_status' , 'id' , " $status_id " ); $status_name = $statusData [ 0 ]-> name ;
It looks like the function in your model isn't returning anything.
By the way, there's no point in enclosing the $status_id by quotes.
h3yb0y Newbie
Posts: 6
Threads: 1
Joined: Oct 2018
Reputation:
0
Hello! i have the similar problem... the strange thing is one:
From January to August work without problem, i go to holidays, first september i restart work and try to use the website but give me this error:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: views/view_lesson.php
Line Number: 83
Backtrace:
File: /home/educarei/gestdev/application/views/view_lesson.php
Line: 83
Function: _error_handler
File: /home/educarei/gestdev/application/controllers/Lessons.php
Line: 122
Function: view
File: /home/educarei/gestdev/index.php
Line: 315
Function: require_once
I don't touch nothing. Code of website, php or mysql.
Someone have idea about could be happened?
h3yb0y Newbie
Posts: 6
Threads: 1
Joined: Oct 2018
Reputation:
0
(10-12-2018, 05:43 AM) Piotr Wrote: Problem is in views/view_lesson.php on line 83 you using property of var that is not object.
What that i do not understand is: Why for 6 months work correctly and from september no? I don't touch nothing in the code of website.
The php version is egual, i not provide to update. This problem give me in two different webserver (developed in xampp and also in xamp webserver give me this error)
Thanks for answer
h3yb0y Newbie
Posts: 6
Threads: 1
Joined: Oct 2018
Reputation:
0
(10-13-2018, 09:29 AM) application\views\view_lesson.php Wrote: Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="bootstrap default admin template">
<title>View Lesson</title>
<style type="text/css">
.table-condensed thead tr th{
color: #faa200 !important;
}
.file1 {
visibility: hidden;
position: absolute;
}
.browse.btn.btn-primary,
.form-control.input-lg{
height: 35px !important;
}
.over-scrollsty p img{width: auto !important;}
</style>
<?php include('top.php') ?>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css" />
<link rel="stylesheet" type="text/css" href="assets/css/jquery.dataTables.min.css">
</head>
<body>
<div class="se-pre-con loading_div"></div>
<div class="wrapper">
<!-- header start -->
<?php include('header.php') ?>
<link rel="stylesheet" type="text/css" href="assets/css/Redirecting.css">
<!-- header end here -->
<section id="main" class="container-fluid">
<div class="row">
<section id="content-wrapper" class="form-elements">
<div class="site-content-title">
<h2 class="float-xs-left content-title-main">View Lesson</h2>
<ol class="breadcrumb float-xs-right">
<li class="breadcrumb-item">
<span class="fs1" aria-hidden="true" data-icon=""></span>
<a href="<?php echo base_url(); ?>">Home</a>
</li>
<li class="breadcrumb-item active"><a href="<?php echo base_url(); ?>lesson">Lesson List</a></li>
<li class="breadcrumb-item active">View Lesson</li>
</ol>
</div>
<div class="contain-inner dashboard_v4-page">
<!-- middle section -->
<div class="col-md-12 col-lg-12 col-xs-12 col-sm-12">
<!-- row -->
<table class="clientdata-allsty">
<tr>
<td class="client-boldfirst">Cliente</td>
<td><?php echo ($customer_list[0]['customer_name']); ?></td>
</tr>
<tr>
<td class="client-boldfirst">Nome Cane</td>
<td> <?php
$dog = $this->db->where('dog_id', $lesson_detail->lesson_dog)->get('dogs')->row();
echo $dog->dog_name;
?></td>
</tr>
<tr>
<td class="client-boldfirst">Date</td>
<td><?php echo $lesson_detail->lesson_date ?> </td>
</tr>
<tr>
<td class="client-boldfirst">Ora</td>
<td><?php echo $lesson_detail->lesson_time; ?></td>
</tr>
<tr>
<td class="client-boldfirst">Pacchetto</td>
<td><?php
$package = $this->db->where('package_id', $lesson_detail->lesson_customer)->get('package ')->row();
echo $package ->package_name;
?></td>
</tr>
<?php if($this->session->userdata('user_type')=='admin'){ ?>
<tr>
<td class="client-boldfirst">Addestratore</td>
<td> <?php
$tc = $this->db->where('trainer_id', $lesson_detail->lesson_trainer)->get(' trainer')->row();
//print_r($tc);exit();
if (!empty($tc)) {
echo $tc->trainer_name; ?> <?php echo $tc->trainer_email;
}
?></td>
</tr>
<tr>
<td class="client-boldfirst">Allegato</td>
<td><?php if (!empty($lesson_detail->lesson_attachment)) { ?>
<img src="<?php echo base_url(); ?>assets/lessons/<?php echo $lesson_detail->lesson_attachment; ?>" style="max-width: 400px;" >
<?php } ?></td>
</tr>
<tr>
<td class="client-boldfirst">Note</td>
<td><?php echo $lesson_detail->note; ?></td>
</tr>
<?php } ?>
<tr >
<td class="client-boldfirst">Descrizione</td>
<td>
<div class="over-scrollsty">
<?php echo $lesson_detail->lesson_description; ?>
</div></td>
</tr>
</table>
</div>
<!-- middle section end -->
</div>
</section>
</div>
</section>
<!-- footer section start -->
<?php include('footer.php') ?>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$(document).ready(function() { var date = new Date(); var today = new Date(date.getFullYear(), date.getMonth(), date.getDate()); var end = new Date(date.getFullYear(), date.getMonth(), date.getDate()); $('.datepicker').datepicker({ format: "mm/dd/yyyy", todayHighlight: true, autoclose: true }); $('.datepicker').datepicker('setDate', today); });
</script>
<script type="text/javascript">
$(document).ready(function(){
var count1=1;
$(".add_lesson").click(function(){
$(".ford").append('<div class="col-md-12 col-sm-12 col-xs-12 col-sm-12 pad-lr-0 del-div"> <div class="col-md-12 col-sm-12 col-xs-12 col-lg-12 maindiv"> <div class="col-md-2"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0"> <div class="form-group"> <select class="selectpicker form-control get_dogs" data-show-subtext="true" data-live-search="true" name="customer[]""> <option value="">Select Customer</option> <?php if(!empty($customer_list)){foreach ($customer_list as $customer_list_val) {?> <option value="<?php echo $customer_list_val['customer_id'] ?>"> <?php echo $customer_list_val['customer_name']. ' ('.$customer_list_val['customer_email'].')'; ?></option> <?php } } ?> </select> </div></div></div></div><div class="col-md-2"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0 seldogdiv"> <div class="form-group sel_dogs"> <select class="selectpicker form-control get_appointment_date" data-show-subtext="true" data-live-search="true" name="dog[]"> <option value="">Select Dog Name</option> </select> </div></div></div></div><div class="col-md-1"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0 selappointmentdiv"> <div class="form-group sel_appointment"> <select class="form-control" name="date[]"> <option value="">Select Date</option> </select> </div></div></div></div><div class="col-md-1"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0"> <div class="form-group"> <select name="trainer[]" class="selectpicker form-control" data-show-subtext="true" data-live-search="true"> <option value="">Trainer </option> <option value="1">Trainer two</option> <option value="2">Trainer three</option> </select> </div></div></div></div><div class="col-md-2"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0"> <div class="form-group" style="margin-bottom: 0;"> <input type="file" name="lesson_attachment[]" class="file1"> <div class="input-group col-xs-12"><input type="text" class="form-control input-lg" disabled placeholder="Upload Image"><span class="input-group-btn"><button class="browse btn btn-primary hvr-trim input-lg" type="button"><i class="glyphicon glyphicon-picture"></i> </button></span></div></div></div></div></div><div class="col-md-1"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0"> <div class="form-group"> <select name="access[]" class="form-control"><option>Public</option><option>Private</option></select></div></div></div></div> <div class="col-md-2"><div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0"> <div class="form-group"> <textarea name="lesson_description[]" rows="3" class="form-control"></textarea> </div> </div> </div> </div><div class="col-md-1"> <div class="element-form"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12 pad-0"> <div class="form-group"> <button class="btn hvr-trim btn-primary rvm_lesson"> <i class="fa fa-trash-o" aria-hidden="true"></i> </button> </div></div></div></div></div></div>'); $('.datepicker').datepicker('refresh');$('.selectpicker').selectpicker('refresh'); count1++; });
$('.ford').on('click','.rvm_lesson',function() {
$(this).parent().parent().parent().parent().parent().remove();
});
});
</script>
<script type="text/javascript" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#myTable1').DataTable();
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myTable3').DataTable();
});
$(document).on('click', '.browse', function(){
var file = $(this).parent().parent().parent().find('.file1');
file.trigger('click');
});
$(document).on('change', '.file1', function(){
$(this).parent().find('.form-control').val($(this).val().replace(/C:\\fakepath\\/i, ''));
});
</script>
<!--<script type="text/javascript" src="<?php echo base_url();?>assets/fckeditor/ckeditor.js"></script>
<script src="<?php echo base_url();?>assets/fckeditor/_samples/sample.js" type="text/javascript"></script>-->
<!-- <script src="<?php echo base_url();?>assets/tinymce/tinymce.min.js"></script>
<script>
$(document).ready(function () {
if ($("#descen").length > 0) {
tinymce.init({
selector: "textarea#descen",
theme: "modern", height: 300,
paste_data_images: true,
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker"
, "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking"
, "save table contextmenu directionality emoticons template paste textcolor"
]
, toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons"
,
image_advtab: true,
file_picker_callback: function(callback, value, meta) {
if (meta.filetype == 'image') {
$('#upload').trigger('click');
$('#upload').on('change', function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(e) {
callback(e.target.result, {
alt: ''
});
};
reader.readAsDataURL(file);
});
}
},
templates: [{
title: 'Test template 1',
content: 'Test 1'
}, {
title: 'Test template 2',
content: 'Test 2'
}]
});
}
});
</script> -->
<script src="<?php echo base_url();?>assets/tinymce/tinymce.min.js"></script>
<script>
$(document).ready(function() {
tinymce.init({
selector: "textarea#mymce",
theme: "modern",
paste_data_images: true,
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
file_picker_callback: function(callback, value, meta) {
if (meta.filetype == 'image') {
$('#upload').trigger('click');
$('#upload').on('change', function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(e) {
callback(e.target.result, {
alt: ''
});
};
reader.readAsDataURL(file);
});
}
},
templates: [{
title: 'Test template 1',
content: 'Test 1'
}, {
title: 'Test template 2',
content: 'Test 2'
}]
});
});
/*$(document).ready(function () {
if ($("#mymce").length > 0) {
tinymce.init({
selector: "textarea#mymce",
theme: "modern", height: 300,
paste_data_images: true,
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker"
, "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking"
, "save table contextmenu directionality emoticons template paste textcolor"
]
, toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons"
,
image_advtab: true,
file_picker_types: 'image',
file_picker_callback: function(callback, value, meta) {
if (meta.filetype == 'image') {
$('#upload').trigger('click');
$('#upload').on('change', function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(e) {
callback(e.target.result, {
alt: ''
});
};
reader.readAsDataURL(file);
});
}
},
templates: [{
title: 'Test template 1',
content: 'Test 1'
}, {
title: 'Test template 2',
content: 'Test 2'
}]
});
}
});*/
</script>
</div>
</body>
</html>
PHP Code:
<?php defined ( 'BASEPATH' ) OR exit( 'No direct script access allowed' ); class Lessons extends CI_Controller { public function __construct () { parent :: __construct (); $this -> load -> model (array( 'setting_model' => 'smodel' , 'lesson_model' => 'lmodel' , 'dog_model' => 'dmodel' , 'customer_model' => 'cmodel' )); $this -> load -> helper (array( 'form' , 'url' , 'mailer_helper' )); $this -> load -> library (array( 'email' , 'session' , 'form_validation' )); $user_email = get_cookie ( 'dog_user_id' ); $this -> login_id = $this -> session -> userdata ( 'dog_loggdin_user_id' ); $loggdin_user_id = $this -> session -> userdata ( 'dog_loggdin_user_id' ); if (empty( $user_email ) && empty( $loggdin_user_id )) { redirect ( base_url ()); } $data [ 'account_setting' ]= $this -> smodel -> get_account_setting (); $this -> load -> vars ( $data ); } public function lesson () { $data [ 'lesson_list' ]= $this -> lmodel -> get_lesson_list (); $this -> load -> view ( 'lession' , $data ); } public function get_selected_package ( $customer_id ) { $data [ 'selected_package' ]= $this -> lmodel -> get_selected_package ( $customer_id ); echo $data [ 'selected_package' ]-> payments_id ; } public function get_all_package ( $customer_id ) { $date = date ( 'Y-m-d' ); /*and pkg_lessons_appointment!=0*/ $where = 'p.customer_name="' . $customer_id . '" and STR_TO_DATE(p.end_date,"%d/%m/%Y")>= "' . $date . '"' ; $query = $this -> db -> select ( 'p.payments_id,pack.package_name,pack.package_id' )-> from ( 'payments as p' )-> join ( 'package as pack' , 'p.package_name=pack.package_id' )-> where ( $where )-> get ()-> result_array (); $option = '' ; foreach ( $query as $value ) { $option .= '<option value="' . $value [ 'package_id' ]. '">' . $value [ 'package_name' ]. '</option>' ; } echo $option ; } public function get_single_appointment_date () { $input = $this -> input -> post (); $query = $this -> db -> where (array( 'date' => $input [ 'appointment_date' ], 'customer_id' => $input [ 'customer_id' ], 'dog_id' => $input [ 'dog_id' ], 'time' => $input [ 'appointment_time' ]))-> get ( 'appointment' )-> row (); echo $query -> id ; } public function add_lesson ( $date = '' , $customer_id = '' , $dog_id = '' , $appointment_id = '' , $time = '' , $lesson_id = '' ) { $lesson_id = base64_decode ( $lesson_id ); $data [ 'trainer_list' ]= $this -> smodel -> get_trainer_list (); if (!empty( $lesson_id )) { $data [ 'lesson_detail' ]= $this -> lmodel -> get_single_lesson ( $lesson_id ); } if (!empty( $date ) && !empty( $customer_id ) && !empty( $dog_id ) && !empty( $appointment_id ) && !empty( $time )) { $date = base64_decode ( $date ); $customer_id = base64_decode ( $customer_id ); $dog_id = base64_decode ( $dog_id ); $appointment_id = base64_decode ( $appointment_id ); $time = base64_decode ( $time ); $data [ 'customer_id' ]= $customer_id ; $data [ 'selected_package' ]= $this -> lmodel -> get_selected_package ( $customer_id ); $data [ 'appointment_id' ]= $appointment_id ; $data [ 'trainer_list' ]= $this -> smodel -> get_trainer_list (); $data [ 'customer_list' ]= $this -> cmodel -> get_sel_app_user_profile ( $customer_id ); $data [ 'dog_list' ]= $this -> dmodel -> get_single_dog ( $dog_id ); $data [ 'appointment_list' ]= $this -> lmodel -> get_single_appointment_date ( $appointment_id ); $data [ 'time' ]= $time ; $data [ 'lesson_id' ]= $lesson_id ; $this -> load -> view ( 'add_lesson' , $data ); } else { $data [ 'customer_list' ]= $this -> cmodel -> get_lesson_user_profile (); $this -> load -> view ( 'add_lesson' , $data ); } } public function add_edit_lesson () { $input = $this -> input -> post (); header ( 'Content-Type: application/json' ); $remove_input = value_remover ( $input ,[ 'lesson_description' , 'appointment_id' , 'payments_id' , 'lesson_id' , 'old_lesson_img' , 'note' ]); foreach ( $remove_input as $key => $value ) { $this -> form_validation -> set_rules ( $key , ucwords ( str_replace ( '_' , ' ' , $key )), 'trim|required' ); } if ( $this -> form_validation -> run ()== FALSE ) { $errors = $this -> form_validation -> error_array (); echo json_encode (array( 'status' => 'validate_error' , 'errors' => $errors )); } else { if ( $_FILES [ 'lesson_attachment' ][ 'name' ]!= '' ) { $image = $this -> insert_single_image ( 'lesson_attachment' , 'lessons' , 'lesson' ); } else { $image = $input [ 'old_lesson_img' ]; } $result = $this -> lmodel -> add_edit_lesson ( $_POST , $image ); if ( $result == 'success' ) echo json_encode (array( 'status' => 'success' , 'message' => 'Lesson Successfully Added.' )); else if( $result == 'updated' ) echo json_encode (array( 'status' => 'success' , 'message' => 'Lesson Successfully Updated.' )); else if( $result == 'error' ) echo json_encode (array( 'status' => 'error' , 'message' => 'Unable to Add Lesson.' )); else if( $result == 'package_expired' ) echo json_encode (array( 'status' => 'error' , 'message' => 'Package Expired.' )); else if( $result == 'lesson_already_exist' ) echo json_encode (array( 'status' => 'error' , 'message' => 'Lesson already exist on that date.' )); } } public function view_lessons ( $id = "" ) { $lesson = $this -> lmodel -> get_single_lesson ( $id ); $data [ 'lesson_detail' ]= $this -> lmodel -> get_single_lesson ( $id ); $data [ 'selected_package' ]= $this -> lmodel -> get_selected_package ( $lesson -> lesson_customer ); $data [ 'customer_list' ]= $this -> cmodel -> get_sel_app_user_profile ( $lesson -> lesson_customer ); $data [ 'dog_list' ]= $this -> dmodel -> get_single_dog ( $lesson -> lesson_dog ); $this -> load -> view ( 'view_lesson' , $data ); } public function get_customer_dogs ( $cid ) { $query = $this -> db -> select ( '*' )-> from ( 'dogs d' )-> where ( 'd.customer_name' , $cid )-> get ()-> result_array (); $option = '' ; foreach ( $query as $value ) { $option .= '<option value="' . $value [ 'dog_id' ]. '">' . $value [ 'dog_name' ]. '</option>' ; } echo $option ; } public function get_appointment_date ( $dog_id ) { $query = $this -> db -> select ( 'a.id as appointment_id,a.date as appointment_date' )-> from ( 'appointment a' )-> join ( 'customer c' , 'c.customer_id=a.customer_id' )-> where (array( 'c.customer_verify' => 1 , 'a.dog_id' => $dog_id ))-> order_by ( 'c.customer_id' , 'desc' )-> get ()-> result_array (); $option = '' ; foreach ( $query as $value ) { $option .= '<option value="' . $value [ 'appointment_date' ]. '">' . $value [ 'appointment_date' ]. '</option>' ; } echo $option ; } public function get_appointment_time () { $input = $this -> input -> post (); $query = $this -> db -> select ( '*' )-> from ( 'appointment a' )-> where (array( 'a.date' => $input [ 'date' ], 'a.customer_id' => $input [ 'customer_id' ], 'a.dog_id' => $input [ 'dog_id' ]))-> get ()-> result_array (); $option = '' ; foreach ( $query as $value ) { $option .= '<option value="' . $value [ 'time' ]. '">' . $value [ 'time' ]. '</option>' ; } echo $option ; } public function insert_image ( $imagename , $folder , $redirect ){ $imagecount = count ( $_FILES [ $imagename ][ 'name' ]); for ( $i = 0 ; $i < $imagecount ; $i ++) { $cover_image = '' ; $config [ 'upload_path' ] = './assets/' . $folder . '' ; $config [ 'allowed_types' ] = '*' ; $config [ 'max_size' ] = 50000 ; $_FILES [ 'userFile' ][ 'name' ]= time (). '_' . $_FILES [ $imagename ][ 'name' ][ $i ]; $_FILES [ 'userFile' ][ 'type' ] = $_FILES [ $imagename ][ 'type' ][ $i ]; $_FILES [ 'userFile' ][ 'tmp_name' ] = $_FILES [ $imagename ][ 'tmp_name' ][ $i ]; $_FILES [ 'userFile' ][ 'error' ] = $_FILES [ $imagename ][ 'error' ][ $i ]; $_FILES [ 'userFile' ][ 'size' ] = $_FILES [ $imagename ][ 'size' ][ $i ]; $value = 'userFile' ; $this -> load -> library ( 'upload' , $config ); if ( ! $this -> upload -> do_upload ( $value )) { $error = $this -> upload -> display_errors (); $this -> session -> set_flashdata ( 'error' , strip_tags ( $error )); } else { $image = array( 'upload_data' => $this -> upload -> data ()); $cover_image = $image [ 'upload_data' ][ 'file_name' ]; $this -> load -> library ( 'image_lib' ); } $images []= $cover_image ; } return $images ; } public function insert_single_image ( $imagename , $folder , $redirect ) { $cover_image = '' ; $config [ 'upload_path' ] = './assets/' . $folder . '' ; $config [ 'allowed_types' ] = '*' ; $config [ 'max_size' ] = 50000 ; $_FILES [ 'userFile' ][ 'name' ]= time (). '_' . $_FILES [ $imagename ][ 'name' ]; $_FILES [ 'userFile' ][ 'type' ] = $_FILES [ $imagename ][ 'type' ]; $_FILES [ 'userFile' ][ 'tmp_name' ] = $_FILES [ $imagename ][ 'tmp_name' ]; $_FILES [ 'userFile' ][ 'error' ] = $_FILES [ $imagename ][ 'error' ]; $_FILES [ 'userFile' ][ 'size' ] = $_FILES [ $imagename ][ 'size' ]; $value = 'userFile' ; $this -> load -> library ( 'upload' , $config ); if ( ! $this -> upload -> do_upload ( $value )) { $error = $this -> upload -> display_errors (); $this -> session -> set_flashdata ( 'error' , strip_tags ( $error )); } else { $image = array( 'upload_data' => $this -> upload -> data ()); $cover_image = $image [ 'upload_data' ][ 'file_name' ]; $this -> load -> library ( 'image_lib' ); } $images = $cover_image ; return $images ; } public function add_edit_appointment () { $input = $this -> input -> post (); header ( 'Content-Type: application/json' ); $remove_input = value_remover ( $input ,[ 'appointment_id' ]); foreach ( $remove_input as $key => $value ) { $this -> form_validation -> set_rules ( $key , ucwords ( str_replace ( '_' , ' ' , $key )), 'trim|required' ); } if ( $this -> form_validation -> run ()== FALSE ) { $errors = $this -> form_validation -> error_array (); echo json_encode (array( 'status' => 'validate_error' , 'errors' => $errors )); } else { $result = $this -> lmodel -> add_edit_appointment ( $input ); $result = explode ( '@@@@@' , $result ); if ( $result [ 0 ]== 'success' ) echo json_encode (array( 'status' => 'success' , 'message' => 'Appointment Successfully Added.' , 'date' => base64_encode ( $input [ 'date' ]), 'customer_id' => base64_encode ( $input [ 'customer_id' ]), 'dog_id' => base64_encode ( $input [ 'dog_id' ]), 'appointment_id' => base64_encode ( $result [ 1 ]))); else if( $result [ 0 ]== 'error' ) echo json_encode (array( 'status' => 'error' , 'message' => 'Unable to Add Appointment.' )); else if( $result [ 0 ]== 'already_exist' ) echo json_encode (array( 'status' => 'error' , 'message' => 'Appointment already exist.' )); else if( $result [ 0 ]== 'package_expired' ) { $customer_number = $this -> get_customer_number ( $input [ 'customer_id' ]); echo json_encode (array( 'status' => 'error' , 'message' => 'Package Expired' , 'customer_no' => $customer_number -> customer_first_tel , 'customer_name' => $customer_number -> customer_name )); } } } public function add_edit_vetenary ( $customer_id = '' , $veterinary_id = '' ) { $input = $this -> input -> post (); if ( $this -> input -> post ()) { $input = $this -> input -> post (); $remove_input = value_remover ( $input ,[ 'veterinary_id' , 'hidVet' ]); foreach ( $remove_input as $key => $value ) { if ( is_array ( $remove_input [ $key ])) { $this -> form_validation -> set_rules ( $key . '[]' , ucwords ( str_replace ( '_' , ' ' , $key )), 'required' ); } else { $this -> form_validation -> set_rules ( $key , ucwords ( str_replace ( '_' , ' ' , $key )), 'trim|required' ); } } if ( $this -> form_validation -> run ()== FALSE ) { $errors = $this -> form_validation -> error_array (); echo json_encode (array( 'status' => 'validate_error' , 'errors' => $errors )); exit (); } if ( $this -> lmodel -> addVeterinary ( $this -> input -> post ())) { echo json_encode (array( 'status' => 'success' , 'message' => 'Details Add/Update Successfully' )); } else { echo json_encode (array( 'status' => 'error' , 'message' => 'Unable to Add/Update' )); } } else { $data [ 'dogs' ]= $this -> lmodel -> get_all_dogs ( $customer_id ); $data [ 'veterinay_list' ]= $this -> lmodel -> get_all_veterniary (); if (!empty( $veterinary_id )) { $data [ 'veterinary_detail' ]= $this -> lmodel -> get_vet_detail ( $veterinary_id ); } $this -> load -> view ( 'add_edit_vetenary' , $data ); } } public function auto_send_message ( $customer_name ) { $date = date ( 'Y-m-d' ); $ids = $this -> db -> select ( 'p.payments_id,c.customer_name,pac.package_name,c.customer_first_tel' )-> where ( 'p.customer_name="' . $customer_name . '" and expire_msg= 0 and pkg_lessons_appointment=0 or STR_TO_DATE(p.end_date,"%d/%m/%Y")< "' . $date . '"' )-> from ( 'payments p ' )-> join ( 'package as pac' , 'pac.package_id=p.package_name' )-> join ( 'customer as c' , 'c.customer_id=p.customer_name' )-> get ()-> result_array (); if (!empty( $ids ) && !empty( $ids [ 0 ][ 'customer_name' ])) { foreach ( $ids as $value ) { $url = 'https://www.ovh.com/cgi-bin/sms/http2sms.cgi?&account=sms-sg15844-1&login=funnydogsms&password=12345678&from=Funny%20Dog&to=' . $value [ 'customer_first_tel' ]. '&message=Your "' . $value [ 'package_name' ]. '"has expired' ; $payments_ids []= $value [ 'payments_id' ]; $ch = curl_init (); curl_setopt ( $ch , CURLOPT_URL , $url ); curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , true ); curl_setopt ( $ch , CURLOPT_SSL_VERIFYPEER , false ); $vc_offers = curl_exec ( $ch ); print_r ( curl_error ( $ch )); curl_close ( $ch ); } if (!empty( $payments_ids )) { $this -> db -> where_in ( 'payments_id' , $payments_ids )-> update ( 'payments' ,array( 'expire_msg' => 1 )); } } } public function get_customer_number ( $id ) { $no = $this -> db -> select ( 'customer_first_tel,customer_name' )-> where ( 'customer_id' , $id )-> get ( 'customer' )-> row (); return $no ; } public function delete_lesson ( $pay_id = '' , $less_id = '' ) { $lesson = $this -> db -> where (array( 'lesson_id' => $less_id ))-> get ( 'lesson' )-> row (); $payment_get = $this -> db -> where (array( 'payments_id' => $lesson -> payments_id ))-> get ( 'payments' )-> row (); $pkg_update = $payment_get -> pkg_lessons_appointment + 1 ; $appo_update = $payment_get -> total_app + 1 ; $payment_update = $this -> db -> where (array( 'payments_id' => $lesson -> payments_id ))-> update ( 'payments' ,array( 'pkg_lessons_appointment' => $pkg_update , 'total_app' => $appo_update )); $query = $this -> db -> query ( "DELETE t1.*, t2.* FROM appointment t1, lesson t2 WHERE t1.id = t2.appointment_id AND t2.lesson_id = '" . $less_id . "'" ); if ( $query ) { echo json_encode (array( 'status' => 'success' , 'message' => 'Lesson Successfully Deleted.' )); } else { echo json_encode (array( 'status' => 'success' , 'message' => 'Unable to Delete Lesson.' )); } } }
application\controllers\Lessons.php
PiotrI don't know. Hard to tell without seeing code.