Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 551)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 554)
@@ -10,5 +10,5 @@
     public function __construct() {
         parent::__construct();
-        $this->load->helper('cookie');        
+        $this->load->helper('cookie');
     }
 
@@ -26,8 +26,8 @@
             $data['current_tab'] = $this->uri->segment(4, 'edit-basic');
             $data['packages'] = $this->servicepackage_model->getAllPackages();
-			$data['is_viettel'] = $user_info['is_viettel'];
+            $data['is_viettel'] = $user_info['is_viettel'];
             parse_str($user, $info);
-            $data=  array_merge($data,$u);
-            $data=  array_merge($data,$user_info);
+            $data = array_merge($data, $u);
+            $data = array_merge($data, $user_info);
             $this->load->view('frontend/user_profile', $data);
         } else {
@@ -66,5 +66,5 @@
         echo json_encode($result);
     }
-    
+
     public function finishRegisterPackage() {
         $result = array();
@@ -79,5 +79,5 @@
             }
             if (strlen($input['school']) < 1) {
-                $result['errors'][] = "Vui lÃ²ng nháº­p ÄÆ¡n vá» cÃŽng tÃ¡c";                
+                $result['errors'][] = "Vui lÃ²ng nháº­p ÄÆ¡n vá» cÃŽng tÃ¡c";
             }
             if (!isset($result['errors'])) {
@@ -100,5 +100,5 @@
                         $update = $this->user_model->update_user($src, $token, $input, $us_id);
                         $info = urldecode(http_build_query($info));
-                        $userdata = array('username' => $user_info['username'], 'user' => $info, 'us_id' => $user_info['us_id'], 'logined_in' => TRUE,'is_viettel' => $user_info['is_viettel']);
+                        $userdata = array('username' => $user_info['username'], 'user' => $info, 'us_id' => $user_info['us_id'], 'logined_in' => TRUE, 'is_viettel' => $user_info['is_viettel']);
                         $this->session->set_userdata('userInfo', $userdata);
                     }
@@ -107,5 +107,5 @@
         }
         if (isset($result['errors'])) {
-            echo json_encode ($result);
+            echo json_encode($result);
             die();
         }
@@ -115,5 +115,5 @@
         $package = $this->servicepackage_model->getPackage($input['p_id']);
         $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
-        $user['expire_date'] = date('Y-m-d 00:00:00', strtotime("+" . $package['p_period'] . " ".$package['p_unit'], strtotime($user['expire_date']))); 
+        $user['expire_date'] = date('Y-m-d 00:00:00', strtotime("+" . $package['p_period'] . " " . $package['p_unit'], strtotime($user['expire_date'])));
         $user['expire_date'] = date("Y-m-d 00:00:00", (strtotime($user['expire_date']) - 1));
         $user['p_id'] = $package['p_id'];
@@ -124,36 +124,34 @@
         echo json_encode($result);
     }
-    
-    public function regpackage () 
-    {
-    	$user_info = $this->session->userdata('userInfo');
-    	parse_str($user_info['user'], $info);
-    	$p_id = $this->input->post('p_id', TRUE);
-    	
-    	$us_id = (int)$info['id'];
-    	$this->load->model('servicepackage_model');
-    	$this->load->model('user_model');
-    	
-    	$user = $this->user_model->get_user_by_id($us_id);
-    	$package = $this->servicepackage_model->getPackage($p_id);
-    	
-    	if ($user['acc_balanced'] < $package['p_price']) {
-    		$message = 'Sá» tiá»n trong TÃ i khoáº£n SBG Online hiá»n táº¡i cá»§a QuÃ­ vá» lÃ  '. $user['acc_balanced'] .' Äá»ng.<br /> Äá» ÄÄng kÃ­ Sá»­ dá»¥ng dá»ch vá»¥ Soáº¡n BÃ i giáº£ng trá»±c tuyáº¿n, QuÃ­ vá» cáº§n náº¡p thÃªm tiá»n vÃ o tÃ i khoáº£n.';
-    	}
-    	else {
-	    	$user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
-	    	$currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' ? date('Y-m-d 00:00:00') : $user['expire_date'];
-	    	
-	    	$user['expire_date'] = date('Y-m-d', strtotime("+" . $package['p_period'] ." ". $package['p_unit'], strtotime($currentExpireDate)));    	
-	    	//$user['expire_date'] = date("Y-m-d", (strtotime($user['expire_date']) - 1));
-	    	
-	    	$user['p_id'] = $package['p_id'];
-	    	
-	    	$this->user_model->updateUser($us_id, $user);
-	    	$message = 'QuÃœ vá» ÄÃ£ ÄÄng kÃ­ sá»­ dá»¥ng CÃŽng cá»¥ Soáº¡n BÃ i giáº£ng trá»©c tuyáº¿n. QuÃ­ vá» ÄÆ°á»£c sá»­ dá»¥ng dá»ch vá»¥ Äáº¿n háº¿t ngÃ y '. date('d-m-Y', strtotime($user['expire_date']));
-    	}
-    	
-    	$this->session->set_flashdata('message', $message);
-    	redirect('frontend/user/profile#services-register');
+
+    public function regpackage() {
+        $user_info = $this->session->userdata('userInfo');
+        parse_str($user_info['user'], $info);
+        $p_id = $this->input->post('p_id', TRUE);
+
+        $us_id = (int) $info['id'];
+        $this->load->model('servicepackage_model');
+        $this->load->model('user_model');
+
+        $user = $this->user_model->get_user_by_id($us_id);
+        $package = $this->servicepackage_model->getPackage($p_id);
+
+        if ($user['acc_balanced'] < $package['p_price']) {
+            $message = 'Sá» tiá»n trong TÃ i khoáº£n SBG Online hiá»n táº¡i cá»§a QuÃ­ vá» lÃ  ' . $user['acc_balanced'] . ' Äá»ng.<br /> Äá» ÄÄng kÃ­ Sá»­ dá»¥ng dá»ch vá»¥ Soáº¡n BÃ i giáº£ng trá»±c tuyáº¿n, QuÃ­ vá» cáº§n náº¡p thÃªm tiá»n vÃ o tÃ i khoáº£n.';
+        } else {
+            $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
+            $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' ? date('Y-m-d 00:00:00') : $user['expire_date'];
+
+            $user['expire_date'] = date('Y-m-d', strtotime("+" . $package['p_period'] . " " . $package['p_unit'], strtotime($currentExpireDate)));
+            //$user['expire_date'] = date("Y-m-d", (strtotime($user['expire_date']) - 1));
+
+            $user['p_id'] = $package['p_id'];
+
+            $this->user_model->updateUser($us_id, $user);
+            $message = 'QuÃœ vá» ÄÃ£ ÄÄng kÃ­ sá»­ dá»¥ng CÃŽng cá»¥ Soáº¡n BÃ i giáº£ng trá»©c tuyáº¿n. QuÃ­ vá» ÄÆ°á»£c sá»­ dá»¥ng dá»ch vá»¥ Äáº¿n háº¿t ngÃ y ' . date('d-m-Y', strtotime($user['expire_date']));
+        }
+
+        $this->session->set_flashdata('message', $message);
+        redirect('frontend/user/profile#services-register');
     }
 
@@ -174,5 +172,4 @@
         }
     }
-
 
     private function dateDiff($expire_date) {
@@ -247,7 +244,7 @@
             $token = md5($us_id . self::TOKENPW);
             $input = $this->input->post();
-            
-            
-            
+
+
+
             if (strlen($input['passwd']) == 0) {
                 $result['errors']['passwd_old_err'] = "Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng!";
@@ -258,8 +255,8 @@
                 $result['errors']['passwd_new_err'] = "Máº­t kháº©u trÃ¹ng vá»i máº­t kháº©u hiá»n táº¡i!";
             }
-            if ($input['passwd_new']!= $input['confirm_passwd_new']) {
+            if ($input['passwd_new'] != $input['confirm_passwd_new']) {
                 $result['errors']['confirm_passwd_new_err'] = "Máº­t kháº©u khÃŽng trÃ¹ng nhau!";
             }
-            
+
             if (!isset($result['errors'])) {
                 $user = array('username' => $user_info['username'], 'fullname' => null, 'gender' => null, 'email' => null, 'school' => null, 'province' => null, 'password' => $input['passwd_new'], 'oldpass' => $input['passwd']);
