session_start();
header("Cache-control: private"); //IE 6 Fix 
error_reporting(E_ALL ^ E_NOTICE);
$MCID = $_GET['MCID'];
$_SESSION['McMember_MCID'] = "";
$_SESSION['McMember_MCID'] = $MCID;
$theSelectedSort = $_GET['SO'];
// echo $theSelectedSort;
function GetSortOrder($theSelectedColumn){
	
	switch ( $theSelectedColumn ) 
    { 
    case "1": 
    	 // echo "test case 1";
      $MSO = " ORDER BY mem.FirstName"; 
      // echo $MSO;
      break; 
    case "2": 
      $MSO = " ORDER BY mem.LastName"; 
      break; 
    case "3": 
      $MSO = " ORDER BY mem.Phone_Display"; 
      break; 
    case "4": 
      $MSO = " ORDER BY mem.Email"; 
      break; 
      
    case "5": 
      $MSO = " ORDER BY mem.MemType"; 
      break; 
      
    case "6": 
      $MSO = " ORDER BY mem.MemStatus"; 
      break;       
      
    case "7": 
      $MSO = " ORDER BY mem.MemberSince"; 
      break;  
      
    case "8": 
      $MSO = " ORDER BY mem.Birthdate"; 
      break;        
    default: 
      $MSO = " ORDER BY mem.LastName"; 
      break; 
    } 
    return $MSO;
}
if ($theSelectedSort){
	$MSOFinal = GetSortOrder($theSelectedSort);
}
else{
	$MSOFinal = " ORDER BY mem.LastName"; 
}
if($_SESSION['McMember_OrgId']){ 
	// everything is alright
}else{
	// something has gone wrong, the org id cant be located
	$_SESSION['McMember_FailureReason'] = "UnableToLocateOrgId";
	header("location: Login.php");
}
?>
	
if (!empty($_SESSION['ValidateMessage'])){
	$theDisplayMessage = $_SESSION['ValidateMessage'];
	$_SESSION['ValidateMessage'] = "";
	print "
";
	print " 
";
	print "";
	print"| ";
	print "".$theDisplayMessage."";	
	print "";
	print " | 
";
	print "
";	
}
Else{
switch($MCID){
	
	case 2 :
		include "EditMembers.php";
		break;
		
	case 3 :
		include "SearchMembers.php";
		break;
		
	case 4 :
		include "ImageMembers.php";
		break;
		
	case 5 :
		include "PermissionMembers.php";
		break;		
		
	default:
		break;
	} // END SWITCH
} // END ELSE
?>