<?php
/****************************************************************/
/* ATutor */
/****************************************************************/
/* Copyright (c) 2002-2003 by Greg Gay & Joel Kronenberg */
/* Adaptive Technology Resource Centre / University of Toronto */
/* http://atutor.ca */
/* */
/* This program is free software. You can redistribute it and/or*/
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation. */
/****************************************************************/
// $Id: index.php 2526 2004-11-25 18:54:16Z greg$
define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
$fid = intval($_REQUEST['fid']);
// check if they have access
$sql = "SELECT title FROM ".TABLE_PREFIX."forums WHERE group_id = $_SESSION[group_id]";
$result = mysql_query($sql, $db);
if (mysql_num_rows($result) == 0) {
//ohoh this forum is not supposed to be viewed by the group you are enrolled in!
Header('Location: ./index.php');
exit;
}
$_SESSION['show_feedback'] = $_SERVER['PHP_SELF'];
if ($_GET['us']) {
$sql = "DELETE FROM ".TABLE_PREFIX."forums_subscriptions WHERE forum_id = $fid AND member_id = $_SESSION[member_id]";
$result = mysql_query($sql, $db);
Header('Location: ./index.php?f='.F_FORUM_UNSUBSCRIBED);
exit;
} else {
$sql = "INSERT INTO ".TABLE_PREFIX."forums_subscriptions VALUES ($fid, '$_SESSION[member_id]')";
mysql_query($sql, $db);
Header('Location: ./index.php?f='.F_FORUM_SUBSCRIBED);
exit;
}
?>