-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathajax.php
53 lines (50 loc) · 1.48 KB
/
ajax.php
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
<?php
include("connect.php");
include("update.php");
//This is called when a user enters a tipp
if($_GET['fn'] == "tipp") {
if(isset($_GET['spiel'])) {
$id = $_GET['spiel'];
$team = $_GET['team'];
$uid = $_GET['uid'];
$tippid = $_GET['tid'];
if($tippid != 0) {
$eintrag = "UPDATE tipp SET team='$team' WHERE id = '$tippid'";
$update = mysql_query($eintrag);
echo $tippid;
} else {
$eintrag = "INSERT INTO tipp (user,id_sp,team) VALUES ('$uid','$id','$team')";
$update = mysql_query($eintrag);
$abfrage = "SELECT * FROM tipp WHERE user = '$uid' AND id_sp = '$id'";
$erg = mysql_query($abfrage) or die(mysql_error());
while($row = mysql_fetch_array($erg, MYSQL_ASSOC)){
echo $row['id'];
}
}
}
} elseif($_GET['fn'] == "win") { //This is called when the admin enters a winner
if(isset($_GET['spiel'])) {
$id = $_GET['spiel'];
$team = $_GET['team'];
$eintrag = "UPDATE spiele SET wt='$team' WHERE id = '$id'";
$update = mysql_query($eintrag);
}
} elseif($_GET['fn'] == "spoiler") {
if(isset($_GET['user'])) {
$id = $_GET['user'];
$spoiler = $_GET['spoiler'];
if($_GET['which'] == 0) {
$_SESSION['spoiler'] = $spoiler;
$eintrag = "UPDATE user SET spoiler='$spoiler' WHERE id = '$id'";
} elseif($_GET['which'] == 1) {
$_SESSION['theme'] = $spoiler;
$eintrag = "UPDATE user SET theme='$spoiler' WHERE id = '$id'";
}
$update = mysql_query($eintrag);
}
} elseif($_GET['fn'] == "update") {
if(update() == 1) {
echo "update";
}
}
?>