<?php
/**************************************************************************************************
|
| iDocScript - Document Sharing Script
| http://www.idocscript.com
| webmaster@idocscript.com
|
|**************************************************************************************************
|
| By using this software you agree that you have read and acknowledged our End-User License 
| Agreement available at http://www.idocscript.com/eula.html and to be bound by it.
|
| Copyright (c) 2011 iDocScript.com. All rights reserved.
|**************************************************************************************************/
include("include/config.php");
include("include/functions/import.php");

$did = intval($_REQUEST['did']);
$add = cleanit($_REQUEST['add']);
$rem = cleanit($_REQUEST['rem']);
$USERID = intval($_SESSION['USERID']);

if ($did > 0 && is_numeric($did))
{
	if($USERID > 0 && is_numeric($USERID))
	{
		if($add == "1")
		{
			$query = "insert into members_subscribers set subscribee='".mysql_real_escape_string($USERID)."', subscriber='".mysql_real_escape_string($did)."'";
			$conn->execute($query);
		}
		elseif($rem == "1")
		{
			$query = "delete from members_subscribers WHERE subscribee='".mysql_real_escape_string($USERID)."' AND subscriber='".mysql_real_escape_string($did)."'";
			$conn->execute($query);
		}
	}
}
?>