fbpx

Our Guests

[insert_php]
if (isset($_GET[‘id’])) {
if (isset($_GET[‘rank’])) {
$rank = $_GET[‘rank’];
} else {
$rank = 0;
}
$total_guests = 0;
set_query_var(@rank, $rank);
$room = $_GET[‘room’];
$sql_query = “SELECT @rank:[email protected]+1 AS rank, id, name, photo_url, time FROM `groups` WHERE room = ” . $room . ” ORDER BY time DESC”;
$ranked_results = $GLOBALS[‘wpdb’]->get_results($sql_query);
$rank = 1;
$total_groups = count($ranked_results);
foreach ($ranked_results as $r) {
if ($r->id == $_GET[‘id’]) {
$group = $r;
break;
}
$rank++;
}
if (current_user_can(‘manage_options’)) {
echo ‘

‘;
echo ‘‘;
echo ‘‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘‘;
echo ‘Group Name: ‘;
echo ‘‘;
echo ‘‘;
echo ‘‘;
echo ‘‘;
echo ‘‘;

echo ‘
‘;
echo ‘Time: ‘;
echo ‘

‘;
}
echo ‘

‘;
echo ‘

‘ . $group->name . ‘ – ‘;
echo ($group->time > 0) ? ‘Success!’ : ‘Failure’;
echo ‘ (Ranked: #’ . $rank . ‘/’ . $total_groups . ‘)

‘;
echo ‘‘ . $room_name . ‘

‘;
} else if ($room == 2) {
$room_name = “The Missing Musician”;
echo ‘

‘ . $room_name . ‘

‘;
} else if ($room == 4) {
$room_name = “Licastor’s Lair”;
echo ‘

‘ . $room_name . ‘

‘;
} else if ($room == 5) {
$room_name = “Hacker: Corruption Disruption”;
echo ‘

‘ . $room_name . ‘

‘;
} else if ($room == 10) {
$room_name = “Judgment”;
echo ‘

‘ . $room_name . ‘

‘;
}
$limit = 15;
$sql_query = “SELECT @rank:[email protected]+1 AS rank, id, name, photo_url, photo_thumbnail, time FROM `groups`”;
$sql_query .= ” WHERE room = ” . $room;
$count_query = “SELECT COUNT(*) as total FROM `groups` WHERE `room` = ” . $_GET[‘room’];
$total_groups = $GLOBALS[‘wpdb’]->get_results($count_query);
$group_count = $total_groups[0]->total;
$num_of_buttons = ceil($group_count / $limit);
$current_select = $offset / $limit;
$total_guests = 0;
set_query_var(@rank, $rank);
$rank = 1;
$sql_query .= ” ORDER BY time DESC”;
$sql_query .= ” LIMIT ” . $limit;
if (isset($_GET[‘offset’])) {
$offset = $_GET[‘offset’];
$rank = $offset + 1;
$sql_query .= ” OFFSET ” . $offset;
}
$ranked_results = $GLOBALS[‘wpdb’]->get_results($sql_query);
foreach ($ranked_results as $guest) {
if ($guest->time > 0) {
$style = ‘Success!
‘;
} else {
$style = ‘Failure
‘;
}
echo ‘id . ‘&room=’ . $room . ‘”>’;
echo ‘
‘;
$rank++;
}
/*
echo ‘

‘;
$first_used = false;
$dots_used = false;
$start = 0;
if ($num_of_buttons > 10) {
if (($offset / $limit – 4) > 0) {
$start = ($offset / $limit) – 4;
}
}
$new_offset = $start * $limit;
for ($i = $start; $i < $num_of_buttons; $i++) { if (!$first_used) { echo 'First‘;
$first_used = true;
} else if ($i == ($num_of_buttons – 1)) {
echo ‘Last‘;
} else {
echo ‘‘ . ($i + 1) . ‘‘;
}
if ($i – $start > 7 & amp;
&
amp;
!$dots_used & amp;
&
amp;
$num_of_buttons – 4 >= $i) {
echo ‘‘;
$i = $num_of_buttons – 4;
$new_offset = $i * $limit;
$dots_used = true;
}
$new_offset += $limit;
}
echo ‘

‘;
*/
} else {
$count_query = “SELECT * FROM `groups`”;
$groups = $GLOBALS[‘wpdb’]->get_results($count_query);
$success1 = 0;
$total1 = 0;
$success2 = 0;
$total2 = 0;
$success4 = 0;
$total4 = 0;
$success5 = 0;
$total5 = 0;
$success10 = 0;
$total10 = 0;
foreach ($groups as $group) {
if ($group->room == 1) {
$total1++;
if ($group->time > 0) {
$success1++;
}
} else if ($group->room == 2) {
$total2++;
if ($group->time > 0) {
$success2++;
}
} else if ($group->room == 4) {
$total4++;
if ($group->time > 0) {
$success4++;
}
} else if ($group->room == 5) {
$total5++;
if ($group->time > 0) {
$success5++;
}
} else if ($group->room == 10) {
$total10++;
if ($group->time > 0) {
$success10++;
}
}
}
echo ‘‘;
echo ‘

‘;
echo ‘

The Cure

‘;
echo ‘‘;
echo ‘‘;
if ($total1 == 0) {
echo ‘No one has tried to escape this room yet!’;
} else {
echo $total1 . ‘ groups have tried escaping The Cure and ‘ . $success1 . ‘ have successfully escaped. The success rate is %’ . number_format($success1 / $total1 * 100, 2, ‘.’, ”);
}
echo ‘
‘;
echo ‘

‘;
echo ‘

‘;
echo ‘
‘;
echo ‘


‘;
echo ‘‘;
echo ‘

‘;
echo ‘

The Missing Musician

‘;
echo ‘‘;
echo ‘‘;
if ($total2 == 0) {
echo ‘No one has tried to escape this room yet!’;
} else {
echo $total2 . ‘ groups have tried escaping The Missing Musician and ‘ . $success2 . ‘ have successfully escaped. The success rate is %’ . number_format($success2 / $total2 * 100, 2, ‘.’, ”);
}
echo ‘
‘;
echo ‘

‘;
echo ‘

‘;
echo ‘
‘;
echo ‘


‘;
echo ‘‘;
echo ‘

‘;
echo ‘

LiCastro\’s Lair

‘;
echo ‘ ‘;
echo ‘ ‘;
if ($total4 == 0) {
echo ‘No one has tried to escape this room yet!’;
} else {
echo $total4 . ‘ groups have tried escaping LiCastro\’s Lair and ‘ . $success4 . ‘ have successfully escaped. The success rate is %’ . number_format($success4 / $total4 * 100, 2, ‘.’, ”);
}
echo ‘
‘;
echo ‘

‘;
echo ‘

‘;
echo ‘
‘;
echo ‘


‘;
echo ‘‘;
echo ‘

‘;
echo ‘

Hacker: Corruption Disruption

‘;
echo ‘‘;
echo ‘‘;
if ($total5 == 0) {
echo ‘No one has tried to escape this room yet!’;
} else {
echo $total5 . ‘ groups have tried escaping Hacker: Corruption Disruption and ‘ . $success5 . ‘ have successfully escaped. The success rate is %’ . number_format($success5 / $total5 * 100, 2, ‘.’, ”);
}
echo ‘
‘;
echo ‘

‘;
echo ‘

‘;
echo ‘
‘;
echo ‘


‘;
echo ‘‘;
echo ‘

‘;
echo ‘

Judgment

‘;
echo ‘‘;
echo ‘‘;
if ($total10 == 0) {
echo ‘No one has tried to escape this room yet!’;
} else {
echo $total10 . ‘ groups have tried escaping Judgment and ‘ . $success10 . ‘ have successfully escaped. The success rate is %’ . number_format($success10 / $total10 * 100, 2, ‘.’, ”);
}
echo ‘
‘;
echo ‘

‘;
echo ‘

‘;
echo ‘
‘;
}

[/insert_php]