[521] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | if (!defined('BASEPATH'))
|
---|
| 4 | exit('No direct script access allowed');
|
---|
| 5 |
|
---|
[503] | 6 | class User extends MX_Controller {
|
---|
[466] | 7 |
|
---|
[521] | 8 | const TOKENPW = 'violet';
|
---|
[503] | 9 |
|
---|
[521] | 10 | public function __construct() {
|
---|
| 11 | parent::__construct();
|
---|
[554] | 12 | $this->load->helper('cookie');
|
---|
[636] | 13 | $this->load->helper('language');
|
---|
| 14 | $this->lang->load('messages', 'message');
|
---|
[521] | 15 | }
|
---|
| 16 |
|
---|
| 17 | public function profile() {
|
---|
| 18 | $user_info = $this->session->userdata('userInfo');
|
---|
[707] | 19 |
|
---|
[503] | 20 | if ($user_info) {
|
---|
[691] | 21 | $this->load->model('User_model');
|
---|
| 22 | $this->load->model('Servicepackage_model');
|
---|
[503] | 23 | $user = $user_info['user'];
|
---|
| 24 | $us_id = $user_info['us_id'];
|
---|
| 25 | $src = "SBG";
|
---|
| 26 | $token = md5($us_id . self::TOKENPW);
|
---|
| 27 | $data = $this->get_data($src, $token, $us_id);
|
---|
[706] | 28 | $data['can_edit'] = 0;
|
---|
[691] | 29 | $u = $this->User_model->get_user_by_id($us_id);
|
---|
[706] | 30 | if ($u['p_id'] < 1) {
|
---|
| 31 | $data['can_edit'] = 1;
|
---|
| 32 | }
|
---|
| 33 | if ($data['fullname']=="")
|
---|
| 34 | {
|
---|
| 35 | $data['can_edit'] = 1;
|
---|
| 36 | }
|
---|
[508] | 37 | $data['current_tab'] = $this->uri->segment(4, 'edit-basic');
|
---|
[691] | 38 | $data['packages'] = $this->Servicepackage_model->getAllPackages();
|
---|
| 39 | $data['is_viettel'] = isset($user_info['is_viettel']) ? $user_info['is_viettel']:FALSE;
|
---|
[701] | 40 | $data['provinces'] = lang('_PROVINCES_');
|
---|
| 41 |
|
---|
[691] | 42 | $data = (is_array($u)) ? array_merge($data, $u) : $data;
|
---|
| 43 | $data = (is_array($user_info)) ? array_merge($data, $user_info):$data;
|
---|
[559] | 44 |
|
---|
[503] | 45 | $this->load->view('frontend/user_profile', $data);
|
---|
[508] | 46 | } else {
|
---|
[503] | 47 | redirect('frontend/home');
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public function packageRegister() {
|
---|
| 52 | $result = array();
|
---|
| 53 | $input = $this->input->post();
|
---|
| 54 | $this->load->model('user_model');
|
---|
| 55 | $user_info = $this->session->userdata('userInfo');
|
---|
| 56 | if ($user_info) {
|
---|
| 57 | parse_str($user_info['user'], $info);
|
---|
| 58 | $this->load->model('servicepackage_model');
|
---|
[508] | 59 |
|
---|
[503] | 60 | $package = $this->servicepackage_model->getPackage($input['p_id']);
|
---|
| 61 | $user = $user_info['user'];
|
---|
| 62 | $us_id = $user_info['us_id'];
|
---|
| 63 | $user = $this->user_model->get_user_by_id($us_id);
|
---|
| 64 | $result['can_buy'] = 1;
|
---|
| 65 | $result['can_edit'] = 0;
|
---|
| 66 | if ($user['acc_balanced'] < $package['p_price']) {
|
---|
| 67 | $result['can_buy'] = 0;
|
---|
| 68 | }
|
---|
[580] | 69 |
|
---|
[706] | 70 | if(strtotime($user['expire_date'])<strtotime(date('Y-m-d'))){
|
---|
| 71 | $result['can_edit'] = 1;
|
---|
| 72 | }
|
---|
[503] | 73 | if ($user['p_id'] < 1) {
|
---|
| 74 | $result['can_edit'] = 1;
|
---|
| 75 | }
|
---|
[580] | 76 | if ($info['fullname']=="")
|
---|
| 77 | {
|
---|
| 78 | $result['can_edit'] = 1;
|
---|
| 79 | }
|
---|
[503] | 80 | $result['info'] = $info;
|
---|
| 81 | $result['user'] = $user;
|
---|
| 82 | $result['package'] = $package;
|
---|
| 83 | $result['modal'] = $this->load->view('frontend/package_register_modal', $result, true);
|
---|
| 84 | } else {
|
---|
| 85 |
|
---|
| 86 | }
|
---|
| 87 | echo json_encode($result);
|
---|
| 88 | }
|
---|
[554] | 89 |
|
---|
[503] | 90 | public function finishRegisterPackage() {
|
---|
| 91 | $result = array();
|
---|
| 92 | $result['success'] = 0;
|
---|
| 93 | $this->load->model('user_model');
|
---|
| 94 | $input = $this->input->post();
|
---|
[701] | 95 | //print_r($input);
|
---|
[503] | 96 | $user_info = $this->session->userdata('userInfo');
|
---|
[508] | 97 | parse_str($user_info['user'], $info);
|
---|
[503] | 98 | if (isset($input['fullname'])) {
|
---|
[548] | 99 | if (strlen($input['fullname']) < 1) {
|
---|
[636] | 100 | $result['errors'][] = lang('_SBG_REGISTER_VIP_FULLNAME_REQUIRED_MSG');
|
---|
[503] | 101 | }
|
---|
[548] | 102 | if (strlen($input['school']) < 1) {
|
---|
[636] | 103 | $result['errors'][] = lang('_SBG_REGISTER_VIP_SCHOOL_REQUIRED_MSG');
|
---|
[503] | 104 | }
|
---|
| 105 | if (!isset($result['errors'])) {
|
---|
[490] | 106 | $user_info = $this->session->userdata('userInfo');
|
---|
[503] | 107 | if ($user_info) {
|
---|
[508] | 108 |
|
---|
[503] | 109 | $src = "SBG";
|
---|
[508] | 110 | $us_id = $user_info['us_id'];
|
---|
[503] | 111 | $input['password'] = '';
|
---|
| 112 | $input['oldpass'] = '';
|
---|
| 113 | $input['gender'] = '';
|
---|
[508] | 114 | $input['email'] = '';
|
---|
[701] | 115 | //$input['province'] = '';
|
---|
[508] | 116 | $info['fullname'] = $input['fullname'];
|
---|
| 117 | $info['school'] = $input['school'];
|
---|
[503] | 118 | $token = md5($us_id . self::TOKENPW);
|
---|
| 119 | $user = $this->get_data($src, $token, $us_id);
|
---|
[701] | 120 | //$input['district'] = '';
|
---|
[503] | 121 | if ($input) {
|
---|
[490] | 122 | $this->load->model('user_model');
|
---|
[503] | 123 | $update = $this->user_model->update_user($src, $token, $input, $us_id);
|
---|
[508] | 124 | $info = urldecode(http_build_query($info));
|
---|
[554] | 125 | $userdata = array('username' => $user_info['username'], 'user' => $info, 'us_id' => $user_info['us_id'], 'logined_in' => TRUE, 'is_viettel' => $user_info['is_viettel']);
|
---|
[503] | 126 | $this->session->set_userdata('userInfo', $userdata);
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
| 129 | }
|
---|
| 130 | }
|
---|
[647] | 131 |
|
---|
[503] | 132 | if (isset($result['errors'])) {
|
---|
[554] | 133 | echo json_encode($result);
|
---|
[647] | 134 | exit();
|
---|
[503] | 135 | }
|
---|
[647] | 136 |
|
---|
[503] | 137 | $this->load->model('servicepackage_model');
|
---|
| 138 | $us_id = $user_info['us_id'];
|
---|
[700] | 139 | //$user = $this->user_model->get_user_by_id($us_id);
|
---|
| 140 | $user = $this->user_model->getUserById($us_id);
|
---|
[503] | 141 | $package = $this->servicepackage_model->getPackage($input['p_id']);
|
---|
[508] | 142 | $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
|
---|
[556] | 143 |
|
---|
| 144 | $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' ? date('Y-m-d 00:00:00') : $user['expire_date'];
|
---|
| 145 | $user['expire_date'] = date('Y-m-d', strtotime("+" . $package['p_period'] . " ".$package['p_unit'], strtotime($currentExpireDate)));
|
---|
[508] | 146 | $user['p_id'] = $package['p_id'];
|
---|
[706] | 147 | //$user['district'] = $input['district'];
|
---|
[701] | 148 | $user['province'] = $input['province'];
|
---|
[508] | 149 | $this->user_model->updateUser($us_id, $user);
|
---|
| 150 | $user['expire_date'] = date("d-m-Y", (strtotime($user['expire_date'])));
|
---|
| 151 | $result['expire_date'] = $user['expire_date'];
|
---|
[503] | 152 | $result['success'] = 1;
|
---|
[647] | 153 | $message = str_replace(':period:', date("d/m/Y", (strtotime($user['expire_date']))), lang('_SBG_REGISTER_VIP_SUCCESS_MSG'));
|
---|
| 154 | $result['message'] = $message;
|
---|
| 155 |
|
---|
[633] | 156 | $toDate = date("Y-m-d", (strtotime($result['expire_date'])));
|
---|
[646] | 157 | $this->user_model->insertRegisterVipLog($user['cellphone'],$package['p_code'], false);
|
---|
[503] | 158 | echo json_encode($result);
|
---|
| 159 | }
|
---|
[554] | 160 |
|
---|
| 161 | public function regpackage() {
|
---|
| 162 | $user_info = $this->session->userdata('userInfo');
|
---|
| 163 | parse_str($user_info['user'], $info);
|
---|
| 164 | $p_id = $this->input->post('p_id', TRUE);
|
---|
| 165 |
|
---|
| 166 | $us_id = (int) $info['id'];
|
---|
| 167 | $this->load->model('servicepackage_model');
|
---|
| 168 | $this->load->model('user_model');
|
---|
| 169 |
|
---|
| 170 | $user = $this->user_model->get_user_by_id($us_id);
|
---|
| 171 | $package = $this->servicepackage_model->getPackage($p_id);
|
---|
| 172 |
|
---|
| 173 | if ($user['acc_balanced'] < $package['p_price']) {
|
---|
[636] | 174 | $aryPatterns = array('/:acc_balanced:/');
|
---|
| 175 | $message = preg_replace($aryPatterns, array(number_format($user['acc_balanced'], 0)), lang('_SBG_ACC_BALANCE_LESS_PACKAGE_PRICE_MSG'));
|
---|
[554] | 176 | } else {
|
---|
| 177 | $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
|
---|
| 178 | $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' ? date('Y-m-d 00:00:00') : $user['expire_date'];
|
---|
| 179 |
|
---|
| 180 | $user['expire_date'] = date('Y-m-d', strtotime("+" . $package['p_period'] . " " . $package['p_unit'], strtotime($currentExpireDate)));
|
---|
| 181 | //$user['expire_date'] = date("Y-m-d", (strtotime($user['expire_date']) - 1));
|
---|
| 182 |
|
---|
| 183 | $user['p_id'] = $package['p_id'];
|
---|
| 184 |
|
---|
| 185 | $this->user_model->updateUser($us_id, $user);
|
---|
[636] | 186 | $aryPatterns = array('/:period:/');
|
---|
| 187 | $message = preg_replace($aryPatterns, array(date('d-m-Y', strtotime($user['expire_date']))), lang('_SBG_REGISTER_VIP_SUCCESS_MS'));
|
---|
[646] | 188 | $this->user_model->insertRegisterVipLog($user['cellphone'], $package['p_code'], false);
|
---|
[554] | 189 | }
|
---|
| 190 |
|
---|
| 191 | $this->session->set_flashdata('message', $message);
|
---|
| 192 | redirect('frontend/user/profile#services-register');
|
---|
[521] | 193 | }
|
---|
[503] | 194 |
|
---|
| 195 | private function get_data($src, $token, $us_id) {
|
---|
| 196 | $this->load->model('user_model');
|
---|
| 197 | $user = $this->user_model->get_user_info($src, $token, $us_id);
|
---|
| 198 |
|
---|
| 199 | if (strpos($user, '&')) {
|
---|
| 200 | parse_str($user);
|
---|
| 201 | $us = $this->user_model->get_user_by_id($us_id);
|
---|
| 202 | $data = array('us_id' => $us_id, 'username' => $username, 'fullname' => $fullname,
|
---|
| 203 | 'gender' => $gender, 'email' => $email, 'phone' => $phone, 'school' => $school, 'province' => $province,
|
---|
| 204 | 'acc_balanced' => $us['acc_balanced'], 'expire_date' => $us['expire_date'], 'date_diff' => $this->dateDiff($us['expire_date'])
|
---|
| 205 | );
|
---|
| 206 | return $data;
|
---|
| 207 | } else {
|
---|
| 208 | return "";
|
---|
| 209 | }
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | private function dateDiff($expire_date) {
|
---|
| 213 | $date1 = date("Y-m-d");
|
---|
| 214 | if ((strtotime($expire_date) - strtotime($date1)) < 0)
|
---|
| 215 | return "0 ngà y còn lại";
|
---|
| 216 | $diff = strtotime($expire_date) - strtotime($date1);
|
---|
| 217 | $years = floor($diff / (365 * 60 * 60 * 24));
|
---|
| 218 | $months = floor(($diff - $years * 365 * 60 * 60 * 24) / (30 * 60 * 60 * 24));
|
---|
| 219 | $days = floor(($diff - $years * 365 * 60 * 60 * 24 - $months * 30 * 60 * 60 * 24) / (60 * 60 * 24));
|
---|
| 220 | if ($years > 0) {
|
---|
| 221 | return $years . " nÄm, " . $months . " tháng, " . $days . " ngà y còn lại";
|
---|
| 222 | } else {
|
---|
| 223 | if ($months > 0) {
|
---|
| 224 | return $months . " tháng, " . $days . " ngà y còn lại";
|
---|
| 225 | } else {
|
---|
| 226 | return $days . " ngà y còn lại";
|
---|
| 227 | }
|
---|
| 228 | }
|
---|
| 229 | }
|
---|
[604] | 230 |
|
---|
| 231 | public function update_info() {
|
---|
[636] | 232 | $result['success'] = 0;
|
---|
[580] | 233 | $user_info = $this->session->userdata('userInfo');
|
---|
| 234 | if ($user_info) {
|
---|
| 235 | $us_id = $user_info['us_id'];
|
---|
| 236 | $result = array();
|
---|
| 237 | $result['success'] = 0;
|
---|
| 238 | $src = "SBG";
|
---|
| 239 | $token = md5($us_id . self::TOKENPW);
|
---|
| 240 | $user = $this->get_data($src, $token, $us_id);
|
---|
| 241 | $input = $this->input->post();
|
---|
| 242 | parse_str($user_info['user'], $info);
|
---|
| 243 | if ($input) {
|
---|
| 244 | if (strlen($input['fullname']) == 0) {
|
---|
[636] | 245 | $result['errors'][] = array("content"=>lang('_SBG_FULLNAME_REQUIRED_MSG'),"field"=>"fullname");
|
---|
[580] | 246 | }
|
---|
| 247 | if (strlen($input['school']) == 0) {
|
---|
[636] | 248 | $result['errors'][] = array("content"=>lang('_SBG_REGISTER_VIP_SCHOOL_REQUIRED_MSG'),"field"=>"school");
|
---|
[580] | 249 | }
|
---|
[508] | 250 |
|
---|
[580] | 251 | $input['password'] = '';
|
---|
| 252 | $input['oldpass'] = '';
|
---|
| 253 | $input['province'] = '';
|
---|
| 254 | $this->load->model('user_model');
|
---|
| 255 | if (!isset($result['errors'])) {
|
---|
| 256 | $result['data'] = $this->user_model->update_user($src, $token, $input, $us_id);
|
---|
| 257 | $result['success'] = 1;
|
---|
[636] | 258 | $info['fullname'] = $input['fullname'];
|
---|
| 259 | $info['school'] = $input['school'];
|
---|
[580] | 260 | $info = urldecode(http_build_query($info));
|
---|
| 261 | $userdata = array('username' => $user_info['username'], 'user' => $info, 'us_id' => $user_info['us_id'], 'logined_in' => TRUE, 'is_viettel' => $user_info['is_viettel']);
|
---|
| 262 | $this->session->set_userdata('userInfo', $userdata);
|
---|
| 263 | }
|
---|
| 264 | echo json_encode($result);
|
---|
| 265 | }
|
---|
| 266 | } else {
|
---|
| 267 | redirect('frontend/home');
|
---|
| 268 | }
|
---|
| 269 | }
|
---|
[604] | 270 |
|
---|
[503] | 271 | public function update_user() {
|
---|
| 272 | $us_id = $this->uri->segment(4);
|
---|
| 273 | $user_info = $this->session->userdata('userInfo');
|
---|
| 274 | if ($user_info) {
|
---|
| 275 | $result = array();
|
---|
| 276 | $result['success'] = 0;
|
---|
| 277 | $src = "SBG";
|
---|
| 278 | $token = md5($us_id . self::TOKENPW);
|
---|
| 279 | $user = $this->get_data($src, $token, $us_id);
|
---|
| 280 | $input = $this->input->post();
|
---|
| 281 | if ($input) {
|
---|
| 282 | $input['username'] = $user['username'];
|
---|
[508] | 283 | if (array_key_exists('fullname', $input)) {
|
---|
| 284 | if (strlen($input['fullname']) == 0) {
|
---|
[636] | 285 | $result['errors']['fullname_err'] = lang('_SBG_FULLNAME_REQUIRED_MSG');
|
---|
[508] | 286 | }
|
---|
| 287 | } else {
|
---|
| 288 | $input['fullname'] = $user['fullname'];
|
---|
| 289 | }
|
---|
[604] | 290 |
|
---|
[503] | 291 | $input['password'] = '';
|
---|
| 292 | $input['oldpass'] = '';
|
---|
| 293 | $this->load->model('user_model');
|
---|
| 294 | if (!isset($result['errors'])) {
|
---|
| 295 | $result['data'] = $this->user_model->update_user($src, $token, $input, $us_id);
|
---|
| 296 | $result['success'] = 1;
|
---|
| 297 | }
|
---|
[490] | 298 | echo json_encode($result);
|
---|
[503] | 299 | }
|
---|
| 300 | } else {
|
---|
| 301 | redirect('frontend/home');
|
---|
[490] | 302 | }
|
---|
[508] | 303 | }
|
---|
| 304 |
|
---|
| 305 | public function change_password() {
|
---|
| 306 | $us_id = $this->uri->segment(4);
|
---|
| 307 | $user_info = $this->session->userdata('userInfo');
|
---|
| 308 | if ($user_info) {
|
---|
| 309 | $this->load->model('user_model');
|
---|
| 310 | $us_id = $user_info['us_id'];
|
---|
| 311 | $src = "SBG";
|
---|
| 312 | $token = md5($us_id . self::TOKENPW);
|
---|
| 313 | $input = $this->input->post();
|
---|
[554] | 314 |
|
---|
[508] | 315 | if (strlen($input['passwd']) == 0) {
|
---|
[636] | 316 | $result['errors']['passwd_old_err'] = lang('_SBG_PASSWORD_REQUIRED_MSG');
|
---|
[508] | 317 | }
|
---|
[602] | 318 |
|
---|
[508] | 319 | if (strlen($input['passwd_new']) == 0) {
|
---|
[636] | 320 | $result['errors']['passwd_new_err'] = lang('_SBG_PASSWORD_REQUIRED_MSG');
|
---|
[614] | 321 | } else if (strcmp($input['passwd'], $input['passwd_new']) == 0) {
|
---|
[636] | 322 | $result['errors']['passwd_new_err'] = lang('_SBG_PASSWORD_DUPLICATE_MSG');
|
---|
[602] | 323 | }else
|
---|
| 324 | {
|
---|
| 325 | if (!preg_match('/^([0-9a-zA-Z]{6,65})*$/', $input['passwd_new']))
|
---|
| 326 | {
|
---|
[636] | 327 | $result['errors']['passwd_new_err'] = lang('_SBG_USER_PASSWORD_CHANGE_REQUIRED_MSG');
|
---|
[602] | 328 | }
|
---|
| 329 | }
|
---|
| 330 |
|
---|
[554] | 331 | if ($input['passwd_new'] != $input['confirm_passwd_new']) {
|
---|
[636] | 332 | $result['errors']['confirm_passwd_new_err'] = lang('_SBG_PASSWORD_CONFIRM_MSG');
|
---|
[508] | 333 | }
|
---|
[554] | 334 |
|
---|
[508] | 335 | if (!isset($result['errors'])) {
|
---|
| 336 | $user = array('username' => $user_info['username'], 'fullname' => null, 'gender' => null, 'email' => null, 'school' => null, 'province' => null, 'password' => $input['passwd_new'], 'oldpass' => $input['passwd']);
|
---|
| 337 | $data = $this->user_model->update_user($src, $token, $user, $us_id);
|
---|
| 338 | parse_str($data);
|
---|
| 339 | switch ($status) {
|
---|
| 340 | case 0:
|
---|
| 341 | $result['success'] = 1;
|
---|
| 342 | break;
|
---|
| 343 | case 6:
|
---|
[636] | 344 | $result['errors']['passwd_old_err'] = lang('_SBG_OLD_PASSWORD_FAIL_MSG');
|
---|
[508] | 345 | break;
|
---|
| 346 | default:
|
---|
| 347 | break;
|
---|
| 348 | }
|
---|
| 349 | }
|
---|
| 350 |
|
---|
| 351 | echo json_encode($result);
|
---|
| 352 | } else {
|
---|
| 353 | redirect('frontend/home');
|
---|
| 354 | }
|
---|
| 355 | }
|
---|
[574] | 356 |
|
---|
| 357 | public function trade_history()
|
---|
| 358 | {
|
---|
| 359 | $this->load->helper('pagging');
|
---|
| 360 | $us_id = $this->uri->segment(4);
|
---|
[698] | 361 |
|
---|
[574] | 362 | $user_info = $this->session->userdata('userInfo');
|
---|
[698] | 363 | $admin_info = $this->session->userdata('adminInfo');
|
---|
| 364 |
|
---|
| 365 | if ($user_info || $admin_info)
|
---|
[574] | 366 | {
|
---|
| 367 | $data['us_id'] = $us_id;
|
---|
| 368 | $data['perpage'] = 10;
|
---|
| 369 | $data['current_page'] = $this->uri->segment(6, 1);
|
---|
| 370 | $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
|
---|
| 371 | $this->load->model('user_model');
|
---|
| 372 | $result = $this->user_model->getPaidlog($data);
|
---|
| 373 | $data['total'] = $this->user_model->countPaiglogs($us_id);
|
---|
| 374 | $data['num_links'] = 2;
|
---|
| 375 | $data['paging_url'] = base_url() . "frontend/user/trade_history/".$us_id."/page/";
|
---|
| 376 | $data['paging'] = pagging($data);
|
---|
| 377 | $paidlogs = array();
|
---|
| 378 | foreach ($result as $paidlog):
|
---|
| 379 | $paidlog['amount'] = number_format($paidlog['amount'], 0);
|
---|
[690] | 380 | $paidlog['paid_time'] = date('d/m/Y H:i:s', strtotime($paidlog['paid_time']));
|
---|
[574] | 381 | array_push($paidlogs, $paidlog);
|
---|
| 382 | endforeach;
|
---|
| 383 | $data['paidlogs'] = $paidlogs;
|
---|
| 384 | echo json_encode($data);
|
---|
| 385 | }else {
|
---|
| 386 | redirect('frontend/home');
|
---|
| 387 | }
|
---|
| 388 | }
|
---|
[642] | 389 |
|
---|
| 390 | public function regis_history()
|
---|
| 391 | {
|
---|
| 392 | $this->load->helper('pagging');
|
---|
| 393 | $us_id = $this->uri->segment(4);
|
---|
| 394 | $this->load->model('user_model');
|
---|
| 395 | $user = $this->user_model->get_user_by_id($us_id);
|
---|
| 396 | $username = $user['cellphone'];
|
---|
| 397 | $user_info = $this->session->userdata('userInfo');
|
---|
[698] | 398 | $admin_info = $this->session->userdata('adminInfo');
|
---|
| 399 | if ($user_info || $admin_info)
|
---|
[642] | 400 | {
|
---|
| 401 | $data['username'] = $username;
|
---|
| 402 | $data['perpage'] = 10;
|
---|
| 403 | $data['current_page'] = $this->uri->segment(6, 1);
|
---|
| 404 | $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
|
---|
| 405 | $this->load->model('user_model');
|
---|
| 406 | $result = $this->user_model->getPackagelog($data);
|
---|
| 407 | $data['total'] = $this->user_model->countPackagelogs($username);
|
---|
| 408 | $data['num_links'] = 2;
|
---|
| 409 | $data['paging_url'] = base_url() . "frontend/user/regis_history/".$us_id."/page/";
|
---|
| 410 | $data['paging'] = pagging($data);
|
---|
| 411 | $packagelogs = array();
|
---|
| 412 | foreach ($result as $packagelog):
|
---|
[643] | 413 | $packagelog['created_time'] = date('d/m/Y H:i:s', strtotime($packagelog['created_time']));
|
---|
[642] | 414 | array_push($packagelogs, $packagelog);
|
---|
| 415 | endforeach;
|
---|
| 416 | $data['packagelogs'] = $packagelogs;
|
---|
| 417 | echo json_encode($data);
|
---|
| 418 | }else
|
---|
| 419 | {
|
---|
| 420 | redirect('frontend/home');
|
---|
| 421 | }
|
---|
| 422 |
|
---|
| 423 | }
|
---|
[508] | 424 |
|
---|
[554] | 425 | }
|
---|