Changeset 210 for quests/action.php
- Timestamp:
- Jan 12, 2008, 12:24:07 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quests/action.php
r208 r210 20 20 $IDuser = $_SESSION['UserID']; 21 21 22 if ($vote <> 1 and $vote <> -1 and Licence(1) == False) die('');22 // if (Licence(0)) die('Hlasovat mùou jenom registrovaní!'); 23 23 24 24 25 $Line = mysql_fetch_row($Database->SQLCommand("SELECT * FROM vote WHERE IDuser = '$IDuser' AND ID = '$questID'")); 26 if (!$Line) { 27 28 $Line = mysql_fetch_array($Database->SQLCommand("SELECT Vote FROM quests WHERE ID = '$questID'")); 25 $Line = mysql_fetch_row($Database->SQLCommand("SELECT * FROM vote WHERE IDuser = '$IDuser' AND IDquest = '$questID'")); 26 if (!$Line) { 27 $Line = mysql_fetch_array($Database->SQLCommand("SELECT Vote,CountVote FROM quests WHERE ID = '$questID'")); 28 $CountVote = $Line['CountVote']+1; 29 $OldVote = $Line['Vote']*$Line['CountVote']; 30 $NewVote = ($OldVote+$vote)/$CountVote; 29 31 30 $vote = $Line['Vote']+$vote;32 echo $NewVote; 31 33 32 $Database->SQLCommand("UPDATE quests SET Vote = '$ vote' WHERE ID = '$questID'");34 $Database->SQLCommand("UPDATE quests SET Vote = '$NewVote', CountVote = '$CountVote' WHERE ID = '$questID'"); 33 35 34 36 $Database->SQLCommand("INSERT INTO `vote` ( `IDquest` , `IDuser` , `vote` ) VALUES ( '$questID', '$IDuser', '$vote');");
Note:
See TracChangeset
for help on using the changeset viewer.