Changeset 70 for trunk/action.php
- Timestamp:
- Feb 6, 2009, 9:20:10 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r67 r70 84 84 } 85 85 86 if($Action == 'vote')87 {88 $TextID = $_GET['ID'];89 $vote = $_GET['vote'];90 $IDuser = $_SESSION['UserID'];91 92 if(($vote > 5) OR ($vote < 1)) die('špatná známka');93 94 $Line = mysql_fetch_row($Database->SQLCommand('SELECT * FROM '.$Table.'_vote WHERE IDuser = '.$IDuser.' AND TextId = '.$TextID));95 if((!$Line) and (Licence(LICENCE_USER)))96 {97 $Line = mysql_fetch_array($Database->SQLCommand('SELECT Vote,CountVote FROM '.$Table.' WHERE ID='.$TextID));98 $CountVote = $Line['CountVote'] + 1;99 $OldVote = $Line['Vote'] * $Line['CountVote'];100 $NewVote = ($OldVote + $vote) / $CountVote;101 102 $Database->SQLCommand('UPDATE '.$Table.' SET Vote = '.$NewVote.', CountVote = '.$CountVote.' WHERE ID = '.$TextID);103 104 $Database->SQLCommand('INSERT INTO `'.$Table.'_vote` ( `TextId` , `IDuser` , `vote` ) VALUES ( '.$TextID.', '.$IDuser.', '.$vote.')');105 echo('Hlas byl uložen! Hlasoval jste: '.$vote.'<br /> Nyní je známka překladu '.$NewVote);106 107 WriteLog('Uživatel hlasoval: '.$vote.'! Nyní je známka překladu (<a href="form.php?group='.$GroupID.'&ID='.$TextID.'">'.$TextID.'</a>): '.$NewVote, 5);108 } else echo('Již jste hlasoval nebo nemůžete hlasovat!');109 }110 111 86 ShowFooter(); 112 87
Note:
See TracChangeset
for help on using the changeset viewer.