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੐)|#o0aڱ$I>}k&1`U#V?YsV x>{t1[I~D&(I$I/{H0fw"q"y%4 IXyE~M3 8XψL}qE$I[> nD?~sf ]o΁ cT6"?'_Ἣ $I>~.f|'!N?⟩0G KkXZE]ޡ;/&?k OۘH$IRۀwXӨ<7@PnS04aӶp.:@\IWQJ6sS%I$e5ڑv`3:x';wq_vpgHyXZ 3gЂ7{{EuԹn±}$I$8t;b|591nءQ"P6O5i }iR̈́%Q̄p!I䮢]O{H$IRϻ9s֧ a=`- aB\X0"+5"C1Hb?߮3x3&gşggl_hZ^,`5?ߎvĸ%̀M!OZC2#0x LJ0 Gw$I$I}<{Eb+y;iI,`ܚF:5ܛA8-O-|8K7s|#Z8a&><a&/VtbtLʌI$I$I$I$I$I$IRjDD%tEXtdate:create2022-05-31T04:40:26+00:00!Î%tEXtdate:modify2022-05-31T04:40:26+00:00|{2IENDB`Mini Shell

HOME


Mini Shell 1.0
DIR:/home/dna1981/public_html/SMB/admin/school/
Upload File :
Current File : /home/dna1981/public_html/SMB/admin/school/users-manager.php
<?php require_once('../../php/connect.php'); ?>
<?php include ("php/nav.php");?>
<?php require ("../php/secure.php");?>
<?php 
date_default_timezone_set("America/Chicago");
$todaydate = date("Y-m-d");
$Now = date('Y-m-d H:i:s'); 

  $colname_Get_User = $_GET['userID'];

$query_Manage_User = "SELECT * FROM School_Users WHERE id = '$colname_Get_User'";
$Manage_User = mysqli_query($SMB, $query_Manage_User);
$row_Manage_User = mysqli_fetch_assoc($Manage_User); 
$totalRows_Manage_User = mysqli_num_rows($Manage_User);

// Users Orders

$query_User_Orders = "SELECT * FROM School_Orders WHERE cid='$colname_Get_User' ORDER BY date Desc";
$User_Orders = mysqli_query($SMB, $query_User_Orders);
$totalRows_User_Orders = mysqli_num_rows($User_Orders);
if($totalRows_User_Orders > 0){
	while($row_User_Orders = mysqli_fetch_assoc($User_Orders)){
		$Order_ID = $row_User_Orders['id'];
		$Order_date = $row_User_Orders['date'];
		$Order_Amount = $row_User_Orders['orderTotal'];
		$Order_TransID = $row_User_Orders['transID'];
		
	$Order_Output .= '<tr>
                <td height="40" align="left" valign="middle">'.$Order_date.'</td>
                <td align="left" valign="middle">'.$Order_ID.'</td>
                <td align="center" valign="middle">$'.$Order_Amount.'</td>
                 <td align="center" valign="middle">'.$Order_TransID.'</td>
                <td align="right" valign="middle"><a href="users-orders.php?orderID='.$Order_ID.'"><img src="assets/view-order-icon.png" width="29" height="30" alt=""/></a></td>
              </tr>'; 
	}
}
else {
	$Order_Output = '<tr>
                <td height="40" colspan="5" align="left" valign="middle">No Orders</td>
              </tr>';
	}

// Users Add Ons

$query_User_AddOns = "SELECT * FROM School_OrdersCart WHERE cid = '$colname_Get_User' AND AddOn > 0 ORDER BY date DESC";
$User_AddOns = mysqli_query($SMB, $query_User_AddOns);
$totalRows_User_AddOns = mysqli_num_rows($User_AddOns);
if($totalRows_User_AddOns > 0){
	while($row_User_AddOns = mysqli_fetch_assoc($User_AddOns)){
		$User_AddOns_ID = $row_User_AddOns['id'];
		$User_AddOns_Name = $row_User_AddOns['product_name'];
		$User_AddOns_OrderID = $row_User_AddOns['OrderID'];
		$User_AddOns_Complete = $row_User_AddOns['AddOn_Complete'];
		$User_AddOns_Date = $row_User_AddOns['date'];
		
		if($User_AddOns_Complete > 0){
			$Complete = 'Y';
		}
		else {
			$Complete = 'N';
		}
		
		$User_AddOn_Output .= '<tr>
                <td height="40" align="left" valign="middle">'.$User_AddOns_Date.'</td>
                <td align="left" valign="middle">'.$User_AddOns_OrderID.'</td>
                <td align="left" valign="middle">'.$User_AddOns_Name.'</td>
                <td align="center" valign="middle">'.$Complete.'</td>
                <td align="right" valign="middle"><a href="user-addons.php?id='.$User_AddOns_ID .'"><img src="assets/view-order-icon.png" width="29" height="30" alt=""/></a></td>
              </tr>';
		
	}
}
else {
	$User_AddOn_Output = '<tr>
                <td height="40" colspan="5" align="left" valign="middle">No Add Ons</td>
              </tr>';
	}


// Get Activity

$query_User_Activity = "SELECT DATE(date) AS GetDate, Count(id) AS Pages, UserID FROM SMBDU_Tracker WHERE UserID = '$colname_Get_User' GROUP BY GetDate ORDER BY GetDate DESC";
$User_Activity = mysqli_query($SMB, $query_User_Activity);
$totalRows_User_Activity = mysqli_num_rows($User_Activity);
if($totalRows_User_Activity > 0){
	while($row_User_Activity = mysqli_fetch_assoc($User_Activity)){
		$Activity_Date = $row_User_Activity['GetDate'];
		$Activity_Pages = $row_User_Activity['Pages'];
		$Activity_UserID = $row_User_Activity['UserID'];
		
		$ShowActivity .= '<tr>
                <td height="40" align="left" valign="middle">'.$Activity_Date.'</td>
                <td align="center" valign="middle">'.$Activity_Pages.'</td>
                <td align="right" valign="middle"><a href="user-activity.php?userID='.$Activity_UserID.'&&date='.$Activity_Date.'"><img src="assets/view-order-icon.png" width="29" height="30" alt=""/></a></td>
              </tr>';
		
		
		
	}
}

//Show Modules and Activity

$query_Get_Modules = "SELECT School_OrdersCart.id, School_OrdersCart.cid, School_OrdersCart.end_date, School_OrdersCart
.product_name, School_OrdersCart.image, School_OrdersCart.date, School_OrdersCart.CourseID, School_OrdersCart.ModuleID, School_OrdersCart.duration, School_Users.id AS userID, School_Users.degree
FROM School_OrdersCart 
JOIN School_Users
ON School_Users.id = School_OrdersCart.cid
WHERE School_OrdersCart.cid = '$colname_Get_User' AND School_OrdersCart.ModuleID > 0
ORDER BY School_OrdersCart.date DESC";
$Get_Modules = mysqli_query($SMB, $query_Get_Modules);
$totalRows_Get_Modules = mysqli_num_rows($Get_Modules);
if($totalRows_Get_Modules > 0){	

	$My_Modules_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="10%" align="left" height="40"><strong>MODULE</strong></td>
      <td width="50%" align="left" >&nbsp;</td>
      <td width="20%" align="center" ><strong>PROGRESS</strong></td>
      <td width="20%" align="center"><strong>DAYS REMAINING</strong></td>
    </tr>';
	
	$Previous_Modules_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="10%" align="left" height="40"><strong>MODULE</strong></td>
      <td width="50%" align="left" >&nbsp;</td>
      <td width="20%" align="center" ><strong>PROGRESS</strong></td>
      <td width="20%" align="center"><strong>DAYS REMAINING</strong></td>
    </tr>';
	
	while($row_Get_Modules = mysqli_fetch_assoc($Get_Modules)){
	 $Modules_ID = $row_Get_Modules['id'];
	 $Modules_CID = $row_Get_Modules['cid'];
	 $Modules_ProductName = $row_Get_Modules['product_name'];
	 $Modules_ModuleIMG = $row_Get_Modules['image'];
	 $Modules_Durartion = $row_Get_Modules['duration'];
	 $Modules_ModuleID = $row_Get_Modules['ModuleID'];
	 $Modules_EndDate = $row_Get_Modules['end_date'];
	 $Modules_Purchased = $row_Get_Modules['date'];
	 $Modules_Degree = $row_Get_Modules['degree'];
	 $Module_now = time();
		
	if($Modules_Degree == 'DDS'){
		$Modules_Doctor = 'Y';
	}
	elseif($Modules_Degree == 'DMD'){
		$Modules_Doctor = 'Y';
	}
	elseif($Modules_Degree == 'RDH'){
		$Modules_Doctor = 'Y';
	}
	else {
			$Modules_Doctor = 'N';
		}
		

$query_Module_Views = "SELECT SMBDU_CourseModules.mid AS ModuleID, SMBDU_CourseModules.cid, SMBDU_VideoViews.mid, SMBDU_VideoViews.date, SMBDU_VideoViews.userID
FROM SMBDU_CourseModules
INNER JOIN SMBDU_VideoViews
ON SMBDU_CourseModules.mid=SMBDU_VideoViews.mid
WHERE SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.date > '$Modules_Purchased' AND SMBDU_CourseModules.mid = '$Modules_ModuleID'
ORDER BY SMBDU_VideoViews.date ASC LIMIT 1";
$Module_Views = mysqli_query($SMB, $query_Module_Views);
$row_Module_Views = mysqli_fetch_assoc($Module_Views);
$totalRows_Module_Views = mysqli_num_rows($Module_Views);
if($totalRows_Module_Views > 0) {
	$Get_Module_StartDate = $row_Module_Views['date'];
	$Create_Module_EndDate = date('Y-m-d', strtotime($Get_Module_StartDate. ' + '.$Modules_Durartion.' days'));
	$your_Module_date = strtotime("$Create_Module_EndDate");
    $Module_datediff = $your_Module_date - $Module_now;
	$Module_GetDays = (floor($Module_datediff / (60 * 60 * 24)) + 1);
	
}
	else {
		$Create_Module_EndDate = date('Y-m-d', strtotime($todaydate. ' + '.$Modules_Durartion.' days'));
		$Module_GetDays = $Modules_Durartion;
		
	}	
		
if($Create_Module_EndDate >= $todaydate){			

$query_Get_Purchased_Modules = "SELECT School_Modules.id, School_Modules.title, School_Modules.image, School_Modules.ModuleID
FROM School_Modules
WHERE School_Modules.id = '$Modules_ModuleID'
ORDER BY School_Modules.ModuleID ASC";
$Get_Purchased_Modules = mysqli_query($SMB, $query_Get_Purchased_Modules);
$totalRows_Get_Purchased_Modules = mysqli_num_rows($Get_Purchased_Modules);
if($totalRows_Get_Purchased_Modules > 0){	
	while($row_Get_Purchased_Modules = mysqli_fetch_assoc($Get_Purchased_Modules)){
		$Modules_Modules_ID = $row_Get_Purchased_Modules['id'];
		$Modules_Modules_Title = $row_Get_Purchased_Modules['title'];
		$Modules_Modules_IMG = $row_Get_Purchased_Modules['image'];
		$Modules_Modules_ModuleID = $row_Get_Purchased_Modules['ModuleID'];
$match = array();

$query_Get_Completed_Modules = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_Media.id AS VID, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Modules_ModuleID' AND School_Media.type = 'video'";
$Get_Completed_Modules = mysqli_query($SMB, $query_Get_Completed_Modules);
$totalRows_Get_Completed_Modules = mysqli_num_rows($Get_Completed_Modules);
if($totalRows_Get_Completed_Modules > 0) {
	while($row_Get_Completed_Modules = mysqli_fetch_array($Get_Completed_Modules)){
		   $match[] = $row_Get_Completed_Modules['VID'];

$showMatch = implode(',', $match);

$query_Check_End = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, SMBDU_VideoViews.id as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.type = 'end' AND SMBDU_VideoViews.vid IN($showMatch)
GROUP BY SMBDU_VideoViews.vid";
$Check_End = mysqli_query($SMB, $query_Check_End);
$totalRows_Check_End = mysqli_num_rows($Check_End);
if($totalRows_Check_End == $totalRows_Get_Completed_Modules){
// Taken Test

$query_Taken_Test = "SELECT * FROM SMBDU_UserAnswers WHERE UserID = '$colname_Get_User' AND ModuleID = '$Modules_ModuleID'
GROUP BY ModuleID";
$Taken_Test = mysqli_query($SMB, $query_Taken_Test);
$totalRows_Taken_Test = mysqli_num_rows($Taken_Test);
if($totalRows_Taken_Test > 0){

$query_Test_Passed = "SELECT * FROM SMBDU_CompleteTest WHERE UserID = '$colname_Get_User' AND ModuleID = '$Modules_ModuleID'
GROUP BY ModuleID";
$Test_Passed = mysqli_query($SMB, $query_Test_Passed);
$totalRows_Test_Passed = mysqli_num_rows($Test_Passed);
if($totalRows_Test_Passed){
	$Show_Test = '<img src="https://www.smbdu.com/assets/test-complete.png" alt="Passed Test" height="30"/>';
	
}
	else {
		$Show_Test = '<img src="https://www.smbdu.com/assets/retake-test.png" alt="Module Test" height="30"/>';
		
	}
	
}
if($totalRows_Taken_Test == 0 && $Modules_Modules_Test == 1 && $Modules_Modules_CE == 1 && $Modules_Doctor == 'Y'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/test-required.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Modules_Modules_Test == 1 && $Modules_Modules_CE == 0 && $Modules_Doctor == 'Y'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Modules_Modules_Test == 1 && $Modules_Modules_CE == 1 && $Modules_Doctor == 'N'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Modules_Modules_Test == 1 && $Modules_Modules_CE == 0 && $Modules_Doctor == 'N'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Modules_Modules_Test == 0 && $Modules_Modules_CE == 0){
	$Show_Test = '';
	
}
}
	else {
		$Show_Test = '';
	}	
	}}
		$My_Modules_Output .= '<tr>
      <td align="left" height="50"><img src="https://www.successfulmedicalbilling.com/admin/school/img/'.$Modules_Modules_IMG.'" alt="" height="35"/></td>
      <td align="left" valign="middle"><h4>#'.$Modules_Modules_ModuleID.'-'.$Modules_Modules_Title.'</h4></td>
      <td align="center">'.$Show_Test.'</td>
	  <td align="center"></td>
    </tr>';
		

$query_Get_Modules_Modules_Segments = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_ModuleVideos.sort, School_Media.id AS VID, School_Media.name, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Modules_ModuleID' AND type = 'video'
ORDER BY School_ModuleVideos.sort ASC";
$Get_Modules_Modules_Segments = mysqli_query($SMB, $query_Get_Modules_Modules_Segments);
$totalRows_Get_Modules_Modules_Segments = mysqli_num_rows($Get_Modules_Modules_Segments);
if($totalRows_Get_Modules_Modules_Segments > 0){	
	while($row_Get_Modules_Modules_Segments = mysqli_fetch_assoc($Get_Modules_Modules_Segments)){
		$Modules_Modules_Segments_ID = $row_Get_Modules_Modules_Segments['ModuleID'];
		$Modules_Modules_Segments_VID = $row_Get_Modules_Modules_Segments['VID'];
		$Modules_Modules_Segments_Name = $row_Get_Modules_Modules_Segments['name'];

if($totalRows_Get_Modules_Modules_Segments > 0){
// Has it been completed

$query_Get_Modules_Modules_Complete = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, max(SMBDU_VideoViews.id) as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.mid = '$Modules_ModuleID' AND SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.vid = '$Modules_Modules_Segments_VID' AND SMBDU_VideoViews.type = 'end'
GROUP BY SMBDU_VideoViews.vid
ORDER BY ID DESC";
$Get_Modules_Modules_Complete = mysqli_query($SMB, $query_Get_Modules_Modules_Complete);
$totalRows_Get_Modules_Modules_Complete = mysqli_num_rows($Get_Modules_Modules_Complete);
if($totalRows_Get_Modules_Modules_Complete > 0){	
	while($row_Get_Modules_Modules_Complete = mysqli_fetch_assoc($Get_Modules_Modules_Complete)){
		$Modules_Modules_Views_Complete_Type = $row_Get_Modules_Modules_Complete['type'];	


			$Progress = '<img src="https://www.smbdu.com/assets/complete-icon.png" alt="Module Complete" height="30"/>';
			$Link = 'training-segment.php?mid='.$Modules_ModuleID.'&&sid='.$Modules_Modules_Segments_VID.'&&resume=1';
		
			
		}}
}
if($totalRows_Get_Modules_Modules_Complete == 0){

$query_Get_Modules_Modules_Views = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, max(SMBDU_VideoViews.id) as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.mid = '$Modules_ModuleID' AND SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.vid = '$Modules_Modules_Segments_VID' AND SMBDU_VideoViews.type != 'end'
GROUP BY SMBDU_VideoViews.vid
ORDER BY ID DESC";
$Get_Modules_Modules_Views = mysqli_query($SMB, $query_Get_Modules_Modules_Views);
$totalRows_Get_Modules_Modules_Views = mysqli_num_rows($Get_Modules_Modules_Views);
if($totalRows_Get_Modules_Modules_Views > 0){	
	while($row_Get_Modules_Modules_Views = mysqli_fetch_assoc($Get_Modules_Modules_Views)){
		$Modules_Modules_Views_Type = $row_Get_Modules_Modules_Views['type'];

		if($Modules_Modules_Views_Type == 'play'){
			$Progress = '<img src="https://www.smbdu.com/assets/in-progress-icon.png" alt="Module In Progress" height="30"/>';
			$Link = 'training-segment.php?mid='.$Modules_ModuleID.'&&sid='.$Modules_Modules_Segments_VID.'&&resume=1';
		}
		if($Modules_Modules_Views_Type == 'pause'){
			$Progress = '<img src="https://www.smbdu.com/assets/in-progress-icon.png" alt="Module In Progress" height="30"/>';
			$Link = 'training-segment.php?mid='.$Modules_ModuleID.'&&sid='.$Modules_Modules_Segments_VID.'&&resume=1';
		}		
			
		}}

	}
if($totalRows_Get_Modules_Modules_Complete == 0 && $totalRows_Get_Modules_Modules_Views == 0){
	$Progress = '<img src="https://www.smbdu.com/assets/start-now.png" alt="Start Now" height="30"/>';
			$Link = 'training-segment.php?mid='.$Modules_ModuleID.'&&sid='.$Modules_Modules_Segments_VID.'';
}
		$My_Modules_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>#'.$Modules_Modules_ModuleID.' - '.$Modules_Modules_Segments_Name.'</h6></td>
      <td align="center">'.$Progress.'</td>
	  <td align="center">'.$Module_GetDays.' Days Left</td>
    </tr>';
	}}
	}}
		}

		
	elseif($Create_Module_EndDate < $todaydate){
			

$query_Get_Purchased_Modules = "SELECT School_Modules.id, School_Modules.title, School_Modules.image, School_Modules.ModuleID
FROM School_Modules
WHERE School_Modules.id = '$Modules_ModuleID'
ORDER BY School_Modules.ModuleID ASC";
$Get_Purchased_Modules = mysqli_query($SMB, $query_Get_Purchased_Modules);
$totalRows_Get_Purchased_Modules = mysqli_num_rows($Get_Purchased_Modules);
if($totalRows_Get_Purchased_Modules > 0){	
	while($row_Get_Purchased_Modules = mysqli_fetch_assoc($Get_Purchased_Modules)){
		$Modules_Modules_ID = $row_Get_Purchased_Modules['id'];
		$Modules_Modules_Title = $row_Get_Purchased_Modules['title'];
		$Modules_Modules_IMG = $row_Get_Purchased_Modules['image'];
		$Modules_Modules_ModuleID = $row_Get_Purchased_Modules['ModuleID'];
		
		$Previous_Modules_Output .= '<tr>
      <td align="left" height="50"><img src="https://www.successfulmedicalbilling.com/admin/school/img/'.$Modules_Modules_IMG.'" alt="" height="35"/></td>
      <td align="left" valign="middle"><h4>#'.$Modules_Modules_ModuleID.'-'.$Modules_Modules_Title.'</h4></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
		

$query_Get_Modules_Modules_Segments = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_ModuleVideos.sort, School_Media.id AS VID, School_Media.name, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Modules_Modules_ID' AND type = 'video'
ORDER BY School_ModuleVideos.sort ASC";
$Get_Modules_Modules_Segments = mysqli_query($SMB, $query_Get_Modules_Modules_Segments);
$totalRows_Get_Modules_Modules_Segments = mysqli_num_rows($Get_Modules_Modules_Segments);
if($totalRows_Get_Modules_Modules_Segments > 0){	
	while($row_Get_Modules_Modules_Segments = mysqli_fetch_assoc($Get_Modules_Modules_Segments)){
		$Modules_Modules_Segments_ID = $row_Get_Modules_Modules_Segments['ModuleID'];
		$Modules_Modules_Segments_VID = $row_Get_Modules_Modules_Segments['VID'];
		$Modules_Modules_Segments_Name = $row_Get_Modules_Modules_Segments['name'];


$query_Get_Modules_Modules_Views = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, max(SMBDU_VideoViews.id) as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.mid = '$Modules_Modules_ID' AND SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.vid = '$Modules_Modules_Segments_VID' AND SMBDU_VideoViews.type = 'end'
GROUP BY SMBDU_VideoViews.vid
ORDER BY ID DESC";
$Get_Modules_Modules_Views = mysqli_query($SMB, $query_Get_Modules_Modules_Views);
$totalRows_Get_Modules_Modules_Views = mysqli_num_rows($Get_Modules_Modules_Views);
if($totalRows_Get_Modules_Modules_Views > 0){	
	while($row_Get_Modules_Modules_Views = mysqli_fetch_assoc($Get_Modules_Modules_Views)){
		$Modules_Modules_Views_Type = $row_Get_Modules_Modules_Views['type'];
		
		$Progress = '<img src="https://www.smbdu.com/assets/complete-icon.png" alt="Module Complete" height="30"/>';
		
		}}
		
if($totalRows_Get_Modules_Modules_Views == 0){
	$Progress = '<img src="https://www.smbdu.com/assets/not-complete.png" alt="Module Not Completed" height="30"/>';
}

		
		$Previous_Modules_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>#'.$Modules_Modules_ModuleID.' - '.$Modules_Modules_Segments_Name.'</h6></td>
      <td align="center">'.$Progress.'</td>
	  <td align="center">0 Days Left</td>
    </tr>';
	}}
		
	}}
	
		}
		
	else {
		$My_Modules_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>No Current Modules</h6></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
		$Previous_Modules_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>No Previous Modules</h6></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
	}	
}

	$My_Modules_Output .= '</tbody>
</table>';
	
	$Previous_Modules_Output .= '</tbody>
</table>';
}
else {
	$My_Modules_Output .= '';
	$Previous_Modules_Output .= ''; 
}

//Show Courses and Activity

$query_Get_Courses = "SELECT School_OrdersCart.id, School_OrdersCart.cid, School_OrdersCart.end_date, School_OrdersCart
.product_name, School_OrdersCart.image, School_OrdersCart.date, School_OrdersCart.CourseID, School_OrdersCart.ModuleID, School_OrdersCart.duration, School_Users.id AS userID, School_Users.degree
FROM School_OrdersCart 
JOIN School_Users
ON School_Users.id = School_OrdersCart.cid
WHERE School_OrdersCart.cid = '$colname_Get_User' AND School_OrdersCart.CourseID > 0
ORDER BY School_OrdersCart.date DESC";
$Get_Courses = mysqli_query($SMB, $query_Get_Courses);
$totalRows_Get_Courses = mysqli_num_rows($Get_Courses);
if($totalRows_Get_Courses > 0){	

	$My_Courses_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="10%" align="left" height="40"><strong>COURSE</strong></td>
      <td width="50%" align="left" >&nbsp;</td>
      <td width="20%" align="center" ><strong>PROGRESS</strong></td>
      <td width="20%" align="center"><strong>DAYS REMAINING</strong></td>
    </tr>';
	
	$Previous_Courses_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="10%" align="left" height="40"><strong>COURSE</strong></td>
      <td width="50%" align="left" >&nbsp;</td>
      <td width="20%" align="center" ><strong>PROGRESS</strong></td>
      <td width="20%" align="center"><strong>DAYS REMAINING</strong></td>
    </tr>';
	
	while($row_Get_Courses = mysqli_fetch_assoc($Get_Courses)){
	 $Courses_ID = $row_Get_Courses['id'];
	 $Courses_CID = $row_Get_Courses['cid'];
	 $Courses_ModuleID = $row_Get_Courses['product_name'];
	 $Courses_CourseIMG = $row_Get_Courses['image'];
	 $Courses_Durartion = $row_Get_Courses['duration'];
	 $Courses_CourseID = $row_Get_Courses['CourseID'];
	 $Courses_EndDate = $row_Get_Courses['end_date'];
	 $Courses_Purchased = $row_Get_Courses['date'];
	 $Courses_Degree = $row_Get_Courses['degree'];
	 $now = time();
		
	if($Courses_Degree == 'DDS'){
		$Doctor = 'Y';
	}
	elseif($Courses_Degree == 'DMD'){
		$Doctor = 'Y';
	}
	elseif($Courses_Degree == 'RDH'){
		$Doctor = 'Y';
	}
	else {
			$Doctor = 'N';
		}
		

$query_Any_Views = "SELECT SMBDU_CourseModules.mid AS ModuleID, SMBDU_CourseModules.cid, SMBDU_VideoViews.mid, SMBDU_VideoViews.date, SMBDU_VideoViews.userID
FROM SMBDU_CourseModules
INNER JOIN SMBDU_VideoViews
ON SMBDU_CourseModules.mid=SMBDU_VideoViews.mid
WHERE SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.date > '$Courses_Purchased' AND SMBDU_CourseModules.cid = '$Courses_CourseID'
ORDER BY SMBDU_VideoViews.date ASC LIMIT 1";
$Any_Views = mysqli_query($SMB, $query_Any_Views);
$row_Any_Views = mysqli_fetch_assoc($Any_Views);
$totalRows_Any_Views = mysqli_num_rows($Any_Views);
if($totalRows_Any_Views > 0) {
	$Get_StartDate = $row_Any_Views['date'];
	$Create_Course_EndDate = date('Y-m-d', strtotime($Get_StartDate. ' + '.$Courses_Durartion.' days'));
	$your_date = strtotime("$Create_Course_EndDate");
    $datediff = $your_date - $now;
	$GetDays = (floor($datediff / (60 * 60 * 24)) + 1);
	
}
	else {
		$Create_Course_EndDate = date('Y-m-d', strtotime($todaydate. ' + '.$Courses_Durartion.' days'));
		$GetDays = $Courses_Durartion;
		
	}	
		
if($Create_Course_EndDate >= $todaydate){
			

$query_Get_Courses_Modules = "SELECT SMBDU_CourseModules.cid, SMBDU_CourseModules.mid, School_Modules.id, School_Modules.title, School_Modules.image, School_Modules.ModuleID, School_Modules.test, School_Modules.CE
FROM SMBDU_CourseModules
INNER JOIN School_Modules
ON SMBDU_CourseModules.mid=School_Modules.id
WHERE SMBDU_CourseModules.cid = '$Courses_CourseID'
GROUP BY SMBDU_CourseModules.mid
ORDER BY School_Modules.ModuleID ASC";
$Get_Courses_Modules = mysqli_query($SMB, $query_Get_Courses_Modules);
$totalRows_Get_Courses_Modules = mysqli_num_rows($Get_Courses_Modules);
if($totalRows_Get_Courses_Modules > 0){

	
	
			$My_Courses_Output .= '<tr>
      <td align="left" height="50"><img src="https://www.successfulmedicalbilling.com/admin/school/img/'.$Courses_CourseIMG.'" alt="" height="100"/></td>
      <td align="left" valign="middle"><h3>'.$Courses_ModuleID.'</h3></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
	
	while($row_Get_Courses_Modules = mysqli_fetch_assoc($Get_Courses_Modules)){
		$Courses_Modules_ID = $row_Get_Courses_Modules['id'];
		$Courses_Modules_Title = $row_Get_Courses_Modules['title'];
		$Courses_Modules_IMG = $row_Get_Courses_Modules['image'];
		$Courses_Modules_ModuleID = $row_Get_Courses_Modules['ModuleID'];
		$Courses_Modules_Test = $row_Get_Courses_Modules['test'];
		$Courses_Modules_CE = $row_Get_Courses_Modules['CE'];

$match = array();

$query_Get_Completed_Modules = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_Media.id AS VID, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Courses_Modules_ID' AND School_Media.type = 'video'";
$Get_Completed_Modules = mysqli_query($SMB, $query_Get_Completed_Modules);
$totalRows_Get_Completed_Modules = mysqli_num_rows($Get_Completed_Modules);
if($totalRows_Get_Completed_Modules > 0) {
	while($row_Get_Completed_Modules = mysqli_fetch_array($Get_Completed_Modules)){
		   $match[] = $row_Get_Completed_Modules['VID'];

$showMatch = implode(',', $match);

$query_Check_End = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, SMBDU_VideoViews.id as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.type = 'end' AND SMBDU_VideoViews.vid IN($showMatch)
GROUP BY SMBDU_VideoViews.vid";
$Check_End = mysqli_query($SMB, $query_Check_End);
$totalRows_Check_End = mysqli_num_rows($Check_End);
if($totalRows_Check_End == $totalRows_Get_Completed_Modules){
// Taken Test

$query_Taken_Test = "SELECT * FROM SMBDU_UserAnswers WHERE UserID = '$colname_Get_User' AND ModuleID = '$Courses_Modules_ID'
GROUP BY ModuleID";
$Taken_Test = mysqli_query($SMB, $query_Taken_Test);
$totalRows_Taken_Test = mysqli_num_rows($Taken_Test);
if($totalRows_Taken_Test > 0){

$query_Test_Passed = "SELECT * FROM SMBDU_CompleteTest WHERE UserID = '$colname_Get_User' AND ModuleID = '$Courses_Modules_ID'
GROUP BY ModuleID";
$Test_Passed = mysqli_query($SMB, $query_Test_Passed);
$totalRows_Test_Passed = mysqli_num_rows($Test_Passed);
if($totalRows_Test_Passed){
	$Show_Test = '<img src="https://www.smbdu.com/assets/test-complete.png" alt="Passed Test" height="30"/>';
	
}
	else {
		$Show_Test = '<img src="https://www.smbdu.com/assets/retake-test.png" alt="Module Test" height="30"/>';
		
	}
	
}
if($totalRows_Taken_Test == 0 && $Courses_Modules_Test == 1 && $Courses_Modules_CE == 1 && $Doctor == 'Y'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/test-required.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Courses_Modules_Test == 1 && $Courses_Modules_CE == 0 && $Doctor == 'Y'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Courses_Modules_Test == 1 && $Courses_Modules_CE == 1 && $Doctor == 'N'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Courses_Modules_Test == 1 && $Courses_Modules_CE == 0 && $Doctor == 'N'){
	$Show_Test = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
if($totalRows_Taken_Test == 0 && $Courses_Modules_Test == 0 && $Courses_Modules_CE == 0){
	$Show_Test = '';
	
}
}
	else {
		$Show_Test = '';
	}	
	}}
		$My_Courses_Output .= '<tr>
      <td align="left" height="50"><img src="https://www.successfulmedicalbilling.com/admin/school/img/'.$Courses_Modules_IMG.'" alt="" height="35"/></td>
      <td align="left" valign="middle"><h4>#'.$Courses_Modules_ModuleID.'-'.$Courses_Modules_Title.'</h4></td>
      <td align="center">'.$Show_Test.'</td>
	  <td align="center"></td>
    </tr>';
		

$query_Get_Courses_Modules_Segments = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_ModuleVideos.sort, School_Media.id AS VID, School_Media.name, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Courses_Modules_ID' AND type = 'video'
ORDER BY School_ModuleVideos.sort ASC";
$Get_Courses_Modules_Segments = mysqli_query($SMB, $query_Get_Courses_Modules_Segments);
$totalRows_Get_Courses_Modules_Segments = mysqli_num_rows($Get_Courses_Modules_Segments);
if($totalRows_Get_Courses_Modules_Segments > 0){	
	while($row_Get_Courses_Modules_Segments = mysqli_fetch_assoc($Get_Courses_Modules_Segments)){
		$Courses_Modules_Segments_ID = $row_Get_Courses_Modules_Segments['ModuleID'];
		$Courses_Modules_Segments_VID = $row_Get_Courses_Modules_Segments['VID'];
		$Courses_Modules_Segments_Name = $row_Get_Courses_Modules_Segments['name'];

if($totalRows_Get_Courses_Modules_Segments > 0){
// Has it been completed

$query_Get_Courses_Modules_Complete = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, max(SMBDU_VideoViews.id) as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.mid = '$Courses_Modules_ID' AND SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.vid = '$Courses_Modules_Segments_VID' AND SMBDU_VideoViews.type = 'end'
GROUP BY SMBDU_VideoViews.vid
ORDER BY ID DESC";
$Get_Courses_Modules_Complete = mysqli_query($SMB, $query_Get_Courses_Modules_Complete);
$totalRows_Get_Courses_Modules_Complete = mysqli_num_rows($Get_Courses_Modules_Complete);
if($totalRows_Get_Courses_Modules_Complete > 0){	
	while($row_Get_Courses_Modules_Complete = mysqli_fetch_assoc($Get_Courses_Modules_Complete)){
		$Courses_Modules_Views_Complete_Type = $row_Get_Courses_Modules_Complete['type'];	


			$Progress = '<img src="https://www.smbdu.com/assets/complete-icon.png" alt="Module Complete" height="30"/>';
			$Link = 'training-segment.php?mid='.$Courses_Modules_ID.'&&sid='.$Courses_Modules_Segments_VID.'&&resume=1';
		
			
		}}
}
if($totalRows_Get_Courses_Modules_Complete == 0){

$query_Get_Courses_Modules_Views = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, max(SMBDU_VideoViews.id) as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.mid = '$Courses_Modules_ID' AND SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.vid = '$Courses_Modules_Segments_VID' AND SMBDU_VideoViews.type != 'end'
GROUP BY SMBDU_VideoViews.vid
ORDER BY ID DESC";
$Get_Courses_Modules_Views = mysqli_query($SMB, $query_Get_Courses_Modules_Views);
$totalRows_Get_Courses_Modules_Views = mysqli_num_rows($Get_Courses_Modules_Views);
if($totalRows_Get_Courses_Modules_Views > 0){	
	while($row_Get_Courses_Modules_Views = mysqli_fetch_assoc($Get_Courses_Modules_Views)){
		$Courses_Modules_Views_Type = $row_Get_Courses_Modules_Views['type'];

		if($Courses_Modules_Views_Type == 'play'){
			$Progress = '<img src="https://www.smbdu.com/assets/in-progress-icon.png" alt="Module In Progress" height="30"/>';
			$Link = 'training-segment.php?mid='.$Courses_Modules_ID.'&&sid='.$Courses_Modules_Segments_VID.'&&resume=1';
		}
		if($Courses_Modules_Views_Type == 'pause'){
			$Progress = '<img src="https://www.smbdu.com/assets/in-progress-icon.png" alt="Module In Progress" height="30"/>';
			$Link = 'training-segment.php?mid='.$Courses_Modules_ID.'&&sid='.$Courses_Modules_Segments_VID.'&&resume=1';
		}		
			
		}}

	}
if($totalRows_Get_Courses_Modules_Complete == 0 && $totalRows_Get_Courses_Modules_Views == 0){
	$Progress = '<img src="https://www.smbdu.com/assets/start-now.png" alt="Start Now" height="30"/>';
			$Link = 'training-segment.php?mid='.$Courses_Modules_ID.'&&sid='.$Courses_Modules_Segments_VID.'';
}
		$My_Courses_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>#'.$Courses_Modules_ModuleID.' - '.$Courses_Modules_Segments_Name.'</h6></td>
      <td align="center">'.$Progress.'</td>
	  <td align="center">'.$GetDays.' Days Left</td>
    </tr>';
	}}
	}}
		}

		
elseif($Create_Course_EndDate < $todaydate){
			

$query_Get_Courses_Modules = "SELECT SMBDU_CourseModules.cid, SMBDU_CourseModules.mid, School_Modules.id, School_Modules.title, School_Modules.image, School_Modules.ModuleID
FROM SMBDU_CourseModules
INNER JOIN School_Modules
ON SMBDU_CourseModules.mid=School_Modules.id
WHERE SMBDU_CourseModules.cid = '$Courses_CourseID'
GROUP BY SMBDU_CourseModules.mid
ORDER BY School_Modules.ModuleID ASC";
$Get_Courses_Modules = mysqli_query($SMB, $query_Get_Courses_Modules);
$totalRows_Get_Courses_Modules = mysqli_num_rows($Get_Courses_Modules);
if($totalRows_Get_Courses_Modules > 0){
			$Previous_Courses_Output .= '<tr>
      <td align="left" height="50"><img src="https://www.successfulmedicalbilling.com/admin/school/img/'.$Courses_CourseIMG.'" alt="" height="100"/></td>
      <td align="left" valign="middle"><h3>'.$Courses_ModuleID.'</h3></td>
      <td align="center"></td>
	  <td align="center"><h3>0 Days Left</h3></td>
    </tr>';
	
	while($row_Get_Courses_Modules = mysqli_fetch_assoc($Get_Courses_Modules)){
		$Courses_Modules_ID = $row_Get_Courses_Modules['id'];
		$Courses_Modules_Title = $row_Get_Courses_Modules['title'];
		$Courses_Modules_IMG = $row_Get_Courses_Modules['image'];
		$Courses_Modules_ModuleID = $row_Get_Courses_Modules['ModuleID'];
		
		$Previous_Courses_Output .= '<tr>
      <td align="left" height="50"><img src="https://www.successfulmedicalbilling.com/admin/school/img/'.$Courses_Modules_IMG.'" alt="" height="35"/></td>
      <td align="left" valign="middle"><h4>#'.$Courses_Modules_ModuleID.'-'.$Courses_Modules_Title.'</h4></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
		

$query_Get_Courses_Modules_Segments = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_ModuleVideos.sort, School_Media.id AS VID, School_Media.name, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Courses_Modules_ID' AND type = 'video'
ORDER BY School_ModuleVideos.sort ASC";
$Get_Courses_Modules_Segments = mysqli_query($SMB, $query_Get_Courses_Modules_Segments);
$totalRows_Get_Courses_Modules_Segments = mysqli_num_rows($Get_Courses_Modules_Segments);
if($totalRows_Get_Courses_Modules_Segments > 0){	
	while($row_Get_Courses_Modules_Segments = mysqli_fetch_assoc($Get_Courses_Modules_Segments)){
		$Courses_Modules_Segments_ID = $row_Get_Courses_Modules_Segments['ModuleID'];
		$Courses_Modules_Segments_VID = $row_Get_Courses_Modules_Segments['VID'];
		$Courses_Modules_Segments_Name = $row_Get_Courses_Modules_Segments['name'];


$query_Get_Courses_Modules_Views = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, max(SMBDU_VideoViews.id) as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.mid = '$Courses_Modules_ID' AND SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.vid = '$Courses_Modules_Segments_VID' AND SMBDU_VideoViews.type = 'end'
GROUP BY SMBDU_VideoViews.vid
ORDER BY ID DESC";
$Get_Courses_Modules_Views = mysqli_query($SMB, $query_Get_Courses_Modules_Views);
$totalRows_Get_Courses_Modules_Views = mysqli_num_rows($Get_Courses_Modules_Views);
if($totalRows_Get_Courses_Modules_Views > 0){	
	while($row_Get_Courses_Modules_Views = mysqli_fetch_assoc($Get_Courses_Modules_Views)){
		$Courses_Modules_Views_Type = $row_Get_Courses_Modules_Views['type'];
		
		$Progress = '<img src="https://www.smbdu.com/assets/complete-icon.png" alt="Module Complete" height="30"/>';
		
		}}
		
if($totalRows_Get_Courses_Modules_Views == 0){
	$Progress = '<img src="https://www.smbdu.com/assets/not-complete.png" alt="Module Not Completed" height="30"/>';
}

		
		$Previous_Courses_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>#'.$Courses_Modules_ModuleID.' - '.$Courses_Modules_Segments_Name.'</h6></td>
      <td align="center">'.$Progress.'</td>
	  <td align="center">0 Days Left</td>
    </tr>';
	}}
		
	}}
	
		}
	else {
		$My_Courses_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>No Current Courses</h6></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
		$Previous_Courses_Output .= '<tr>
      <td align="left" height="50"></td>
      <td align="left" valign="middle"><h6>No Previous Courses</h6></td>
      <td align="center"></td>
	  <td align="center"></td>
    </tr>';
	}	
		
}

	$My_Courses_Output .= '</tbody>
</table>';
	
	$Previous_Courses_Output .= '</tbody>
</table>';
}
else {
	$My_Courses_Output .= '';
	$Previous_Courses_Output .= ''; 
}

// All Tests

$query_Test_Courses = "SELECT School_OrdersCart.id, School_OrdersCart.cid, School_OrdersCart.end_date, School_OrdersCart
.product_name, School_OrdersCart.image, School_OrdersCart.CourseID, School_OrdersCart.ModuleID, School_OrdersCart.duration, School_Users.id AS userID, School_Users.degree
FROM School_OrdersCart 
JOIN School_Users
ON School_Users.id = School_OrdersCart.cid
WHERE School_OrdersCart.cid = '$colname_Get_User' AND School_OrdersCart.CourseID > 0
GROUP BY School_OrdersCart.CourseID
ORDER BY School_OrdersCart.end_date DESC";
$Test_Courses = mysqli_query($SMB, $query_Test_Courses);
$totalRows_Test_Courses = mysqli_num_rows($Test_Courses);
if($totalRows_Test_Courses > 0){
	
	$Test_Courses_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="70%" align="left" height="40"><strong>Course/Modules</strong></td>
      <td width="30%" align="center" ><strong>Test Status</strong></td>
    </tr>';
	
	while($row_Test_Courses = mysqli_fetch_assoc($Test_Courses)){
	 $Test_Courses_ID = $row_Test_Courses['id'];
	 $Test_Courses_CID = $row_Test_Courses['cid'];
	 $Test_Courses_ModuleID = $row_Test_Courses['product_name'];
	 $Test_Courses_CourseID = $row_Test_Courses['CourseID'];
	$Test_Courses_degree = $row_Test_Courses['degree'];
if($Test_Courses_degree == 'DDS'){
	$Test_Doctor = 'Y';
}
elseif($Test_Courses_degree == 'DMD'){
	$Test_Doctor = 'Y';
}
else {
	$Test_Doctor = 'N';
}
		
		
// Get Tests

$query_Get_Courses_Test = "SELECT SMBDU_CourseModules.cid, SMBDU_CourseModules.mid, School_Modules.id, School_Modules.title, School_Modules.image, School_Modules.test, School_Modules.CE, School_Modules.ModuleID
FROM SMBDU_CourseModules
INNER JOIN School_Modules
ON SMBDU_CourseModules.mid=School_Modules.id
WHERE SMBDU_CourseModules.cid = '$Test_Courses_CourseID' AND School_Modules.test = '1'
GROUP BY SMBDU_CourseModules.mid
ORDER BY School_Modules.ModuleID ASC";
$Get_Courses_Test = mysqli_query($SMB, $query_Get_Courses_Test);
$totalRows_Get_Courses_Test = mysqli_num_rows($Get_Courses_Test);
if($totalRows_Get_Courses_Test > 0){
			$Test_Courses_Output .= '<tr>      
      <td align="left" valign="middle"><h3>'.$Test_Courses_ModuleID.'</h3></td>
      <td align="center"></td>
    </tr>';
	
	while($row_Get_Courses_Test = mysqli_fetch_assoc($Get_Courses_Test)){
		$Courses_Test_ID = $row_Get_Courses_Test['id'];
		$Courses_Test_Title = $row_Get_Courses_Test['title'];
		$Courses_Test_IMG = $row_Get_Courses_Test['image'];
		$Courses_Test_ModuleID = $row_Get_Courses_Test['ModuleID'];
		$Courses_Test_CE = $row_Get_Courses_Test['CE'];
		$Courses_Test_Test = $row_Get_Courses_Test['test'];
		$Courses_Test_MID = $row_Get_Courses_Test['mid'];
		
$test = array();

$query_Courses_Test_Modules = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_Media.id AS VID, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Courses_Test_ID' AND School_Media.type = 'video'";
$Courses_Test_Modules = mysqli_query($SMB, $query_Courses_Test_Modules);
$totalRows_Courses_Test_Modules = mysqli_num_rows($Courses_Test_Modules);
if($totalRows_Courses_Test_Modules > 0) {
	while($row_Courses_Test_Modules = mysqli_fetch_array($Courses_Test_Modules)){
		   $test[] = $row_Courses_Test_Modules['VID'];

$showTest = implode(',', $test);

$query_Check_Test = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, SMBDU_VideoViews.id as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.type = 'end' AND SMBDU_VideoViews.vid IN($showTest)
GROUP BY SMBDU_VideoViews.vid";
$Check_Test = mysqli_query($SMB, $query_Check_Test);
$totalRows_Check_Test = mysqli_num_rows($Check_Test);
if($totalRows_Check_Test == $totalRows_Courses_Test_Modules){
// Taken Test

$query_All_Taken_Test = "SELECT * FROM SMBDU_UserAnswers WHERE UserID = '$colname_Get_User' AND ModuleID = '$Courses_Test_ID'
GROUP BY ModuleID";
$All_Taken_Test = mysqli_query($SMB, $query_All_Taken_Test);
$totalRows_All_Taken_Test = mysqli_num_rows($All_Taken_Test);

if($totalRows_All_Taken_Test > 0){

$query_All_Test_Passed = "SELECT * FROM SMBDU_CompleteTest WHERE UserID = '$colname_Get_User' AND ModuleID = '$Courses_Test_ID'
GROUP BY ModuleID";
$All_Test_Passed = mysqli_query($SMB, $query_All_Test_Passed);
$totalRows_All_Test_Passed = mysqli_num_rows($All_Test_Passed);
if($totalRows_All_Test_Passed > 0){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/test-complete.png" alt="Passed Test" height="30"/>';
	
}
else {
		$Show_AllTest = '<img src="https://www.smbdu.com/assets/retake-test.png" alt="Module Test" height="30"/>';
}
}
elseif($totalRows_All_Taken_Test == 0 && $Courses_Test_Test == 1 && $Courses_Test_CE == 1 && $Test_Doctor=='Y'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/test-required.png" alt="Module Test" height="30"/>';
	
}
elseif($totalRows_All_Taken_Test == 0 && $Courses_Test_Test == 1 && $Courses_Test_CE == 0 && $Test_Doctor=='Y'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
elseif($totalRows_All_Taken_Test == 0 && $Courses_Test_Test == 1 && $Courses_Test_CE == 0 && $Test_Doctor=='N'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
	elseif($totalRows_All_Taken_Test == 0 && $Courses_Test_Test == 1 && $Courses_Test_CE == 1 && $Test_Doctor=='N'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
elseif($totalRows_All_Taken_Test == 0 && $Courses_Test_Test == 0 && $Courses_Test_CE == 0){
	$Show_AllTest = 'No Test Available';
	
}
else {
		$Show_AllTest = 'No Test Available';
	}

		
		$Test_Courses_Output .= '<tr>      
      <td align="left" valign="middle">#'.$Courses_Test_ModuleID.': '.$Courses_Test_Title.'</td>
      <td align="center">'.$Show_AllTest.'</td>
    </tr>';	

}}
		
}}
}}	
	$Test_Courses_Output .= '</tbody>
</table>';
}
else {

	
	$Test_Courses_Output .= 'No Available Tests';
}

// Module Tests

$query_Test_Modules = "SELECT School_OrdersCart.id, School_OrdersCart.cid, School_OrdersCart.end_date, School_OrdersCart
.product_name, School_OrdersCart.image, School_OrdersCart.CourseID, School_OrdersCart.ModuleID, School_OrdersCart.date, School_OrdersCart.duration, School_Users.id AS userID, School_Users.degree
FROM School_OrdersCart 
JOIN School_Users
ON School_Users.id = School_OrdersCart.cid
WHERE School_OrdersCart.cid = '$colname_Get_User' AND School_OrdersCart.ModuleID > 0
GROUP BY School_OrdersCart.ModuleID
ORDER BY School_OrdersCart.date DESC";
$Test_Modules = mysqli_query($SMB, $query_Test_Modules);
$totalRows_Test_Modules = mysqli_num_rows($Test_Modules);
if($totalRows_Test_Modules > 0){
	
	$Test_Modules_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="70%" align="left" height="40"><strong>MODULES</strong></td>
      <td width="30%" align="center" ><strong>TEST STATUS</strong></td>
    </tr>';
	
	while($row_Test_Modules = mysqli_fetch_assoc($Test_Modules)){
	 $Test_Modules_ID = $row_Test_Modules['id'];
	 $Test_Modules_MID = $row_Test_Modules['ModuleID'];
	 $Test_Modules_Name = $row_Test_Modules['product_name'];
	 $Test_Modules_CourseID = $row_Test_Modules['CourseID'];
	$Test_Modules_degree = $row_Test_Modules['degree'];
if($Test_Modules_degree == 'DDS'){
	$Test_Doctor = 'Y';
}
elseif($Test_Modules_degree == 'DMD'){
	$Test_Doctor = 'Y';
}
elseif($Test_Modules_degree == 'RDH'){
	$Test_Doctor = 'Y';
}
else {
	$Test_Doctor = 'N';
}
		
		
// Get Tests

$query_Get_Modules_Test = "SELECT School_Modules.id, School_Modules.title, School_Modules.image, School_Modules.test, School_Modules.CE, School_Modules.ModuleID
FROM School_Modules
WHERE School_Modules.id = '$Test_Modules_MID' AND School_Modules.test = '1'
ORDER BY School_Modules.ModuleID ASC";
$Get_Modules_Test = mysqli_query($SMB, $query_Get_Modules_Test);
$totalRows_Get_Modules_Test = mysqli_num_rows($Get_Modules_Test);
if($totalRows_Get_Modules_Test > 0){
			$Test_Modules_Output .= '<tr>      
      <td align="left" valign="middle"><h3>'.$Test_Modules_ModuleID.'</h3></td>
      <td align="center"></td>
    </tr>';
	
	while($row_Get_Modules_Test = mysqli_fetch_assoc($Get_Modules_Test)){
		$Modules_Test_ID = $row_Get_Modules_Test['id'];
		$Modules_Test_Title = $row_Get_Modules_Test['title'];
		$Modules_Test_IMG = $row_Get_Modules_Test['image'];
		$Modules_Test_ModuleID = $row_Get_Modules_Test['ModuleID'];
		$Modules_Test_CE = $row_Get_Modules_Test['CE'];
		$Modules_Test_Test = $row_Get_Modules_Test['test'];
		
$test = array();

$query_Modules_Test_Modules = "SELECT School_ModuleVideos.mid AS ModuleID, School_ModuleVideos.vid, School_Media.id AS VID, School_Media.type
FROM School_ModuleVideos
INNER JOIN School_Media
ON School_ModuleVideos.vid=School_Media.id
WHERE School_ModuleVideos.mid = '$Modules_Test_ModuleID' AND School_Media.type = 'video'";
$Modules_Test_Modules = mysqli_query($SMB, $query_Modules_Test_Modules);
$totalRows_Modules_Test_Modules = mysqli_num_rows($Modules_Test_Modules);
if($totalRows_Modules_Test_Modules > 0) {
	while($row_Modules_Test_Modules = mysqli_fetch_array($Modules_Test_Modules)){
		   $test[] = $row_Modules_Test_Modules['VID'];

$showTest = implode(',', $test);

$query_Check_Test = "SELECT SMBDU_VideoViews.mid, SMBDU_VideoViews.vid, SMBDU_VideoViews.userID, SMBDU_VideoViews.id as ID, SMBDU_VideoViews.type
FROM SMBDU_VideoViews
WHERE SMBDU_VideoViews.userID = '$colname_Get_User' AND SMBDU_VideoViews.type = 'end' AND SMBDU_VideoViews.vid IN($showTest)
GROUP BY SMBDU_VideoViews.vid";
$Check_Test = mysqli_query($SMB, $query_Check_Test);
$totalRows_Check_Test = mysqli_num_rows($Check_Test);
if($totalRows_Check_Test == $totalRows_Modules_Test_Modules){
// Taken Test

$query_All_Taken_Test = "SELECT * FROM SMBDU_UserAnswers WHERE UserID = '$colname_Get_User' AND ModuleID = '$Modules_Test_ModuleID'
GROUP BY ModuleID";
$All_Taken_Test = mysqli_query($SMB, $query_All_Taken_Test);
$totalRows_All_Taken_Test = mysqli_num_rows($All_Taken_Test);

if($totalRows_All_Taken_Test > 0){

$query_All_Test_Passed = "SELECT * FROM SMBDU_CompleteTest WHERE UserID = '$colname_Get_User' AND ModuleID = '$Modules_Test_ModuleID'
GROUP BY ModuleID";
$All_Test_Passed = mysqli_query($SMB, $query_All_Test_Passed);
$totalRows_All_Test_Passed = mysqli_num_rows($All_Test_Passed);
if($totalRows_All_Test_Passed > 0){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/test-complete.png" alt="Passed Test" height="30"/>';
	
}
else {
		$Show_AllTest = '<img src="https://www.smbdu.com/assets/retake-test.png" alt="Module Test" height="30"/>';
}
}
elseif($totalRows_All_Taken_Test == 0 && $Modules_Test_Test == 1 && $Modules_Test_CE == 1 && $Test_Doctor=='Y'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/test-required.png" alt="Module Test" height="30"/>';
	
}
elseif($totalRows_All_Taken_Test == 0 && $Modules_Test_Test == 1 && $Modules_Test_CE == 0 && $Test_Doctor=='Y'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
elseif($totalRows_All_Taken_Test == 0 && $Modules_Test_Test == 1 && $Modules_Test_CE == 0 && $Test_Doctor=='N'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
	elseif($totalRows_All_Taken_Test == 0 && $Modules_Test_Test == 1 && $Modules_Test_CE == 1 && $Test_Doctor=='N'){
	$Show_AllTest = '<img src="https://www.smbdu.com/assets/Test-Yourself.png" alt="Module Test" height="30"/>';
	
}
elseif($totalRows_All_Taken_Test == 0 && $Modules_Test_Test == 0 && $Modules_Test_CE == 0){
	$Show_AllTest = 'No Test Available';
	
}
else {
		$Show_AllTest = 'No Test Available';
	}

		
		$Test_Modules_Output .= '<tr>      
      <td align="left" valign="middle">#'.$Modules_Test_ModuleID.': '.$Modules_Test_Title.'</td>
      <td align="center">'.$Show_AllTest.'</td>
    </tr>';	

}}
		
}}
}}	
	$Test_Modules_Output .= '</tbody>
</table>';
}
else {

	
	$Test_Modules_Output .= 'No Available Tests';
}

// CE Certificates for Courses

$query_CE_Courses = "SELECT School_OrdersCart.id, School_OrdersCart.cid, School_OrdersCart.end_date, School_OrdersCart
.product_name, School_OrdersCart.image, School_OrdersCart.CourseID, School_OrdersCart.ModuleID, School_OrdersCart.duration, School_Users.id, School_Users.degree
FROM School_OrdersCart
JOIN School_Users
ON School_Users.id = School_OrdersCart.cid
WHERE School_OrdersCart.cid = '$colname_Get_User' AND School_OrdersCart.CourseID > 0
GROUP BY School_OrdersCart.CourseID
ORDER BY School_OrdersCart.end_date DESC";
$CE_Courses = mysqli_query($SMB, $query_CE_Courses);
$totalRows_CE_Courses = mysqli_num_rows($CE_Courses);
if($totalRows_CE_Courses > 0){	
	$CE_Courses_Output .= '<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tbody>
    <tr>
      <td width="70%" align="left" height="40"><strong>Course/Modules</strong></td>
      <td width="30%" align="center" ><strong>CE Certificate</strong></td>
    </tr>';
	while($row_CE_Courses = mysqli_fetch_assoc($CE_Courses)){
	 $CE_Courses_ID = $row_CE_Courses['id'];
	 $CE_Courses_CID = $row_CE_Courses['cid'];
	 $CE_Courses_ModuleID = $row_CE_Courses['ModuleID'];
	 $CE_Courses_CourseID = $row_CE_Courses['CourseID'];
	 $CE_Courses_Degree = $row_CE_Courses['degree'];
		
	if($CE_Courses_Degree == 'DDS'){
		$CE_Doctor = 'Y';
	}
	elseif($CE_Courses_Degree == 'DMD'){
		$CE_Doctor = 'Y';
	}
	else {
		$CE_Doctor = 'N';
	}
		
// Get Course Name

$query_Course_Name = "SELECT * FROM SMBDU_Courses WHERE id = '$CE_Courses_CourseID'";
$Course_Name = mysqli_query($SMB, $query_Course_Name);
$totalRows_Course_Name = mysqli_num_rows($Course_Name);
if($totalRows_Course_Name > 0){	
	while($row_Course_Name = mysqli_fetch_assoc($Course_Name)){
		$Course_Name_ID = $row_Course_Name['id'];
		$Course_Name_Title = $row_Course_Name['name'];

$CE_Get_Course_Modules = array();		

$query_CE_Module_Array = "SELECT SMBDU_CourseModules.cid, SMBDU_CourseModules.mid, School_Modules.id, School_Modules.CE, School_Modules.test, SMBDU_Courses.id, SMBDU_Courses.name, SMBDU_Courses.CE
FROM SMBDU_CourseModules
JOIN School_Modules
ON School_Modules.id = SMBDU_CourseModules.mid
JOIN SMBDU_Courses
ON SMBDU_CourseModules.cid = SMBDU_Courses.id
WHERE SMBDU_CourseModules.cid = '$CE_Courses_CourseID' AND School_Modules.test > 0 AND School_Modules.CE > 0
GROUP BY SMBDU_CourseModules.mid";
$CE_Module_Array = mysqli_query($SMB, $query_CE_Module_Array);
$totalRows_CE_Module_Array = mysqli_num_rows($CE_Module_Array);
if($totalRows_CE_Module_Array > 0) {
	while($row_CE_Module_Array = mysqli_fetch_array($CE_Module_Array)){
		   $CE_Get_Course_Modules[] = $row_CE_Module_Array['mid'];

	}}

$showCE = implode(',', $CE_Get_Course_Modules);

$query_CE_Check_Test = "SELECT SMBDU_CompleteTest.ModuleID, SMBDU_CompleteTest.UserID
FROM SMBDU_CompleteTest
WHERE SMBDU_CompleteTest.UserID = '$colname_Get_User' AND SMBDU_CompleteTest.ModuleID IN($showCE)";
$CE_Check_Test = mysqli_query($SMB, $query_CE_Check_Test);
$totalRows_CE_Check_Test = mysqli_num_rows($CE_Check_Test);
if(($totalRows_CE_Check_Test > 0) && ($totalRows_CE_Module_Array == $totalRows_CE_Check_Test) && ($CE_Doctor == 'Y')){	
		
	$CE_Courses_Output .= '<tr>      
      <td align="left" valign="middle" height="70">'.$Course_Name_Title.'</td>
      <td align="center" valign="middle"><a href="Course-CE-Certificate.php?cid='.$Course_Name_ID.'" target="blank"><img src="../assets/download-icon.png" alt="Download CE Certificate"/></a></td>
    </tr>';
}
else {
	$CE_Courses_Output = '<tr>      
      <td align="left" valign="middle" height="70">No CE Certificates</td>
      <td align="center" valign="middle"></td>
    </tr>';
	}
		
}}
}}
	$CE_Courses_Output .= '</tbody>
</table>';

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Dashboard</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>


</head>

<body>
<div id="Container">
<div id="Header"><img src="assets/SavvyLogo.png" alt="" height="35" align="absbottom"/>SAVVY SITE DESIGNS
  <div class="HeaderRight">WELCOME, <?php echo $UserName; ?>! <img src="assets/active-user-icon.png" alt="" height="22" align="absbottom"/></div>
</div>
  <?php echo $Nav_Output; ?>
  <div id="ContentCtn">
<div class="ContentHeader"><img src="assets/logo.png" height="75" alt=""/></div>
<div class="pageTitle">
  <h3><img src="assets/users-icon.png" alt="" height="40" align="absmiddle"/> Manage User: <?php echo $row_Manage_User['username']; ?></h3>
</div>
    <div class="Content">
      <div class="container">
        <ul class="tabs">
          <li class="tab-link current" data-tab="tab-1">User Information</li>
          <li class="tab-link" data-tab="tab-2">User Orders</li>
          <li class="tab-link" data-tab="tab-3">User Add On Services</li>
          <li class="tab-link" data-tab="tab-4">User Activity</li>
		  <li class="tab-link" data-tab="tab-5">Delete User</li>
        </ul>
        <div id="tab-1" class="tab-content current">
          <table width="100%" border="0" cellspacing="2" cellpadding="2">
            <tbody>
              <tr>
                <td colspan="2" align="right" valign="middle"><a href="user-edit.php?userID=<?php echo $row_Manage_User['id']; ?>"><img src="assets/edit-user.png" width="177" height="40" alt=""/></a></td>
              </tr>
              <tr>
                <td width="23%" align="left" valign="middle"><strong>Practice:</strong></td>
                <td width="77%" align="left" valign="middle"><?php echo $row_Manage_User['practice']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Dentist:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['Dentist']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>First Name:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['first_name']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Last Name:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['last_name']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Degree:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['degree']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Email Address:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['email_address']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Username:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['username']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Password:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['password']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Phone Number:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['phone_number']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Street Address:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['address']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>City:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['city']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>State:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['state']; ?></td>
              </tr>
              <tr>
                <td align="left" valign="middle"><strong>Zip Code:</strong></td>
                <td align="left" valign="middle"><?php echo $row_Manage_User['zip']; ?></td>
              </tr>
            </tbody>
          </table>
        </div>
        <div id="tab-2" class="tab-content">
          <table width="100%" border="0" cellspacing="2" cellpadding="2">
            <tbody>
              <tr>
                <td align="left" valign="middle"><strong>Date</strong></td>
                <td align="left" valign="middle"><strong>Order ID</strong></td>
                <td align="center" valign="middle"><strong>Amount</strong></td>
                <td align="center" valign="middle"><strong>TransID</strong></td>
                <td align="left" valign="middle">&nbsp;</td>
              </tr>
              <?php echo $Order_Output; ?>
            </tbody>
          </table>
        </div>
        <div id="tab-3" class="tab-content">
          <table width="100%" border="0" cellspacing="2" cellpadding="2">
            <tbody>
              <tr>
                <td align="left" valign="middle"><strong>Date</strong></td>
                <td align="left" valign="middle"><strong>Order ID</strong></td>
                <td align="left" valign="middle"><strong>Service</strong></td>
                <td align="center" valign="middle"><strong>Completed</strong></td>
                <td align="left" valign="middle">&nbsp;</td>
              </tr>
              <?php echo $User_AddOn_Output; ?>
            </tbody>
          </table>
        </div>
        <div id="tab-4" class="tab-content">
          <h2>Active Courses</h2>
    <div class="RedProgress">
        
    <?php echo $My_Courses_Output; ?>
  
        </div>
	<h2>Active Modules</h2>
    <div class="RedProgress">
        
    <?php echo $My_Modules_Output; ?>
  
        </div>
		<h2>Previous Course Purchases</h2>
    <div class="RedProgress">
        
    <?php echo $Previous_Courses_Output; ?>
  
        </div>
	<h2>Previous Module Purchases</h2>
    <div class="RedProgress">
        
    <?php echo $Previous_Modules_Output; ?>
  
        </div>
        </div>
		  <div id="tab-5" class="tab-content">
		    <form action="php/delete.php" method="post" name="form1" id="form1">
		      <table width="100%">
		        <tbody>
		          <tr>
		            <td>Are you sure you want to delete <strong><?php echo $row_Manage_User['username']; ?></strong>?</td>
	              </tr>
		          <tr>
		            <td><input type="submit" name="submit" id="submit" value="Delete User">
	                <input name="user" type="hidden" id="user" value="<?php echo $row_Manage_User['id']; ?>">
	                <input name="Delete" type="hidden" id="Delete" value="User"></td>
	              </tr>
	            </tbody>
	          </table>
	        </form>
		  
		  </div>
      </div>
    </div>
  </div>
</div>
<script>
$(document).ready(function(){
	
	$('ul.tabs li').click(function(){
		var tab_id = $(this).attr('data-tab');

		$('ul.tabs li').removeClass('current');
		$('.tab-content').removeClass('current');

		$(this).addClass('current');
		$("#"+tab_id).addClass('current');
	})

})
 </script>
</body>
</html>
</body>
</html>