1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// For Amazon Simple Email Service
// Begin
/*use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'C:/Workspace/phpmailer/vendor/autoload.php';
echo "sdfs";exit();*/
// end
class Customer extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Customer_model');
$this->load->helper('access');
if(!$this->session->userdata('logged_in')) {
redirect(base_url());
}
$class = $this->router->fetch_class();
$method = $this->router->fetch_method();
$r = check_access($class,$method);
// $r);exit();
if($r == false)
{
redirect(base_url().'welcome/error_404');
}
}
public function test2(){
$data = '{"name":"Anju","email":"anju.techware@gmail.com","message" :"Hi Team"}';
$this->load->library('email');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://in-v3.mailjet.com',
'smtp_port' => 465,
'smtp_user' => '5e7ae616f1b582180ca64a4d23c159eb', // change it to yours
'smtp_pass' => '0961ab46deb93945831967ca63ba0438', // change it to yours
'smtp_timeout'=>30,
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE,
'newline' => '\r\n'
);
$this->email->initialize($config);// add this line
$subject = 'New Mail';
$name= $data->name;
$mailTemplate=$data->message;
$name = 'sadasdasd';
$to = 'anju.techware@gmail.com';
$subject = 'asdsadasd';
$mailTemplate = 'test message';
//$this->email->set_newline("\r\n");
$this->email->from('mail@mailjet.com', $name);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($mailTemplate);
echo $this->email->send();
// $this->email->_response_code); //200 success
$this->email->print_debugger();
}
public function mytest(){
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'email-smtp.eu-west-1.amazonaws.com';
$mail->SMTPAuth = true;
$mail->Username = 'AKIAJSARUYNQ6JILLDEA';
$mail->Password = 'AlGnHXKNoQRCrIqZzXUzdRPR94ENkLO3TXfSqIKBlpSA';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
//Recipients
$mail->setFrom('nyhasinas@gmail.com', 'Ipakkie Mailer');
// $mail->addAddress('rilakely@yahoo.com', 'Rila User'); // Add a recipient
$mail->addAddress('anju.techware@gmail.com', 'Anju User');
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject11';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
//echo 'Message has been sent';
//echo $mail->send();
$mail->print_debugger();
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
}
public function view_customer(){
$template['page'] = "Customer/view-customers";
$template['page_title'] = "Customer Details";
$template['data'] = $this->Customer_model->get_customer();
//$template['verification']= $this->Customer_model->get_verification();
$this->load->view('template',$template);
}
public function edit_customer() {
$template['page'] = 'Customer/edit-customer';
$template['page_title'] = "Edit Customer";
$id = $this->uri->segment(3);
$template['data'] = $this->Customer_model->get_single_customer($id);
if(!empty($template['data'])) {
if($_POST) {
$data = $_POST;
unset($data['submit']);
// if(isset($_FILES['image'])) {
// $config = $this->set_upload_options();
// $this->load->library('upload');
// $this->upload->initialize($config);
// if ( ! $this->upload->do_upload('image')) {
// unset($data['image']);
// }
// else {
// //$data['image'] = base_url().$config['upload_path']."/".$_FILES['image']['name'];
// $upload_data = $this->upload->data();
// $data['image'] = base_url().$config['upload_path']."/".$upload_data['file_name'];
// }
// }
//$data['created_user'] = $this->session->userdata('logged_in')['id'];
$result = $this->Customer_model->update_customer($data, $id);
// array_walk($data, "remove_html");
$this->session->set_flashdata('message', array('message' => 'Customer Updated Successfully','class' => 'success'));
redirect(base_url().'customer/view_customer');
}
else {
$this->load->view('template', $template);
}
}
}
public function delete_customer(){
$id = $this->uri->segment(3);
$result= $this->Customer_model->customer_delete($id);
$this->session->set_flashdata('message', array('message' => 'Requested Customer Deleted Successfully','class' => 'success'));
redirect(base_url().'Customer/view_customer');
}
public function customer_viewpopup() {
$id=$_POST['patientdetailsval'];
$template['data'] = $this->Customer_model->view_popup_customer($id);
$this->load->view('Customer/customer-view-popup',$template);
}
public function upload_goverment(){
$id = $this->uri->segment(3);
$template['page'] = 'Customer/upload_govt_id';
$template['page_title'] = "view offers";
if(isset($_POST)){
if(!empty($_POST)){
$data = $_POST;
// $data);exit();
if(!empty($_FILES)) {
//$data=$_POST;die;
$fileName =$_FILES['file']['name'];
$fileName = str_replace('%','a',$fileName);
$fileName = 'tukkibi'.'_'.time().".".$fileName;
$config = set_upload_options('./assets/uploads/profile_pic/');
$config['file_name'] = $fileName;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
$error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"message"=> "Sorry! Promocode Image not uploaded".$error['error']
);
}
else {
$imagedata = $this->upload->data();
$data['image']= base_url().'/assets/uploads/profile_pic/'.$imagedata['file_name'];
// $data['image']);
}
$data['user_id']=$id;
$result=$this->Customer_model->goverment_id_upload($data);
if($result){
$this->session->set_flashdata('message', array('message' => 'Uploaded Goverment Id Successfully','class' => 'success'));
redirect(base_url().'customer/view_customer');
}
// $data);exit();
}
}
}
$this->load->view('template', $template);
}
function set_upload_options($path) {
//upload an image options
$config = array();
$config['upload_path'] = $path;
$config['allowed_types'] = 'jpg|jpeg|png|gif';
$config['max_size'] = 0;
$config['max_width'] = 0;
$config['max_height'] = 0;
return $config;
}
}