Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php	(revision 753)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php	(revision 765)
@@ -54,6 +54,8 @@
                $first_visit=1;
             }
+            
+            $isOverDate = strtotime($u['expire_date']) < strtotime(date('Y-m-d')) ? 0:1; 
  
-          $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams,'update_user_info'=>$update_user_info,'us_id'=>$us_id,"p_period"=>$u['p_period'],"expire_date"=>date("d-m-Y", strtotime($u['expire_date'])), "fullname"=>$info['fullname'], "school"=>$info['school'], "province"=>$u['province'], "provinces"=>lang('_PROVINCES_')));
+            $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams,'update_user_info'=>$update_user_info,'us_id'=>$us_id,"p_period"=>$u['p_period'],"expire_date"=>date("d-m-Y", strtotime($u['expire_date'])), 'isOverDate' => $isOverDate , "fullname"=>$info['fullname'], "school"=>$info['school'], "province"=>$u['province'], "provinces"=>lang('_PROVINCES_')));
         } else {
             redirect('/frontend/home/');
Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 753)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 765)
@@ -64,4 +64,5 @@
             $result['can_buy'] = 1;
             $result['can_edit'] = 0;
+            
             if ($user['acc_balanced'] < $package['p_price']) {
                 $result['can_buy'] = 0;
@@ -142,5 +143,8 @@
         $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'];
+        $today_dt = new DateTime(date('Y-m-d 00:00:00'));
+        $expire_dt = new DateTime($user['expire_date']);
+        
+        $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' || $today_dt > $expire_dt  ? 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['p_id'] = $package['p_id'];
@@ -175,5 +179,9 @@
         } 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'];
+            
+            $today_dt = new DateTime(date('Y-m-d 00:00:00'));
+            $expire_dt = new DateTime($user['expire_date']);
+            
+            $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == ''  || $today_dt > $expire_dt ? 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)));
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php	(revision 753)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php	(revision 765)
@@ -117,4 +117,5 @@
     var update_user_info="<?php echo $update_user_info;?>";
     var us_id="<?php echo $us_id;?>";
+    var is_overdate = <?php echo $isOverDate;?>
 </script>		
 <?php
