Mercurial > hg > fapweb
changeset 92:8efda89e765a
Removed obsolete file, this is moving to AJAX.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Oct 2013 20:25:40 +0300 |
parents | b58a36f4821e |
children | f36ebd03afd6 |
files | vsubmit.php |
diffstat | 1 files changed, 0 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/vsubmit.php Fri Oct 18 15:51:56 2013 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -<? -$sessionType = "vote"; -require "mconfig.inc.php"; -require "msite.inc.php"; - -function stSubmitVotes($voter_id) -{ - foreach ($compos as $id => $compo) - foreach ($compo["entries"] as $eid => $entry) - { - $vote = stGetRequestItem("entry".$eid); - $sql = stPrepareSQL("SELECT id FROM votes WHERE voter_id=%d AND entry_id=%d", - $voter_id, $eid); - - if (($res = stFetchSQLColumn($sql)) === false) - { - $sql = stPrepareSQL( - "INSERT INTO votes (voter_id,entry_id,value) VALUES (%d,%d,%d)", - $voter_id, $eid, $vote); - - if (stExecSQL($sql) === false) - return FALSE; - } - else - { - $sql = stPrepareSQL( - "UPDATE votes SET value=%d WHERE voter_id=%d AND entry_id=%d", - $vote, $voter_id, $eid); - - if (stExecSQL($sql) === false) - return FALSE; - } - } - return TRUE; -} - - -// -// Start of the main code -// -if (stStartSubmitSession("allowVoting", $sessionType)) -{ - // Vote submission - if (!$errorSet && $mode == "vote") - { - stSetSessionStatus(1); - stGetCompoList(FALSE); - - // Check the submitted vote values - foreach ($compos as $id => $compo) - foreach ($compo["entries"] as $eid => $entry) - { - $name = "entry".$eid; - $vote = stGetRequestItem($name); - if (!$errorSet && ($vote < stGetSetting("voteMin") || $vote > stGetSetting("voteMax"))) - { - stError("One or more vote value was out of bounds. Trying to cheat, eh?"); - $vote = 0; - } - stSetSessionItem($name, $vote); - } - - if (!$errorSet) - { - if (stSubmitVotes($user["id"])) - stSetSessionStatus(2); - } - } - - stEndSubmitSession($sessionType); -} - -?> \ No newline at end of file