forked from ashishsc/GameNightWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·172 lines (153 loc) · 5.39 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
error_reporting(E_ALL);
ini_set( 'display_errors','1');
$STEAM_BASE_ID = "#BASE_ID_GOES_HERE";
$IP = $_SERVER['REMOTE_ADDR'];
$STEAM_DATA = "steam.json";
$PASSWORD = "#PASSWORD_GOES_HERE";
$QUARTER = "#CURRENT_QUARTER";
if(isset($_GET['#VARIABLE']) && $_GET['#VARIABLE'] == "#CODEWORD"){
$file = fopen($STEAM_DATA,'w+');
fwrite($file, "[]");
fclose($file);
$reset = true;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>IUGA Game Night</title>
<meta charset="UTF-8">
<!-- Bootstrap --><link href="bootstrap.min.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div id="head" class="oneup">
<audio src="1up.mp3" preload="auto"></audio>
<img src="head.png">
</div>
<div class="centered">
<div id="countdown">
<h1>IUGA Game Night: <?= $QUARTER?></h1>
<h5>Using IP: <?=$IP ?></h5>
<div class="message">
<?php
if(isset($reset) && $reset){
echo '<h2 class="alert alert-danger">Data Reset</h2>';
}
if(isset($_GET['newid'])){
//Check for stored IP
//Output new ID if it doesn't exist or old id if it does
$json_data = file_get_contents($STEAM_DATA);
$json = json_decode($json_data, true);
$uid = getSteamID($json, $IP);
if(!$uid){
//Create a new ID
$uid = array_push($json, $IP);
$file = fopen($STEAM_DATA,'w+');
fwrite($file, json_encode($json));
fclose($file);
}
$steamid = $STEAM_BASE_ID . $uid;
?>
<p>
<strong>Steam ID:</strong> <?= $steamid ?><br>
<strong>Steam Pass:</strong> <?= $PASSWORD ?>
</p>
<!-- -login %u %p -->
<a class="well" href='http://store.steampowered.com/about/?snr=1_4_4__11'>Download Steam!</a>
<h4>Play some steam games!</h4>
<ul>
<li>Team Fortress 2</li>
<li>Counterstrike: Global Offensive</li>
<ul>
<li>From the CSGO main menu go to OPTIONS, GAME SETTINGS and select ENABLE DEVELOPER CONSOLE</li>
<li>open console with ~ and type connect iuga.info</li>
</ul>
<li>Dota 2</li>
</ul>
<h4> IUGA Official Servers</h4>
<strong>Access the IUGA server and play together@ url = iuga.info </strong>
<ul>
<li>Minecraft (Must either boot into OSX mode, or go down in to IPLC)</li>
<li>Counterstrike: Global Offensive</li>
<li>And more!</li>
</ul>
<p>To play, simply download the game in Steam after entering your
tournament license and the game should load up</p>
<!-- For when Distribution Scripts start working again:
<h4>These computers have the following games already installed:</h4>
<ul>
<li>Team Fortress 2</li>
<li>Counterstrike: Global Offensive</li>
<li>Dota 2</li>
</ul>
<p>To load, simply download the game in Steam after entering your
tournament license and the game should load up.</p> -->
<?php
}else{
?>
<p>Welcome! Let's play some games!</p>
<p>Download <a href="http://store.steampowered.com/">steam</a> and login!</p>
<!-- Inserts links to social pages here -->
<a class="well" href="?newid">Get Steam ID</a>
<a class="well" href="http://ischool.uw.edu/academics/informatics" target="_blank">Learn about Informatics</a>
<?php } ?>
</div>
</div>
</div>
<div id="games">
<img src="games.png">
</div>
<div class="navbar navbar-fixed-bottom">
<div class="navbar-inner container">
<a class="brand" href="/">IUGA</a>
<ul class="nav pull-right">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Feedback</a>
<ul class="dropdown-menu">
<li><a href="https://www.facebook.com/events/436747423108702/" target="_blank">Facebook Event</a></li>
<li><a href="https://www.facebook.com/groups/info.uw/" target="_blank">IUGA Group</a></li>
<li class="divider"></li>
<li class="disabled"><a href="#"><strong>Evan Cohen</strong></a></li>
<li><a href="mailto:evanc3@uw.edu">evanc3@uw.edu</a></li>
<li><a href="tel:15108624733">1 (510) 862-4733</a></li>
<li class="divider"></li>
<li class="disabled"><a href="#"><strong>Ashish Chandwani</strong></a></li>
<li><a href="mailto:evanc3@uw.edu">ashishsc@uw.edu</a></li>
<li><a href="tel:4252103873">1 (425) 210-3873</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div><!-- /.container -->
<script src="jquery-1.8.1.min.js"></script>
<script src="bootstrap.min.js"></script>
<script type="text/javascript">
$(function(){
var oneup = $('.oneup');
var oneupaudio = oneup.find('audio')[0];
oneup.hover(function(){
oneupaudio.play();
}, function(){
oneupaudio.stop();
});
});
</script>
</body>
</html>
<?php
// Return the steam ID associated with the given IP,
// false if none exists.
function getSteamID($json, $ipAddress){
$idIndex = array_search($ipAddress, $json);
for ($i=0; $i < count($json); $i++) {
if($json[$i] == $ipAddress){
return $i + 1;
}
}
return false;
}
?>