Location: PHPKode > projects > ACollab > forums/thread_subscribe.php
<?php
/****************************************************************/
/* ATutor														*/
/****************************************************************/
/* Copyright (c) 2002-2004 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.				*/
/****************************************************************/

define('AC_INCLUDE_PATH', '../include/');

require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_CLIENT, USER_GROUP_ADMIN, USER_ADMIN);

$fid = intval($_REQUEST['fid']);
$pid = intval($_REQUEST['pid']);

if ($_GET['us']) {
	$sql	= "UPDATE ".TABLE_PREFIX."forums_threads SET subscribers=REPLACE(subscribers, '$_SESSION[member_id],', '') WHERE post_id=$pid";
	$result = mysql_query($sql, $db);
} else {
	$sql	= "UPDATE ".TABLE_PREFIX."forums_threads SET subscribers=CONCAT(subscribers, '$_SESSION[member_id],') WHERE post_id=$pid";
	mysql_query($sql, $db);
}

$_SESSION['show_feedback'] = $_SERVER['PHP_SELF'];

if($_REQUEST['t']) {
	$this_pid = 'forum.php?fid='.$fid;
} else{
	$this_pid = 'view.php?fid='.$fid.SEP.'pid='.$pid;
}

if ($_GET['us'] == '1') {
	header('Location: '.$_base_href.'forums/'.$this_pid.SEP.'f='.F_THREAD_UNSUBCRIBED);
	exit;
}

/* else: */
	header('Location: '.$_base_href.'forums/'.$this_pid.SEP.'f='.F_THREAD_SUBCRIBED);
	exit;

?>
Return current item: ACollab