<!DOCTYPE html>
<!--
Captcha generator borrowed from here: https://gist.github.com/Swader/9050789
Source code modified for my usage
All rights reserved to user Swader
-->
<html>
<head>
<?php
session_start();
$_SESSION['captcha'] = 0;
$_SESSION['count'] = time();
$image;
?>
<title>Sentinel page</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="jsfunctions.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div id="logo_bubble">
<span>J</span>
<span>a</span>
<span>m</span>
<span>i</span>
<span>n</span>
<span>W</span>
<span>E</span>
<span>B</span>
</div>
<div class="header">
<p id="sentheader">00011101010000110101010</p>
</div>
<div class="maincontent">
<h1>
Welcome!
</h1>
<hr>
<p>
Before entering, I need to make sure you're human.
</p>
<div id="questdiv">
<?php
$flag = 5;
if (isset($_POST["flag"])) {
$input = $_POST["input"];
$flag = $_POST["flag"];
}
if ($flag == 1) {
if ($input == $_SESSION['captcha_string']) {
?>
<div>
<h3>Ok, you're probably human.</h3>
<h3><a href="homepage.php">Enter JaminWEB</a></h3>
<?php
$_SESSION['captcha'] = 1;
?>
<!--
<form action=" <?php /* echo $_SERVER['PHP_SELF']; */ ?>" method="POST">
<input type="submit" value="Enter Homepage" class="sentipt"\>
</form>
-->
</div>
<?php
} else {
?>
<div align="center">
<h3><span style="color: #DF0101">Your answer is incorrect!</span> Please try again.</h3>
</div>
<?php
create_image();
display();
}
} else {
create_image();
display();
}
function display()
{
?>
<div>
<div align="center"><h3>Type in the text you see below.</h3></div>
<div align="center"><img src="image<?php echo $_SESSION['count'] ?>.png" id="capimg" style="border: 0px"></div>
<form action=" <?php echo $_SERVER['PHP_SELF']; ?>" method="POST"/ >
<div align="center"><input type="text" name="input" id="sentipt" style="width: 300px;"/></div>
<div align="center"><input type="hidden" name="flag" value="1" class="sentipt"/></div>
<div align="center"><input type="submit" value="submit" name="submit" class="sentipt"/></div>
</form>
<!--
<form action=" <?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="submit" value="refresh the page" class="sentipt"/>
</form>
-->
</div>
<?php
}
function create_image()
{
global $image;
$image = imagecreatetruecolor(200, 50) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 180, 4, 4);
$line_color = imagecolorallocate($image, 249, 198, 36);
$pixel_color = imagecolorallocate($image, 180, 4, 4);
imagefilledrectangle($image, 0, 0, 200, 50, $background_color);
for ($i = 0; $i < 3; $i++) {
imageline($image, 0, rand() % 50, 200, rand() % 50, $line_color);
}
for ($i = 0; $i < 1000; $i++) {
imagesetpixel($image, rand() % 200, rand() % 50, $pixel_color);
}
$letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$len = strlen($letters);
$letter = $letters[rand(0, $len - 1)];
$text_color = imagecolorallocate($image, 0, 0, 0);
$word = "";
for ($i = 0; $i < 6; $i++) {
$letter = $letters[rand(0, $len - 1)];
imagestring($image, 7, 5 + ($i * 30), 20, $letter, $text_color);
$word .= $letter;
}
$_SESSION['captcha_string'] = $word;
$images = glob("*.png");
foreach ($images as $image_to_delete) {
@unlink($image_to_delete);
}
imagepng($image, "image" . $_SESSION['count'] . ".png");
}
?>
</div>
</div>
<div class="footer">
<p><span class="yellow_highlight">Last updated:</span> 04/02/2014</p>
</div>
<script type="text/javascript">
window.setInterval("set_head_bckgd()",200);
</script>
</body>
</html>