1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<?php /* $Id: vote.php,v 1.1.1.1 2002/10/28 19:13:48 pbaecher Exp $ */ /* ThWboard - PHP/MySQL Bulletin Board System ============================================== (c) 2000, 2001 by Paul Baecher <paul@thewall.de> Felix Gonschorek <funner@thewall.de>
download the latest version: http://www.thwboard.de
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
==============================================
*/
include "./inc/header.inc.php";
if( !ENABLE_VOTING ) { message("Fehler","Diese Funktion wurde vom Administrator deaktiviert."); }
if( !$user[id] ) { message("Fehler","Um andere Benutzer bewerten zu können müssen Sie sich registrieren."); }
if( !$id ) { message("Fehler","Sie müssen einen Benutzer angeben."); }
if( $id==$user[id] ) { message("Fehler","Sie können sich nicht selbst bewerten."); }
$result=thwb_query("SELECT name, rating, votes FROM users WHERE id=".$id.";"); if( mysql_num_rows($result)<1 ) { message("Fehler","Der gewünschte User existiert nicht."); } $target=mysql_fetch_array($result);
$result=thwb_query("SELECT voteid FROM ratings WHERE fromid=".$user[id]." AND toid=".$id.";"); if( mysql_num_rows($result)>=1 ) { message("Fehler","Sie haben diesen Benutzer bereits bewertet."); }
if( $rating ) { // rating exec code here if( $rating < 10 || $rating > 100 ) { message("Tststs","Nanana wir wollen doch wohl nicht unfair werden?!"); }
$target[rating]=$target[rating]*$target[votes]+$rating; $target[votes]++; $target[rating]=intval($target[rating]/$target[votes]);
thwb_query("UPDATE users SET votes=".$target[votes]."., rating=".$target[rating].". WHERE id=".$id.";"); thwb_query("INSERT INTO ratings (time, fromid, toid, rating) VALUES (".time().", ".$user[id].", ".$id.", ".$rating.");");
message("Benutzer bewertet","Der Benutzer wurde bewertet. Vielen Dank für Ihre Bewertung.");
} else { $TMain= new Template("templates/" . $style['styletemplate'] . "/frame.html"); $TVoteform= new Template("templates/" . $style['styletemplate'] . "/vote.html");
eval($TVoteform->GetTemplate("CONTENT")); eval($TMain->GetTemplate()); } ?>
|