about summary refs log tree commit diff stats
path: root/series/trunk/admin/deletesub.php
blob: 37b0bee4f74ae3619990d994d0887f67d3b365b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php

/* InstaDisc Series - A Four Island Project */

/** 
 * require_once() is used to ensure
 * the ACP files are being called by
 * admin.php instead of their actual
 * locations admin/.
 * The _once() part ensures no problem
 * arises as includes/instadisc.php has
 * already been included from admin.php
 */
require_once('includes/instadisc.php');

if (!isset($_SESSION['username']))
{
	header('Location: index.php');
}

if (!instaDisc_isAdmin($_SESSION['username']))
{
	$subs = instaDisc_listSubscriptions($_SESSION['username']);
	$i=0;
	$notfound=1;
	for ($i=0;isset($subs[$i]);$i++)
	{
		if (!isset($_GET['submit']))
		{
			if ($subs[$i]['identity'] == $_POST['id'])
			{
				$notfound=0;
			}
		} else {
			if ($subs[$i]['id'] == $_GET['subid'])
			{
				$notfound=0;
			}
		}
	}

	if ($notfound == 1)
	{
		header('Location: index.php');
		exit;
	}
}

if (!isset($_GET['submit']))
{
	$template = new FITemplate('deletesub');
	$template->add('SITENAME',instaDisc_getConfig('siteName'));
	$template->add('ID',$_GET['subid']);

	$sub = instaDisc_getSubscription($_GET['subid']);
	$template->add('IDENTITY',$sub['identity']);
	$template->display();
} else {
	if ($_POST['submit'] == 'Yes')
	{
		instaDisc_deleteSubscription($_POST['id']);
		
		$template = new FITemplate('deletedsub');
		$template->display();
	} else {
		header('Location: admin.php?id=main');
	}
}

?>