<?php include_once 'function.php'; include_once 'service/CoursesController.php'; include_once 'service/UsersCoursesController.php'; include_once 'model/constantss_ui.php'; include_once 'model/constantss.php'; session_start(); if (validate_session_time_out() == 0) { header("Location:login.php"); exit; } if ($_SESSION['change_password'] == 0) { header("Location:change_password.php"); exit; } if (un_hash_val($_SESSION['current_user_type']) != constantss::$user_type_admin) { header("Location:main_page.php"); exit; } if (isset($_SESSION['course'])) { $hashed_course_id = $_SESSION['course']; } else { $hashed_course_id = -1; } if (isset($_SESSION['user_type'])) { $hashed_user_type = $_SESSION['user_type']; } else { $hashed_user_type = -1; } $CoursesController = new CoursesController(); $UsersCoursesController = new UsersCoursesController();
<br> <?php include 'header.php'; ?> <br> <br> <div class="container"> <div class="center_class"> <div class="well"> <h3> Hi, <?php echo $_SESSION['user_name'] . "..."; ?> Theses are courses you <?php if (un_hash_val($_SESSION['current_user_type']) == constantss::$user_type_instructor) { echo "teaches"; } else { echo "have enrolled in"; } ?> </h3></div> </div> <div class="list-group center_class" > <?php foreach ($courses as $course) { ?> <h3> <a href= <?php echo "\"course_materials.php?course=" . hash_val($course->get_course_id()) . "\""; ?> class="list-group-item"><div class="bg-primary"><?php echo $course->get_course_name();
public function remove_user($arr) { if ($this->hashed_course_id == -1) { return; } $unhashed_course_id = un_hash_val($this->hashed_course_id); $this->openDb(); $arr_count = count($arr); for ($i = 0; $i < $arr_count; $i++) { //echo "delete from users_courses where user_id=$arr[$i] and course_id=$unhashed_course_id;" . "<br>"; mysql_query("delete from users_courses where user_id='{$arr[$i]}' and course_id={$unhashed_course_id};") or die('<span class="error_span"><u>MySQL error:</u> ' . htmlspecialchars(mysql_error()) . '</span>'); } $this->closeDb(); }