-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtoggle_tournament.php
41 lines (33 loc) · 1.21 KB
/
toggle_tournament.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
<!--
File Name: toggle_tournament.php
Author's Name: Sukhdeep Singh, Nav Bhullar
Web Site Name: Tourney Bracket
File Description: This page takes the input from the Modify.php page and toggles the tournament to hidden or visible and redirects back to the Modify.php page
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Toggle Tournament</title>
</head>
<body>
<?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');
$visible = $_POST['visible'];
$id = $_POST['id'];
$conn = mysqli_connect('webdesign4', 'dbxxxxxxxxx', 'xxxxx', 'dbxxxxxxxxx') or die('Error connecting to MySQL server');
$query = 'UPDATE tournaments SET visible = "'.$visible.'" WHERE id = "'.$id.'"';
mysqli_query($conn, $query) or die('Error querying database.');
mysqli_close($conn);
header('Location: Modify.php?id='.$id);
}
?>
</div>
</body>
</html>