include $_SERVER['DOCUMENT_ROOT']."/mysql/connect.php";
$admin_session = $_COOKIE['uId'];
$admin_level = $_COOKIE['uLv'];
$mode = $_GET['mode'];
switch ($mode) {
case "del":
$student_id = $_GET['sid'];
$query = "SELECT level FROM student WHERE student_id = $student_id LIMIT 1";
$result = mysqli_query($conn,$query);
while ($row = mysqli_fetch_array($result)) { $student_level = $row[0]; }
if ($_COOKIE['uLv'] <= $student_level) {
$java_string = "";
} else {
$query_update = "UPDATE student SET hidden = 'H', hiddenBy = $admin_session WHERE student_id = '$student_id' LIMIT 1";
mysqli_query($conn,$query_update);
//현재 반배정이 되어있는 경우 student_roster에서 중도퇴원처리하기
$query = "UPDATE student_roster SET status = '2' WHERE student_id = '$student_id' AND status = '1'";
mysqli_query($conn,$query);
//중도퇴원처리하기 종료
$java_string = "";
}
echo $java_string;
exit;
break;
case "undel":
$student_id = $_GET['sid'];
$query_update = "UPDATE student SET
hidden = 'S'
WHERE student_id = '$student_id' LIMIT 1";
mysqli_query($conn,$query_update);
$url = "/admin/member_list.php";
break;
case "permission":
$student_id = $_GET['sid'];
$query_update = "UPDATE student SET status = 1 WHERE student_id = $student_id LIMIT 1";
mysqli_query($conn,$query_update);
$url = "/admin/member_status0.php";
break;
case "pw_reset":
$student_id = $_GET['sid'];
$query_update = "UPDATE student SET pw = parent_phone3 WHERE student_id = $student_id LIMIT 1";
mysqli_query($conn,$query_update);
$url = "/admin/member_list.php";
break;
case "modify_date":
$roster_idx = $_GET['roster_idx'];
$expired = $_GET['expired'];
$query_update = "UPDATE student_roster SET expired = CAST('".$expired."' AS DATE) WHERE idx = $roster_idx LIMIT 1";
mysqli_query($conn,$query_update);
$url = "/admin/member_list.php";
break;
}
header("location:$url");
?>