public function list_courses() { $courses = $this->CoursesService->get_all_courses(); $courses_count = count($courses); echo "<option value='-1' >" . "" . "</option>"; for ($i = 0; $i < $courses_count; $i++) { $hashed_course_id_local = hash_val($courses[$i]->get_course_id()); echo "<option value= {$hashed_course_id_local} >" . $courses[$i]->get_course_name() . "</option>"; } }
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(); ?> </div></a></h3> <?php } ?> </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="js/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script>
<?php include_once 'service/MaterialsService.php'; include_once 'function.php'; session_start(); $MaterialsService = unserialize($_SESSION['material_service']); $file_name = urldecode($_GET['file']); $section_id = $_GET['section_id']; $MaterialsService->delete_material($file_name, $section_id); $course_id = $MaterialsService->get_course_id(); header('location:course_materials.php?course=' . hash_val($course_id));
public function select_user($user_id, $user_password) { $this->openDb(); $user_rec = mysql_query("SELECT * FROM " . $this->user_table . " where user_id = '{$user_id}' and user_password=md5('{$user_password}');") or die('<span class="error_span"><u>MySQL error:</u> ' . htmlspecialchars(mysql_error()) . '</span>'); if (mysql_num_rows($user_rec) == 1) { $user = mysql_fetch_object($user_rec); $_SESSION['user_id'] = $user->user_id; $_SESSION['user_name'] = $user->user_name; $_SESSION['current_user_type'] = hash_val($user->user_type); $_SESSION['change_password'] = $user->change_password; $_SESSION['change_old_password'] = -1; echo $_SESSION['current_user_type']; return 1; } else { return 0; } $this->closeDb(); }