· 5 years ago · Dec 03, 2019, 01:00 PM
1<?php
2
3/**
4 * get profile
5 * @author tala.narestha[at]linkit360.com
6 */
7
8require_once(dirname(__FILE__) . '/../libs/util.php');
9require_once dirname(__FILE__) . '/../libs/ip_in_range.php';
10require_once dirname(__FILE__) . '/../libs/soaAdapter.php';
11require_once dirname(__FILE__) . '/../libs/unirest/Unirest.php';
12
13Class Controllers_Getprofile extends Base_Controller
14{
15 private $saltkey;
16
17 public function __construct() {
18 parent::__construct();
19 }
20
21 public function index()
22 {
23 $starttime = microtime(1);
24 $this->logger->setActiveMsisdn('9999');
25
26 $this->logger->write('debug','PARAM GETPROFILE:'.print_r($_REQUEST,1)."server:".json_encode($_SERVER));
27 $this->logger->write('debug', 'PARAM SERVER: ' . json_encode($_SERVER));
28 // check mandatory
29 $this->checkMandatory('secret_key');
30
31 $application = Libs_Registry::get('application');
32 $this->logger->write('debug', 'GET APPLICATION: ' . print_r($application,1));
33 $this->saltkey = $shareKey = $application['share_key'];
34 $secretKey = $this->input->get_post('secret_key');
35 $lang = $this->input->get_post('lang');
36 $register_token = $this->input->get_post('register_token');
37 $token = $this->input->get_post('token');
38 $keep_signin = $this->input->get_post('keep_signin');
39 $isaxis = $this->input->get_post('isaxis');
40 $appversion = $this->input->get_post('version');
41 if( $lang == false ) $lang = 'id';
42
43 /**
44 * Application version information
45 */
46 $model_autologin = new Models_User;
47 $version = $model_autologin->getVersionFromChannel($application['channel']);
48 $version_array = array('version'=>$version,'userversion'=>$userversion);
49
50 // check mandatory for web/wap
51 if( !$this->_isMobileApplication($application['channel']) )
52 {
53 $this->checkMandatory(array('ref'));
54 $ref = $this->input->get_post('ref');
55 $url = base64_decode($ref);
56 $this->logger->write('info', 'REDIRECT URL: ' . $url);
57 $sign = (strpos($url, '?') === false) ? '?':'&';
58 }
59 else if( $this->_isMobileApplication($application['channel']) )
60 {
61 $user_model = new Models_User;
62 $getChannelID = $user_model->channel_by_secretkey($secretKey);
63 $this->logger->write('debug','RESULT VERSION CHANNEL id ' . json_encode($getChannelID));
64 $appVersion = $this->input->get_post('version');
65 $getNewVersion = $user_model->new_version($getChannelID, $lang);
66 $this->logger->write('debug','NEW VERSION! ' . json_encode($getNewVersion));
67 $v1 = (int)str_replace(".","",$appVersion);
68 $v2 = (int)str_replace(".","",$getNewVersion['version']);
69 $url_download = $getNewVersion['url'];
70 $mandatory = ($getNewVersion['mandatory']=='1')?'220':'221';
71
72 if($v1 == 0) $v1 = $v2;
73
74 if($v1 < $v2)
75 {
76 $resultVersion = array('version'=>$getNewVersion['version'], 'code'=>$mandatory, 'message'=>$getNewVersion['notification_'.$lang],'btnpos'=>$getNewVersion['btnpos_'.$lang],'btnneg'=>$getNewVersion['btnneg_'.$lang], 'url'=>$url_download);
77 $data = array();
78 $data['new_version'] = $resultVersion;
79 #$this->apiResponseSuccess($data);
80 }
81 else
82 {
83 $resultVersion = array();
84 }
85
86 }
87
88
89 // for custom login page purpose
90 $loginRef = $this->input->get_post('login_ref');
91
92 if( $loginRef ){
93 $loginRef = base64_decode($loginRef);
94 }
95
96 /**
97 * Header enrichment detection
98 */
99
100 // $header = '6283891471556';//false;
101 //$header = false;
102
103 // CHECK UPPER CASE OR LOWER CASE
104 if(isset($_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN']) && $_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN']!='')
105 {
106 $header = $_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN'];
107 }
108
109 // Check for IMEI
110 if( !isset($_SERVER['HTTP_USER_IDENTITY_FORWARD_IMEISV']) )
111 {
112 $header = false;
113 }
114 else
115 {
116 if( strlen($_SERVER['HTTP_USER_IDENTITY_FORWARD_IMEISV'])<10 )
117 {
118 $header = false;
119 }
120 $imei = $_SERVER['HTTP_USER_IDENTITY_FORWARD_IMEISV'];
121 }
122
123 if ($_SERVER['REMOTE_ADDR'])
124 {
125 $remote_addr = trim($_SERVER['REMOTE_ADDR']);
126 if( strpos($remote_addr, ',') !== false )
127 {
128 $arr_remote_addr = explode(',', $remote_addr);
129 $remote_addr = trim($arr_remote_addr[count($arr_remote_addr)-1]);
130 $fake_remote_addr = $arr_remote_addr[0];
131 }
132 }
133
134 if ($_SERVER['HTTP_X_FORWARDED_FOR'])
135 {
136 $fwd_for = trim($_SERVER['HTTP_X_FORWARDED_FOR']);
137 if( strpos($fwd_for, ',') !== false )
138 {
139 $arr_fwd_for = explode(',', $fwd_for);
140 $fwd_for = trim($arr_fwd_for[count($arr_fwd_for)-1]);
141 $fake_fwd_for = $arr_fwd_for[0];
142 }
143 }
144
145 if (check_ip($remote_addr) || check_ip($fwd_for))
146 {
147 if ($header !== false)
148 {
149 $msisdn = trim($header);
150 if( strpos($msisdn, ',') !== false )
151 {
152 $arr_msisdn = explode(',', $msisdn);
153 $header = trim($arr_msisdn[count($arr_msisdn)-1]);
154 $fake_msisdn = $arr_msisdn[0];
155 //$header = $fake_msisdn;
156 }
157 }
158 }
159 else
160 {
161 $header = false;
162 }
163
164
165 // $header = '6283891471556';//bypass
166 $this->logger->write('debug', 'CHECKING IMEI: ' . $imei);
167
168 /*START KEEPSIGNIN*/
169 $session_cek = new Models_Session;
170 $tokenStatus = $session_cek->isValidToken($token);
171 $this->logger->write('debug', 'KEEPSIGNINTOKEN: ' . $keep_signin.' ISVALIDTOKEN '.$token.'='.$tokenStatus);
172 $keepsignin = "0";
173 error_log('KEEPSIGNINTOKEN: ' . $keep_signin.' ISVALIDTOKEN '.$token.'='.$tokenStatus,3,'/home/xl/tmp/logdebug.log');
174 // $this->logger->write('debug', 'TOKENSTATUS ' . $tokenStatus.);
175// if($keep_signin=='1' && $tokenStatus!='expired')
176 if ($keep_signin == '1' || $tokenStatus == 'expired')
177 {
178 $keepsignin = "1";
179 $session_cek->updateSessionExpired($token);
180 $header = $tokenStatus;
181 $this->logger->write('debug', 'SESSION_EXPIRED_UPDATE ' . $msisdn.' TOKEN '.$token);
182 #$soa = new Libs_SoaAdapter;
183 if($application['name']=='Web')
184 {
185 if($isaxis=="1")
186 {
187 $sms = $this->config->get('messageKeepSigninAxis');
188 }
189 else
190 {
191 $sms = $this->config->get('messageKeepSignin');
192 }
193 # $soa->sms_soa($header,$sms);
194 }
195 }
196
197 /*END KEEPSIGNIN*/
198 //$header = '6281958424204';
199 //$this->logger->write('info', 'CEK IP: '.$remore_addr);
200
201 list($satu,$dua) = split(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
202
203 //error_log($satu .'xxx' . $dua,3,'/tmp/a.log');
204 error_log(date('Y-m-d H:i:s') .' IP : ' . $satu .' USER_AGENT : '. $_SERVER['HTTP_USER_AGENT'] . ' MSISDN_HEADER : '.$msisdn."\n",3, '/home/xl/log/newaxisnet/sso/msisdn_forward-'.date('Ymd'));
205
206 $msisdn = trim($header);
207
208 #$checknum = $this->_decrypt($shareKey, n'));
209 $checknum = $this->input->normalizeMsisdn($msisdn);
210
211 // /*
212 if ($this->isValidAxis($checknum))
213 {
214 //
215 }
216 else
217 {
218 $this->apiResponseFailed(201, 'No. Axis atau password yang kamu masukan salah',$data);
219 }
220
221
222 $user_model = new Models_User;
223
224 // added by debut 2015/03/11
225 $status_myxldb_a = $user_model->isMsisdnExists_type($msisdn);
226 $this->logger->write('debug', 'CHECKING REGISTER TOKEN: '. @$status_myxldb_a['autologin']);
227 $status_myxldb = @$status_myxldb_a['msisdn_type'];
228 $status_regtosoa = @$status_myxldb_a['autologin'];
229 //HANDLE AUTO REG IF STILL NOT SUCCESS
230
231 if($status_regtosoa=='0')
232 {
233 /*$soa = new Libs_SoaAdapter;
234
235 $resultAuto = $soa->sso_autoregister($msisdn);
236 $this->logger->write('debug', 'RESULT RE SSOAUTOREGISTER:'. print_r($resultAuto,1));
237 if( $resultAuto['code'] != '00' ){
238 $data_status = '0'; //if reg to soa failed
239 }else{
240 $data_status = '1'; //if reg to soa failed
241 }
242 //*/
243 $result = $user_model->reautoregister($data_status, $msisdn);
244 $this->logger->write('debug','AUTO RE REGISTER MSISDN! ' . print_r($result,1));
245 }
246
247
248 $register_token_exist = $status_myxldb_a['register_token'];
249 if($register_token != $register_token_exist && !empty($register_token)){
250 $user_model->update_token($register_token, $msisdn);
251 }
252
253 $soa = new Libs_SoaAdapter;
254
255 $autologin = '1';
256
257 // if have msisdn from $_SERVER
258 if( $header !== false )
259 {
260 $this->logger->write('debug', 'CHECKING HEADER: ' . $header);
261
262 // check header for injected msisdn
263 if( strpos($header, ',') !== false )
264 {
265 $sandbox = explode(',', $header);
266 $msisdn = $sandbox[count($sandbox)-1];
267 }
268 else
269 {
270 $msisdn = $header;
271 }
272
273 // check whitelist prefix
274 if( !in_array(substr($msisdn,0,5), $this->config->get('prefixWhitelist')) )
275 {
276 $this->logger->write('info', 'PREFIX BLACKLISTED');
277 if($keep_signin!='1')
278 {
279 if( $this->_isMobileApplication($application['channel']) )
280 {
281 $this->logger->write('info', 'MOBILE APPLICATION RESPONSE');
282 $this->apiResponseFailed(208, 'Please sign-in first', $version_array);
283 }
284 else
285 {
286 $this->logger->write('info', 'WEB/WAP RESPONSE 8');
287 header('location:' . $url . $sign . 'o='.$this->_enc_return('token=notexists'));
288 exit;
289 }
290 }
291 }
292
293 $this->logger->setActiveMsisdn($msisdn);
294 $this->logger->write('info','GETPROFILE');
295 $this->logger->write('debug','MSISDN DETECTED: ' . $msisdn);
296
297 // load device info
298 /*
299 if( !$this->_isMobileApplication($application['channel']) ){
300 $startwurfl = microtime(1);
301 $tera = new Libs_Terawurfl;
302 //$isMobile = $tera->getDeviceCapability('is_wireless_device');
303 $brand = $model = $hasil = '';
304 if($isMobile){
305 $imei = $_SERVER['HTTP_USER_IDENTITY_FORWARD_IMEISV'];
306 // error_log("\nDEBUT".json_encode($imei)."\n",3,'/tmp/soar');
307 $hasil = $user_model->cekBrandModel($imei);
308 }
309 else{
310 $hasil = 'browser';
311 }
312 //
313
314 //$this->logger->write('DEBUG','DEBUT:'.$hasil);
315 // $this->logger->write('DEBUG','DEVICE DETECTION PROCESS by IMEI:'.substr(microtime(1) - $startwurfl,0,6));
316 }
317 */
318
319 $hasil = 'browser';
320 // load terawurfl
321 $brand = $model = $browser = $marketingname = '';
322 /*
323 if( !$this->_isMobileApplication($application['channel']) ){
324 $startwurfl = microtime(1);
325 $tera = new Libs_Terawurfl;
326 $isMobile = $tera->getDeviceCapability('is_wireless_device');
327 $brand = $model = $browser = '';
328 if($isMobile){
329 $brand = $tera->getDeviceCapability('brand_name');
330 //$brand = 'XL';
331 //error_log("\nUMAR".json_encode($brand)."\n",3,'/tmp/soar');
332 $model = $tera->getDeviceCapability('model_name');
333 //$model = 'XL Model';
334 $marketingname = $tera->getDeviceCapability('marketing_name');
335 }
336 else{
337 $bc = new libs_browscap_loader;
338 $brand = $bc->getCapabilities('Browser');
339 $model = $bc->getCapabilities('Version');
340 $browser= $brand . ' ' . $model;
341 }
342 $this->logger->write('DEBUG','DEBUT:'.$brand.' '.$model);
343 $this->logger->write('DEBUG','DEVICE DETECTION PROCESS:'.substr(microtime(1) - $startwurfl,0,6));
344 }
345 */
346 // BB10
347 //if(isset($_SERVER['USER_AGENT'])){
348 // if(stripos($_SERVER['USER_AGENT'],'BB10') !==false ){
349 // $brand = 'BlackBerry';
350 // $model = 'Z10';
351 // }
352 //}
353
354 $http_brand = $this->input->get_post('brand');
355 $http_model = $this->input->get_post('model');
356 if($http_brand != false) $brand = $http_brand;
357 if($http_model != false) $model = $http_model;
358
359 // normalize msisdn
360 $msisdn = $this->input->normalizeMsisdn($msisdn);
361 $balance = $soa->balance($msisdn, rand(100,99999), $imei, 1);
362 $this->logger->write('debug','QUERY-BALANCE: xx'. $balance['code'] .'xx'. print_r($balance,1));
363 $msisdn_type = 1;
364
365 if( $balance['code'] == '00' )
366 {
367 $msisdn_type = ($balance['data']['SubscriberType']=='Prepaid') ? 1 : 2;
368 if( $application['user_type'] == 'SUBSCRIBER' )
369 {
370 $user_model = new Models_User;
371 $userId = $user_model->isMsisdnExists($msisdn);
372 $this->logger->write('info', 'CEK DATABASE ' .$msisdn.' '. $userId);
373 // get group id by group name
374 //$group_model = new Models_Groups;
375 //$groupId = $group_model->getIdByName('SUBSCRIBER');
376 $groupId = 2;
377 $this->logger->write('info', 'GROUP NAME: SUBSCRIBER, GROUP ID' . $groupId);
378 // check if msisdn already register
379 if( $userId === false )
380 {
381 $this->logger->write('info','MSISDN NOT REGISTERED!');
382 //if( $result['code'] == '00' ){
383 $user = new Data_User;
384 $user->name = $msisdn;
385 $user->fullname = $msisdn;
386 $user->address = '';
387 $user->place_birth = '';
388 $user->birth = '';
389 $user->gender = '';
390 $user->msisdn = $msisdn;
391 $user->password = 'null';
392 $user->is_mobile = $isMobile;
393 $user->email = '';
394 $user->other_phone = '';
395 $user->brand = $brand;
396 $user->model = $model;
397 $user->browser = $browser;
398 $user->language = 'id';
399 #$user->userversion = $userversion;
400 //$user->autologin = '1';
401
402
403
404 $user->location = $user->regional = 'Jakarta';
405
406 $user->msisdn_type = $msisdn_type;
407 //echo $msisdn_type; die();
408
409 $soa = new Libs_SoaAdapter;
410 $this->logger->write('debug', 'INI SOA:'.$msisdn. print_r($soa,1));
411 $resultAuto['code'] = '00';#$soa->sso_autoregister($msisdn);
412 $this->logger->write('debug', 'RESULT SSOAUTOREGISTER:'. print_r($resultAuto,1));
413
414 if( $resultAuto['code'] != '00' )
415 {
416 $user->autologin = '0'; //if reg to soa failed
417 }else
418 {
419 $user->autologin = '1'; //if reg to soa failed
420 }
421
422 if(trim($resultAuto['message']) == 'ALREADY_EXIST')
423 {
424 //no password update
425 }
426 else
427 {
428 $newpass = substr($resultAuto['message'],20,6);
429 $user->password = $newpass;
430 }
431
432 $result = $user_model->autoregister('SUBSCRIBER', $user, $groupId);
433 $this->logger->write('debug','AUTO REGISTER MSISDN! ' . print_r($result,1));
434
435 }
436 else
437 {
438 $balance = 'null';
439 }
440
441 //START PUSH NOTIF
442 $message = (!empty($resultAuto['message']))?$resultAuto['message']:"AXIS message";
443 $page_id = "1";
444
445 $status_myxldb_a = $user_model->isMsisdnExists_type($msisdn);
446
447 $this->logger->write('debug', 'CHECKING REGISTER TOKEN: ' .$register_token."xxxxxxxxx". $status_myxldb_a['register_token']);
448 $register_token_exist = $status_myxldb_a['register_token'];
449
450 if($register_token != $register_token_exist && !empty($register_token)){
451 $user_model->update_token($register_token, $msisdn);
452 }
453
454 $chn_android = '8a1d5a0678e140ac';# 'be44e2f43224142e';
455 $chn_ios = 'da41087acd2a480f';#'796eda0f978ceac4';
456
457 $this->logger->write('debug', 'REGISTER_TOKEN CHANNEL: '. $resultAuto['code'].' ' .$chn.' '. $register_token);
458 if( $resultAuto['code'] == '00' )
459 {
460 if($secretKey==$chn_android)
461 {
462 $this->android_push($register_token, $message, $msisdn, $page_id);
463 }
464
465 if($secretKey==$chn_ios)
466 {
467 $this->apple_push($register_token, $message, $msisdn, $page_id);
468 }
469 }
470 //END PUSH NOTIF
471
472 $user = $user_model->getByIdentity($application['user_type'],$msisdn);
473
474 if( !isset($user['id']) )
475 {
476 if( $this->_isMobileApplication($application['channel']) )
477 {
478 $this->logger->write('info','MOBILE APPLICATION RESPONSE');
479 $this->apiResponseFailed(224,'Cannot find user profile!',$version_array);
480 }
481 else
482 {
483 $this->logger->write('info', 'WEB/WAP RESPONSE 4');
484 header('location:' . $url . $sign . 'o='. $this->_enc_return('token=notexists'));
485 exit;
486 }
487 }
488
489 }
490 else
491 {
492 $this->logger->write('debug','MSISDN REGISTERED!');
493
494 // check account if activate
495 // if no redirect to confirm password page
496 $user = $user_model->getByIdentity($application['user_type'],$msisdn);
497
498 if( !isset($user['id']) )
499 {
500 if( $this->_isMobileApplication($application['channel']) )
501 {
502 $this->logger->write('info', 'MOBILE APPLICATION RESPONSE');
503 $this->apiResponseFailed(224,'Cannot find user profile!', $version_array);
504 }
505 else
506 {
507 $this->logger->write('info', 'WEB/WAP RESPONSE 4');
508 header('location:' . $url . $sign . 'o='. $this->_enc_return('token=notexists'));
509 exit;
510 }
511 }
512
513
514
515 // get balance
516 $xboxmenu = $xboxhotoffer = '';
517 //if( $user['msisdn_type']==0 ){
518 $balance = $soa->balance($msisdn, rand(100,99999), $imei, 1);
519 $this->logger->write('debug','QUERY-BALANCE:--'.$balance['code'].'--' . print_r($balance,1));
520 $msisdn_type = 1;
521 if( $balance['code'] == '00' ){
522 $msisdn_type = ($balance['data']['SubscriberType']=='Prepaid') ? 1 : 2;
523 $xbox = $soa->xbox(
524 $identity,
525 $balance['data']['SubscriberType'],
526 $balance['data']['HomePOCInformation'],
527 $balance['data']['PricePlan'],
528 $balance['data']['ActiveEndDate'],
529 $balance['data']['GraceEndDate'],
530 $balance['data']['BalanceValue'],
531 $balance['data']['SubscriberID'],
532 $imei
533 );
534 if( $xbox['code'] == '00'){
535 $xboxmenu = $xbox['data']['Menu_ID'];
536 $xboxhotoffer = $xbox['data']['HotOfferID'];
537 }
538 }
539 else{
540 $balance = 'null';
541 }
542
543 }
544
545 // auto sign in
546 $session_model = new Models_Session;
547 $useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT']:'';
548
549 // object session
550 $session = new Data_Session;
551 $session->application_id = $application['id'];
552 $session->application_name = $application['name'];
553 $session->identity = $msisdn;
554 $session->group_id = $groupId;
555 $session->channel_id = $application['channel_id'];
556 $session->channel = $application['channel'];
557 $session->is_mobile = $isMobile;
558 $session->brand = $brand;
559 $session->model = $model;
560 $session->browser = $browser;
561 $session->user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : '';
562 $session->msisdn_type = $msisdn_type;
563 $session->imei = $imei;
564 $session->xbox_package = $xboxmenu;
565 $session->xbox_hotoffer = $xboxhotoffer;
566 $session->query_balance = $balance;
567 $session->keep_signin = $keepsignin;
568# $session->userversion = $userversion;
569
570 // added by Debut 2015/03/11
571 if ($msisdn_type != $status_myxldb && $balance['code']=='00') {
572 $user_model = new Models_User;
573 $user_model->isMsisdnType_update($msisdn,$msisdn_type);
574 }
575 //error_log("DEBUT".print_r($msisdn_type,1),3,'/var/log/yum.log');
576
577 if(isset($_SERVER['SERVER_ADDR'])){
578 if( strpos($_SERVER['SERVER_ADDR'], ',') !== false ){
579 $sandbox = explode(',', $_SERVER['SERVER_ADDR']);
580 $ip = ip2long($sandbox[count($sandbox)-1]);
581 }
582 else{
583 $ip = ip2long($_SERVER['SERVER_ADDR']);
584 }
585 }
586 else{
587 $ip = '';
588 }
589 $session->ip = $ip;
590 $session->onnet = '1';
591 $msisdnAutologin = $header;//$_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN'];
592 $prefix = (substr($msisdnAutologin,0,1)=='0')?'62'.substr($msisdnAutologin,1,3):substr($msisdnAutologin,0,5);
593 $model_logo = new Models_Logo;
594 //$identity = $_SERVER['HTTP_USER_IDENTITY_FORWARD_MSISDN'];
595 //$isAxis = $this->isAxisNumber($identity);
596 $operator1 = 'AXIS';
597
598 $arrSize = ($_REQUEST['size'])?$_REQUEST['size']:array();
599 //$version = ($_REQUEST['version'])?$_REQUEST['version']:1;
600 $dataLogo = $model_logo->getLogo($operator1, $arrSize);
601
602 $arrUrl = array();
603 foreach($dataLogo as $key=>$logo){
604 $arrUrl[][$logo['size']] = array('url'=>$logo['url'], 'version'=>$logo['version']);
605 }
606
607
608 $msisdn = $msisdnAutologin;
609 $prefix = (substr($msisdn,0,1)=='0')?'62'.substr($msisdn,1,3):substr($msisdn,0,5);
610 $model_theme = new Models_Theme;
611 $css_color = $model_theme->getColor($prefix);
612
613 $arrColor = array();
614 if(!empty($css_color)){
615 foreach($css_color as $key=>$list){
616 $arrColor[$list['title']] = (string)$list['color'];
617 }
618 }
619 //$this->logger->write('debug', 'CSS_COLOR:'.print_r($arrColor,1));
620 $session_model = new Models_Session;
621 $token = $session_model->create($application['user_type'], $session);
622 //$_SESSION[strtolower($application['user_type'])]['token'] = $token;
623 // get device info
624 $tac = $device = '';
625 if($marketingname != ''){
626 $device = $marketingname;
627 }else{
628 $device = 'Generic Device';
629 }
630
631 //echo json_encode($user); exit;
632
633 if( $this->_isMobileApplication($application['channel']) ){
634 $getChannelID = $user_model->channel_by_secretkey($secretKey);
635 $this->logger->write('debug','RESULT VERSION CHANNEL id ' . json_encode($getChannelID));
636 $appVersion = $this->input->get_post('version');
637 $getNewVersion = $user_model->new_version($getChannelID, $lang);
638 $this->logger->write('debug','NEW VERSION! ' . json_encode($getNewVersion));
639 $v1 = (int)str_replace(".","",$appVersion);
640 $v2 = (int)str_replace(".","",$getNewVersion['version']);
641 $url_download = $getNewVersion['url'];
642 $mandatory = ($getNewVersion['mandatory']=='1')?'220':'221';
643
644 # if($v1 < $v2){
645 # $resultVersion = array('version'=>$getNewVersion['version'], 'code'=>$mandatory, 'message'=>$getNewVersion['notification_'.$lang],'btnpos'=>$getNewVersion['btnpos_'.$lang],'btnneg'=>$getNewVersion['btnneg_'.$lang], 'url'=>$url_download);
646 # }else{
647 # $resultVersion = array();
648 # }
649
650 $this->logger->write('info', 'MOBILE APPLICATION RESPONSE');
651 $data = (array) $user;
652 $arrXbox = explode(',',$session->xbox_package);
653
654 //HOME POSITION
655 $result_position = $this->home_position();
656 //END HOME POSITION
657 //$data['fourg_powerpack'] = $arr4gpower_pack;
658 //END 4GPOWERPACK
659
660 //if( isset($data['fullname']) ) unset($data['fullname']);
661 //$data['full_name'] = '';
662 $data['token'] = $token;
663 $data['msisdn'] = $this->input->encrypt($shareKey, $msisdn);
664 $data['version'] = $version_array;
665 $data['autologin'] = $autologin;
666 $data['fb_link'] = 0;
667 $data['device'] = $device;
668 $data['imei'] = $imei;
669 $data['tac'] = $tac;
670 $data['place_birth'] = $user['place_birth'];
671 $data['other_phone'] = $user['other_phone'];
672 $data['idcard_number'] = $user['idcard_number'];
673 $data['idcard_type'] = $user['idcard_type'];
674 /* added for re-registration by amir */
675 $data['mothers_name'] = $this->get_starred_first($user['mothers_name']);
676 //$data['card_type'] = $user['card_type'];
677 $data['nik_number'] = $this->get_starred_last($user['idcard_number']);
678 $data['kk_number'] = $this->get_starred_last($user['kk_number']);
679 $data['validated'] = $user['validated'];
680/////== ADD for check Reregistration [[[
681 if ($user['validated'] == '0'){ // Mengecek kembali ke Dukcapil
682 $isvalidate = $this->get_statusreg($msisdn);
683 if($isvalidate->headerRs->responseCode == "00"){
684 if($isvalidate->status == 'VALID'){
685 $stars = '****************';
686 $data['validated'] = '1';
687 $data['nik_number'] = $stars;
688 $data['kk_number'] = $stars;
689 $this->update_validated_nik_kk($msisdn,$stars);
690 }
691 }
692 }
693/////== ADD for check Reregistration ]]]
694 /*end re-registration */
695 $data['subscriber_type']= isset($balance['data']['SubscriberType']) ? $balance['data']['SubscriberType'] : '';
696 $data['balance_value'] = isset($balance['data']['BalanceValue']) ? $balance['data']['BalanceValue'] : '';
697 $data['active_end_date']= isset($balance['data']['ActiveEndDate']) ? $balance['data']['ActiveEndDate'] : '';
698 $data['grace_end_date'] = isset($balance['data']['GraceEndDate']) ? $balance['data']['GraceEndDate'] : '';
699 $data['logo'] = $arrUrl;
700 $data['operator'] = $operator1;
701 $data['theme'] = $arrColor;
702 $data['new_version'] = $resultVersion;
703 $data['home_position']= $result_position;
704 $stylePersonal = $this->_style_home_personal($lang);
705 $data['style_personal'] = $stylePersonal;
706 $styleFeaturemenu = $this->_style_home_featuremenu($lang);
707 $data['style_featuremenu']= $styleFeaturemenu;
708
709 #$data['flag_xvaganza'] = '1';//$flagXvaganza;
710 $data['wording_page_login'] = $this->config->get('wording_pagelogin');
711 #if($flagXvaganza=='1') $data['wording_raffleBonus'] = $this->config->get('wording_raffleBonus');
712 $data['menu_home']= $this->_menu_home($msisdn_type, $operator1, $lang);
713 $data['fourg_powerpack'] = array();
714 //$data['idcard_type'] = $user['idcard_type'];
715 //$data['idcard_number'] = $user['idcard_number'];
716//error_log("\nSigninv2".json_encode($data),3,'/tmp/umar.log');
717
718 $data['wording_red_box'] = 'Sesuai dengan keputusan pemerintah tentang data kependudukan, maka pengguna operator seluler wajib mencantumkan nomor KTP atau NIK (Nomor Induk Kependudukan)';
719 $data['url_red_box'] = 'https://www.axisnet.id/registrasi#main';
720
721 $this->logger->write('info', 'REDBOX: '.$user['wording_red_box'].'|'.$user['url_red-box']);
722
723 //echo json_encode($user); exit;
724
725 $this->apiResponseSuccess($data);
726 }
727 else{
728 $arrXbox = explode(',',$session->xbox_package);
729 $arr4gpower_pack = $this->_4gpowerpack($arrXbox,$lang);
730 $data['fourg_powerpack'] = "0";
731 //$data['menu_home']= $this->_menu_home($msisdn_type, $operator1, $lang);
732 //$flagXvaganza = (in_array($this->config->get('xvaganzaXbox'),$arrXbox))?'1':'0';
733 $result_position = $this->home_position();
734
735 $model_fourg = new Models_Fourgpower;
736 $resultGet = $model_fourg->fourgIcon($lang);
737 $style = $model_fourg->fourgStyle($lang);
738 $model= new Models_Homestyle;
739 $result1 = $model->styleHomev2();
740 $result = $model->styleFeaturemenu($lang);
741 $this->logger->write('info', 'WEB/WAP RESPONSE');
742 $wording = json_encode($this->config->get('wording_pagelogin'));
743 $redirectTo = $url . $sign .'o='. $this->_enc_return(
744 'token=' . $token .
745 '&msisdn=' . $this->input->encrypt($shareKey, $msisdn) .
746 '&lang=' . $user->language .
747 '&a=1&t='.$msisdn_type.
748 '&s='.$user['status'].
749 '&logo='.$dataLogo[0]['url'].
750 '&home_image='.$dataLogo[0]['homescreen'].
751 '&operator='.$operator1.
752 '&prefix='.$prefix.
753 '&z='.$_REQUEST['z'].
754 '&wording_page_login='.$wording.
755 '&device='.$hasil.
756
757 '&isDevice4g='.$arr4gpower_pack['isDevice4g'].
758 '&isSimcard4g='.$arr4gpower_pack['isSimcard4g'].
759 '&fourg_powerpack='.$data['fourg_powerpack'].
760 '&personalInformation='.$result_position['personalInformation'].
761 '&herobanner='.$result_position['herobanner'].
762 '&infoQuota='.$result_position['infoQuota'].
763 '&fourgPower='.$result_position['fourgPower']
764
765 );
766 $this->logger->write('info', 'REDIRECT TO: ' . $redirectTo);
767 header('location:' . $redirectTo );
768 exit;
769 }
770 }
771
772 }
773 else{
774 $this->logger->setActiveMsisdn('9999');
775 $this->logger->write('info', 'MSISDN NOT FOUND IN HEADER. SERVER:'.print_r($_SERVER,1));
776 if( $this->_isMobileApplication($application['channel']) ) {
777 $this->logger->write('info', 'MOBILE APPLICATION RESPONSE');
778 $version_array['wording_page_login']= $this->config->get('wording_pagelogin');
779 $this->apiResponseFailed(208, 'Please sign-in first', $version_array); // edited by K-SAN
780 }
781 else{
782 $this->logger->write('info', 'WEB/WAP RESPONSE 8');
783 header('location:' . $url . $sign . 'o='.$this->_enc_return('token=notexists&imei='.$imei.'&wording_page_login='. json_encode($this->config->get('wording_pagelogin'))));
784 exit;
785 }
786
787 }
788 }
789
790 public function home_position(){
791 $user_model = new Models_User;
792 $result = $user_model->home_position();
793 $arr = array();
794 foreach($result as $list){
795 if($list['id']==1){
796 $name = "personalInformation";
797 }
798
799 if($list['id']==2){
800 $name = "herobanner";
801 }
802
803 if($list['id']==3){
804 $name = "infoQuota";
805 }
806 if($list['id']==4){
807 $name = "fourgPower";
808 }
809
810 $arr[$name] = $list['position'];
811 }
812 return $arr;
813 }
814
815
816 public function isValidAxis($number) {
817 ## $pattern = '/^6283[1238][0-9]{6,8}$/';
818 $pattern = '/^628(31|32|33|38|59)[0-9]{6,10}$/';
819 return (bool) preg_match($pattern, $number);
820 }
821
822 private function _enc_return($param) {
823 return util::encrypt($this->saltkey, util::encrypt($this->saltkey, $param) );
824 }
825 public function theme($data){
826//error_log('api theme',3,'/var/log/debug.log');
827 $prefix = $this->input->get_post('prefix');
828# if($prefix=='62838' || $prefix=='62831' || $prefix=='62832'){
829 $operator1 = 'AXIS';
830# }else{
831# $operator1 = 'XL';
832# }
833
834 $model_theme = new Models_Theme;
835 $css_color = $model_theme->getColor($prefix);
836
837 $arrColor = array();
838 if(!empty($css_color)){
839 foreach($css_color as $key=>$list){
840 $arrColor[$list['title']] = (string)$list['color'];
841 }
842 }
843
844 $data = array();
845 $data['theme'] = $arrColor;
846 $this->apiResponseSuccess($data);
847 }
848 public function android_push($register_token, $message, $msisdn, $page_id){
849 $message = (!empty($message))?$message:'myxl message';
850 $msg = array("message"=>$message, "msisdn"=>$msisdn , "page_id"=>$page_id,"type"=>"auto_register");
851 $headers = array (
852 'Authorization: key=AIzaSyBtvC5Q-uLGsRWivOc6-_I3UfVv1YcSh-s',
853 'Content-Type: application/json'
854 );
855 $data = array (
856 'registration_ids' => array($register_token),
857 'data' => array( "data" => $msg),
858
859 );
860 $curlpost = json_encode($data);
861
862 $ch = curl_init ();
863 curl_setopt ( $ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send");
864 curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers );
865 curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true);
866 curl_setopt ( $ch, CURLOPT_POSTFIELDS, $curlpost );
867
868 //$payload = {aps:{alert:'My first push notification!',badge:1,sound:'default'},page_id:1};
869 curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
870 curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false );
871 curl_setopt ( $ch, CURLOPT_POST, true );
872 curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
873
874 $responseString = curl_exec ( $ch );
875 echo 'PUSH ANDROID:'.$msisdn.' '. $responseString;
876 $this->logger->write('debug', 'PUSH ANDROID:'.$msisdn.' '. $responseString);
877 }
878
879 public function apple_push($register_token, $message, $msisdn, $page_id){
880
881 $deviceToken = "8e6535d7b6fbbaddf545aab39150442aec5976352689db14a02b59502dec8f22";
882
883 $deviceToken = (empty($register_token))?$deviceToken:$register_token;
884 // Put your private key's passphrase here:
885 $passphrase = 'linkit360';
886
887 // Put your alert message here:
888 //$message = 'testing';
889
890
891 $ctx = stream_context_create();
892 #dev MyXLAPNSDev.pem
893 stream_context_set_option($ctx, 'ssl', 'local_cert', '/home/xl/newaxisnet/sso/controllers/MyXLAPNSDev.pem');
894 #prod myxl_prod.pem');
895 stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
896
897 // Open a connection to the APNS server
898 $fp = stream_socket_client(
899 'ssl://17.110.227.100:2195', $err,
900 $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
901
902 if (!$fp)
903 echo ("Failed to connect: $err $errstr" . PHP_EOL);
904 $this->logger->write('debug', "APPLE PUSH Failed to connect: $err $errstr" . PHP_EOL);
905 //echo 'Connected to APNS' . PHP_EOL;
906
907 $body= array(
908 'aps' => array(
909 'alert' => $message,
910 'badge' => 1,
911 'sound' => 'default'
912 ),
913 'page_id' => '1',
914 'type'=>'auto_register'
915 );
916
917 // Encode the payload as JSON
918 $payload = json_encode($body);
919
920 //echo $payload;
921
922 // Build the binary notification
923 $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
924 $result = fwrite($fp, $msg, strlen($msg));
925
926 if (!$result){
927 echo 'APPLE PUSH Message not delivered' . PHP_EOL;
928 $this->logger->write('debug', 'APPLE PUSH Message not delivered' . PHP_EOL);
929 }else{
930 echo 'APPLE PUSH Message successfully delivered' . PHP_EOL;
931 $this->logger->write('debug', 'APPLE PUSH Message successfully delivered' . PHP_EOL);
932 }
933 // Close the connection to the server
934 fclose($fp);
935
936
937 }
938
939 public function _4gpowerpack($arrXbox=array(), $lang=''){
940 //START 4GPOWERPACK
941 $xbox4g_device = (in_array($this->config->get('xbox4g_device'),$arrXbox))?'1':'0';
942 $xbox4g_simcard = (in_array($this->config->get('xbox4g_simcard'),$arrXbox))?'1':'0';
943 $model_fourg = new Models_Fourgpower;
944 /*$params4g['msisdn']=$identity;
945 $params4g['device']=$xbox4g_device;
946 $params4g['simcard'] = $xbox4g_simcard;
947 $resultGet = $model_fourg->getData($params4g);
948 if(empty($resultGet)){
949 $model_fourg->saveData($params4g);
950 }else{
951 $model_fourg->updateData($params4g);
952 }
953 */
954 $resultIcon = $model_fourg->fourgIcon($lang);
955 $style = $model_fourg->fourgStyle($lang);
956 $arr4gpower_pack = array(
957 'isDevice4g'=>$xbox4g_device,
958 'isSimcard4g'=>$xbox4g_simcard,
959 'deviceIconReadyId'=>$resultIcon['device_ready_id'],
960 'deviceIconReadyEn'=>$resultIcon['device_ready_en'],
961 'deviceIconNotreadyId'=>$resultIcon['device_notready_id'],
962 'deviceIconNotreadyEn'=>$resultIcon['device_notready_en'],
963 'simcardReadyId'=>$resultIcon['simcard_ready_id'],
964 'simcardReadyEn'=>$resultIcon['simcard_ready_en'],
965 'simcardNotreadyId'=>$resultIcon['simcard_notready_id'],
966 'simcardNotreadyEn'=>$resultIcon['simcard_notready_en'],
967 'packageReadyId'=>$resultIcon['package_ready_id'],
968 'packageReadyEn'=>$resultIcon['package_ready_en'],
969 'packageNotreadyId'=>$resultIcon['package_notready_id'],
970 'packageNotreadyEn'=>$resultIcon['package_notready_en'],
971 'desc_id'=>$style['desc_id'],
972 'desc_en'=>$style['desc_en'],
973 'desc_font_type'=>$style['desc_font_type'],
974 'desc_font_color'=>$style['desc_font_color'],
975 'desc_font_size'=>$style['desc_font_size'],
976 'desc_bg_color'=>$style['desc_bg_color'],
977 'btn_wording_id'=>$style['btn_wording_id'],
978 'btn_wording_en'=>$style['btn_wording_en'],
979 'btn_font_type'=>$style['btn_font_type'],
980 'btn_font_color'=>$style['btn_font_color'],
981 'btn_font_size'=>$style['btn_font_size'],
982 'btn_bg_color'=>$style['btn_bg_color'],
983 'info1_wording_id'=>$style['info1_wording_id'],
984 'info1_wording_en'=>$style['info1_wording_en'],
985 'info1_font_type'=>$style['info1_font_type'],
986 'info1_font_color'=>$style['info1_font_color'],
987 'info1_font_size'=>$style['info1_font_size'],
988 'info1_bg_color'=>$style['info1_bg_color'],
989 'info2_wording_id'=>$style['info2_wording_id'],
990 'info2_wording_en'=>$style['info2_wording_en'],
991 'info2_font_type'=>$style['info2_font_type'],
992 'info2_font_color'=>$style['info2_font_color'],
993 'info2_font_size'=>$style['info2_font_size'],
994 'info2_bg_color'=>$style['info2_bg_color']
995
996 );
997 //$user['fourg_powerpack'] = $arr4gpower_pack;
998 //END 4GPOWERPACK
999 if(empty($lang)){
1000 $data['fourg_powerpack'] = $arr4gpower_pack;
1001 $this->apiResponseSuccess($data);
1002 }else{
1003 return $arr4gpower_pack;
1004 }
1005 }
1006
1007 public function _menu_home($msisdn_type='',$operator='', $lang=''){
1008 $model= new Models_Homestyle;
1009 $reqauto = $this->input->get_post('reqauto');
1010 $result = $model->menu_home($msisdn_type, $operator, $lang);
1011 #error_log("\nMenuHome". $reqauto.' ' .print_r($result,1),3,'/tmp/umar.log');
1012 $arr = array();
1013 foreach($result as $list){
1014 if($list['space_layout_id']==1){
1015 $type = 'personal';
1016 $k= 0;
1017 }else if($list['space_layout_id']==3){
1018 $type = 'quota';
1019 $k=1;
1020 }
1021 $arr[$k][$type][] = array('menu_id'=>$list['menu_id'],
1022 'menu_en'=>$list['menu_en'],
1023 'url_type'=>$list['url_type'],
1024 'href_web'=>$list['href_web'],
1025 'href'=>$list['href_mobile'],
1026 'order'=>$list['order']
1027
1028 );
1029 }
1030 return $arr;
1031
1032 }
1033
1034
1035 public function _menu_homev2(){
1036 #error_log("\nV22222222222222",3,'/tmp/mnu.log');
1037 $model= new Models_Homestyle;
1038 $reqauto = $this->input->get_post('reqauto');
1039
1040 $prefix = $this->input->get_post('prefix');
1041 if($prefix=='62838' || $prefix=='62831' || $prefix=='62832' || $prefix=='62833' || $prefix=='62859'){
1042 $operator = 'AXIS';
1043 }else{
1044 $operator = 'XL';
1045 }
1046 $msisdn_type = $this->input->get_post('msisdn_type');
1047 //$lang = $this->input->get_post('lang');
1048 $result = $model->menu_home($msisdn_type, $operator, $lang);
1049 $arr = array();
1050 foreach($result as $list){
1051 if($list['space_layout_id']==1){
1052 $type = 'personal';
1053 $k= 0;
1054 }else if($list['space_layout_id']==3){
1055 $type = 'quota';
1056 $k=1;
1057 }
1058 $arr[$k][$type][] = array('menu_id'=>$list['menu_id'],
1059 'menu_en'=>$list['menu_en'],
1060 'url_type'=>$list['url_type'],
1061 'href_web'=>$list['href_web'],
1062 'href'=>$list['href_mobile'],
1063 'order'=>$list['order']
1064
1065 );
1066 }
1067 #error_log("\nKKKKHOME langempty". $reqauto. print_r($arr,1),3,'/tmp/mnu.log');
1068 $data['menu_home'] = $arr;
1069 #error_log("\nKKKKHOME langempty". $reqauto. json_encode($data),3,'/tmp/mnu.log');
1070 $this->apiResponseSuccess($data);
1071
1072
1073 }
1074
1075
1076 public function _style_home_personal($lang=''){
1077 $model= new Models_Homestyle;
1078 $result = $model->styleHomev2();
1079 $arr = array(
1080 'name_font_type'=>$result['name_font_type'],
1081 'name_font_size'=>$result['name_font_size'],
1082 'name_font_color'=>$result['name_font_color'],
1083 'name_font_bg_color'=>$result['name_font_bg_color'],
1084 'device_font_type'=>$result['device_font_type'],
1085 'device_font_size'=>$result['device_font_size'],
1086 'device_font_color'=>$result['device_font_color'],
1087 'device_font_bg_color'=>$result['device_font_bg_color'],
1088
1089 'msisdn_font_type'=>$result['msisdn_font_type'],
1090 'msisdn_font_size'=>$result['msisdn_font_size'],
1091 'msisdn_font_color'=>$result['msisdn_font_color'],
1092 'msisdn_font_bg_color'=>$result['msisdn_font_bg_color']
1093 );
1094 if(empty($lang)){
1095 $data['style_personal'] = $arr;
1096 $this->apiResponseSuccess($data);
1097 }else{
1098
1099 return $arr;
1100 }
1101 }
1102
1103 public function _style_home_featuremenu($lang){
1104 $model= new Models_Homestyle;
1105 $result = $model->styleFeaturemenu($lang);
1106 $arr = array(
1107 'personal_font_size'=>$result['personal_font_size'],
1108 'personal_font_type'=>$result['personal_font_type'],
1109 'personal_font_color'=>$result['personal_font_color'],
1110 'personal_font_bg_color'=>$result['personal_font_bg_color'],
1111 'quota_font_size'=>$result['quota_font_size'],
1112 'quota_font_type'=>$result['quota_font_type'],
1113 'quota_font_color'=>$result['quota_font_color'],
1114 'quota_font_bg_color'=>$result['quota_font_bg_color']
1115 );
1116 if(empty($lang)){
1117 $data['style_featuremenu'] = $arr;
1118 $this->apiResponseSuccess($data);
1119 }else{
1120
1121 return $arr;
1122 }
1123
1124 }
1125
1126 private function get_starred_first($str) {
1127 if(strpos($str, " ") !== false)
1128 {
1129 $array = explode(" ", $str);
1130
1131 $len1 = strlen($array[0]);
1132 $len2 = strlen($array[1]);
1133
1134 $result = substr($array[0], 0,1) . str_repeat('*', $len1-1) ." ".substr($array[1], 0,1) . str_repeat('*', $len2-1);
1135 } else {
1136 $len = strlen($str);
1137 $result = substr($str, 0, 2) . str_repeat('*', $len -1) ;//. substr($str, $len - 1, 1);
1138 }
1139
1140 return $result;
1141 }
1142
1143 private function get_starred_last($str) {
1144
1145 $len = strlen($str);
1146 $result = str_repeat('*', $len -1) . substr($str, $len - 3, 3);
1147
1148 return $result;
1149 }
1150
1151 /////== ADD for check Reregistration [[[
1152 public function get_statusreg($msisdn)
1153 {
1154
1155 $url = 'http://10.23.129.4:9003/BusinessServices/cpProvisioningMapperSmartClient/V1_0/opGetRegStatus/';
1156 $headers = array('Accept' => 'application/json');
1157 $params = array(
1158 'opGetRegStatusRq' => array(
1159 'headerRq' => array(
1160 'requestDate' => date('Y-m-d H:i:s'),
1161 'requestId' => $this->unikId(),
1162 'channel' => 'AXISNET'
1163 ),
1164 'msisdn' => $msisdn
1165 )
1166 );
1167
1168 $body = Unirest\Request\Body::json($params);
1169 $response = Unirest\Request::post($url, $headers, json_encode($params));
1170
1171 $this->logger->write('debug-cekregistrasi', 'CEK STATUS REGTRASSI | RESPONSE' . json_encode($response));
1172
1173 return $response->body->opGetRegStatusRs;
1174 }
1175
1176
1177 public function unikId()
1178 {
1179 $trxid1 = date("mdHis", time());
1180 $trxid1 = $trxid1 + ((rand(2, 100) * rand(2, 100)) + rand(2, 10000));
1181 $trxid1 .= rand(10, 99);
1182 if (strlen(trim(intval($trxid1))) < 10)
1183 $trxid1 = "0" . $trxid1;
1184 return $trxid1;
1185 }
1186
1187 public function update_validated_nik_kk($msisdn, $stars)
1188 {
1189 $model_user = new Models_User;
1190 $update = $model_user->update_validated_nik_kk($msisdn, $stars);
1191 $this->logger->write('debug-update-nik-kk', 'UPDATE NIK&KK ');
1192 return $update;
1193 }
1194/////== ADD for check Reregistration ]]]
1195
1196
1197}