-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_final.php
51 lines (40 loc) · 1.56 KB
/
update_final.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
<!--
File Name: update_final.php
Author's Name: Sukhdeep Singh, Nav Bhullar
Web Site Name: Tourney Bracket
File Description: This page takes the input from the final.php page and makes the updation to the database
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Update Final Winners</title>
<link href="css/bootstrap.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
<div class="container">
<?php
//access current session
session_start();
//evaluate the user_id stored in the session that was set on validate.php
if (empty($_SESSION['user_id'])) {
header('Location:index.php');
} else {
$conn = mysqli_connect('webdesign4', 'dbxxxxxxxxx', 'xxxxx', 'dbxxxxxxxxx') or die('Error connecting to MySQL server');
$winner = $_POST['winner'];
$id = $_POST['id'];
$conn = mysqli_connect('webdesign4', 'dbxxxxxxxxx', 'xxxxx', 'dbxxxxxxxxx') or die('Error connecting to MySQL server');
$query = 'UPDATE tournaments SET winner = "'.$winner.'" WHERE id = "'.$id.'"';
mysqli_query($conn, $query) or die('Error querying database.');
mysqli_close($conn);
echo '<div class="alert alert-success alert-dismissable">';
echo '<strong>Tournament Successfully Updated!</strong>';
echo '</div>';
echo '<a href="tournament.php" class="btn btn-success btn-lg " role="button">View Tournament</a></p>';
}
?>
</div>
</body>
</html>