summaryrefslogtreecommitdiff
path: root/lib/study/deckrm.php
blob: 6b4e803f78b318080f3d45db06ee36a0e5c21ec3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

assert_redir(count($args) >= 3, 'study');
$studyid = intval($args[2]);

$study = mysql_fetch_assoc(sql(
	"SELECT ".
	" deck_study.user AS learn_user ".
	"FROM deck_study ".
	"WHERE deck_study.id = $studyid"));
assert_error($study && $study['learn_user'] == $user['id'], "You are not at the right place here.");

token_validate("Do you really want to remove this deck from your studies ? ALL YOUR PROGRESS WILL BE LOST!", "deck-study-$studyid");
sql("DELETE FROM card_study WHERE deck_study = $studyid");
sql("DELETE FROM deck_study WHERE id = $studyid");
header("Location: study");
die();