diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-18 12:07:29 +0200 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-18 12:07:29 +0200 |
commit | a565e649898c629874ef812a13806b1c384f68e4 (patch) | |
tree | afc03ed12ec7e82ce17bcfff5ba76440ff43eb97 /lib/study/deckrm.php | |
parent | 8d9321225140a3db0b72796d4d0236d6cacfeb8a (diff) | |
download | Bits-a565e649898c629874ef812a13806b1c384f68e4.tar.gz Bits-a565e649898c629874ef812a13806b1c384f68e4.zip |
Added study program. Yay!
Diffstat (limited to 'lib/study/deckrm.php')
-rw-r--r-- | lib/study/deckrm.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/study/deckrm.php b/lib/study/deckrm.php new file mode 100644 index 0000000..6b4e803 --- /dev/null +++ b/lib/study/deckrm.php @@ -0,0 +1,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(); |