write-ups-challenges-2020-2021/break_the_gate/4.php

109 lines
2.7 KiB
PHP
Raw Normal View History

2022-11-24 17:03:20 +00:00
<?php
require('flags.php');
if(!isset($_COOKIE['currentLevel'])) {
setcookie("currentLevel", "Flags_will_appear_here_when_you_complete_a_level...", time()+24*60*60);
}
switch ($_COOKIE['currentLevel']) {
case $flag_1:
header('Location: 2.php');
break;
case $flag_2:
header('Location: 3.php');
break;
case $flag_3:
break;
case $flag_4:
header('Location: 5.php');
break;
case $flag_5:
header('Location: final.php');
break;
default:
header('Location: 1.php');
break;
}
$fa = 0;
if (isset($_GET['try'])) {
$fa = intval($_GET['try']);
}
$fa100 = floor($fa / 100);
$fa -= 100 * $fa100;
$fa10 = floor($fa / 10);
$fa -= 10 * $fa10;
$fa1 = $fa;
?>
<!DOCTYPE html>
<html>
<head>
<title>Level 4</title>
<meta charset="UTF-8">
<meta name="author" content="Benjamin Ver">
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/pl.css">
<?php if (isset($_GET['try']) && $_GET['try'] != 732) { echo "<style> .w {color: red;} </style>"; } ?>
<script type="text/javascript" src="script/jquery.js"></script>
<script type="text/javascript" src="script/jquery-ui.js"></script>
<script type="text/javascript" src="script/main.js"></script>
<script type="text/javascript" src="script/pl.js"></script>
<script type="text/javascript">
$(document).ready(function(){
<?php
require('flags.php');
if ($_GET['try'] == 732) {
echo 'document.cookie = "currentLevel=' . $flag_4 . '"' . ";\n";
echo 'goNext();';
} elseif (isset($_GET['try'])) {
echo 'errorAnimation();';
}
echo "\n";
?>
})
</script>
</head>
<body>
<div class="front">
<div class="lock intel">
<img src="img/lock_locked.jpg">
</div>
<table class="unlockpad intel">
<tr>
<td><div class='triangle up' id='100up'></div></td>
<td><div class='triangle up' id='10up'></div></td>
<td><div class='triangle up' id='1up'></div></td>
</tr>
<tr>
<td class='digit w' id='num100'><?php echo $fa100; ?></td>
<td class='digit w' id='num10'><?php echo $fa10; ?></td>
<td class='digit w' id='num1'><?php echo $fa1; ?></td>
</tr>
<tr>
<td><div class='triangle down' id='100down'></div></td>
<td><div class='triangle down' id='10down'></div></td>
<td><div class='triangle down' id='1down'></div></td>
</tr>
</table>
</div>
<div class="half left"></div>
<div class="half right"></div>
<form action='4.php' method='GET'>
<input type='hidden' name='try' id='try'>
</form>
</body>
</html>