2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
15 $_user_location = 'users';
16 define('AT_INCLUDE_PATH', '../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
19 if (isset($_POST['submit_no'])) {
20 $msg->addFeedback('CANCELLED');
21 header('Location: index.php');
23 } else if (isset($_POST['submit_yes'])) {
24 $course = intval($_POST['course']);
25 if ($system_courses[$course]['member_id'] != $_SESSION['member_id']) {
26 $sql = "DELETE FROM ".TABLE_PREFIX."course_enrollment WHERE member_id=$_SESSION[member_id] AND course_id=$course";
27 $result = mysql_query($sql, $db) or die(mysql_error());
29 // Unsubscribe from forums and threads of the course
30 $sql = "DELETE FROM ".TABLE_PREFIX."forums_subscriptions
31 WHERE forum_id IN (SELECT forum_id FROM ".TABLE_PREFIX."forums_courses WHERE course_id=$course)
32 AND member_id=".$_SESSION[member_id];
33 $result = mysql_query($sql, $db) or die(mysql_error());
35 $sql = "UPDATE ".TABLE_PREFIX."forums_accessed
37 WHERE post_id IN (SELECT distinct t.post_id FROM ".TABLE_PREFIX."forums_courses c, ".TABLE_PREFIX."forums_threads t WHERE c.course_id=$course)
38 AND member_id=".$_SESSION[member_id];
39 $result = mysql_query($sql, $db) or die(mysql_error());
41 $msg->addFeedback('COURSE_REMOVED');
43 header("Location: ".AT_BASE_HREF."users/index.php");
47 require(AT_INCLUDE_PATH.'header.inc.php');
50 $hidden_vars['course'] = $_GET['course'];
51 $msg->addConfirm(array('UNENROLL', $system_courses[$_GET['course']]['title']), $hidden_vars);
55 require(AT_INCLUDE_PATH.'footer.inc.php');