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/setrate.php | |
parent | 8d9321225140a3db0b72796d4d0236d6cacfeb8a (diff) | |
download | Bits-a565e649898c629874ef812a13806b1c384f68e4.tar.gz Bits-a565e649898c629874ef812a13806b1c384f68e4.zip |
Added study program. Yay!
Diffstat (limited to 'lib/study/setrate.php')
-rw-r--r-- | lib/study/setrate.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/study/setrate.php b/lib/study/setrate.php new file mode 100644 index 0000000..f893eb9 --- /dev/null +++ b/lib/study/setrate.php @@ -0,0 +1,19 @@ +<?php + +assert_redir(count($args) >= 3, 'study'); +$studyid = intval($args[2]); + +$study = mysql_fetch_assoc(sql( + "SELECT decks.id AS deckid, decks.name AS deckname, account.login AS deckowner, ". + " deck_study.learn_rate AS learn_rate, deck_study.user AS learn_user ". + "FROM deck_study LEFT JOIN decks ON deck_study.deck = decks.id LEFT JOIN account ON account.id = decks.owner ". + "WHERE deck_study.id = $studyid")); +assert_error($study && $study['learn_user'] == $user['id'], "You are not at the right place here."); + +if (isset($args[3]) && ($rate = intval($args[3])) > 0) { + sql("UPDATE deck_study SET learn_rate = $rate WHERE id = $studyid"); + header("Location: deck-study-$studyid"); + die(); +} + +include ("tpl/study/setrate.php"); |