<?php
include("includes/startup.php");
include("includes/functions.php");
?>
<!doctype html>
<html>
<head>
<title>MMOCLUB - Reaper</title>
<meta charset="utf-8">
<meta name="description" content="MMOCLUB's Reaper">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.custom.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="header">
<?php
if($_GET['admin'] === ADMINPAGEPASSWORD){
echo '<span><a href="'.$_SERVER["PHP_SELF"].'">Admin panel</a></span>';
}else{
?>
<div id="next"><a alt="Next faucet" class="dirright">Next Faucet</a></div>
<input type="text" id='addressinput' size='35' value='<?php echo $_COOKIE["btcaddress"]; ?>' disabled />
<div style="height:100%;"><iframe scrolling="no" frameborder="0" src="http://bitcoin-ads.net/gimg.php?id=1222" style="overflow:hidden;width:468px;height:60px;"></iframe></div>
<?php
}
?>
</div>
<?php
if($_GET['admin'] === ADMINPAGEPASSWORD){
?>
<div id="contentWrapper">
<p id="title">Admin page</p>
<div id="codeBox">
<p><strong>Add another website:</strong></p>
<form>
<div class="center"><table><tr><td class="first"><label>URL: </label></td><td><input type="text" id="newpageurl" maxlength="100"></input></td></tr>
<tr><td class="first"><label>Cooldown (in minutes): </label></td><td><input type="text" id="cooldownpage" maxlength="100"></input></td></tr></table>
<br/><button type="button" id="addwebsite" value="Add!">Add!</button></div>
</form>
<div class="center" id="results"></div>
<div class="center"><strong>Current websites:</strong></div>
<?php
$mysqli = mysqli_connect(MYSQLHOST,MYSQLUSERNAME, MYSQLPASSWORD, MYSQLDATABASE);
$counter = mysqli_query($mysqli,"SELECT * FROM ".MYSQLREAPERTABLE);
if(mysqli_num_rows($counter) > 0){
echo '<table><tr><th class="first">URL</th><th>Cooldown</cooldown><th>Remove</th></tr>';
while ($row = mysqli_fetch_assoc($counter)) {
echo "<tr id='".$row['id']."'><td class='first'>".$row['url']."</td><td>".$row['cooldown']."</td><td><button type='button' class='removethisurl' value='".$row['id']."'>Remove</button></td></tr>";
}
echo '</table>';
echo '<div class="center" id="removeresults"></div>';
}
?>
</div>
<div class="clear"></div>
<div id="authorinfo-sticky-wrapper" class="sticky-wrapper" style="height: 19px;"><p id="authorinfo" style="">
Made with love by <a href="http://bitcoininformation.info">BitCoin Information</a>
<br/>Theme made by <a href="http://anthonygarand.com">Anthony Garand</a> and changed by <a href="http://bitcoininformation.info">BitCoin Information</a>
</p></div>
</div>
<?php
}else if($_COOKIE['btcaddress'] == null OR $_COOKIE['btcaddress'] === ""){
?>
<div id="contentWrapper">
<p id="title">Welcome!</p>
<div id="codeBox">
<form>
<p>Please enter your Bitcoin Address to start.</p>
<div class="center"><label>Address: </label><input type="text" id="btcaddress" maxlength="100"></input>
<br/><button type="button" id="saveaddress" value="Let's go!">Start earning!</button></div>
</form><div class="center" id="addressresults"></div>
</div>
</div>
<?php
}else{
if($_COOKIE['totalpages'] == 0){
?>
<div id="contentWrapper">
<p id="title">We are sorry</p>
<div id="codeBox">
<p><strong>There are no pages avaible at this moment</strong></p>
</div>
</div>
<?php
}else{
$end = $_COOKIE[str_replace(".", "_", get_domain(getPage($_COOKIE["currentpage"])))];
if($end-time() >= 0){
?><div id="contentWrapper">
<p id="title"><?php echo get_domain(getPage($_COOKIE["currentpage"])); ?> is not available yet.</p>
<div id="codeBox">
<?php echo '<p><font size="4px">'. date("i:s", $end-time()) .' minutes left till next payout.</font></p>'; ?>
</div>
</div>
<?php
}else{
echo "<iframe id=\"iframereaper\" src='".getPage($_COOKIE["currentpage"])."' seamless>";
}
}
}
?>
</body>
</html>