AJAXBot/www/index.php

63 lines
2.2 KiB
PHP
Raw Normal View History

2014-06-17 20:25:49 +00:00
<?php
include("conn.php");
var_dump($config);
$err = $_GET["err"];
if($_POST["loginAttempt"]) {
if(mysql_num_rows(mysql_query("SELECT * FROM `admin` WHERE `username`='". mysql_real_escape_string($_POST['name']) ."' AND `password`='". hash('sha256',$_POST['pwd']) ."'")) > 0) {
$_SESSION["user"] = $_POST["name"];
$_SESSION["pwd"] = hash('sha256',$_POST['pwd']);
} else $err = "Failed to log in.";
}
if($_GET["jew"] == "true")
session_destroy();
2014-06-17 20:25:49 +00:00
?>
<?php if(!checkIfLoggedIn()) { ?>
2014-06-17 20:25:49 +00:00
<html>
<head>
<title>AJAX Bot Administration</title>
<link href="style.css" rel="stylesheet" type="text/css" />
2014-06-17 20:25:49 +00:00
</head>
<body>
<center>
<h1>Admin Login</h1>
<?php if($err) { ?><h3 style="color: red;"><?php echo $err; ?></h3><?php } ?>
<p>Javascript must be enabled for proper functionality.</p>
<form method="post" action="index.php">
<table border="0">
<tr><td style="text-align: right;">Username:</td><td><input type="text" name="name" /></td></tr>
<tr><td style="text-align: right;">Password:</td><td><input type="password" name="pwd" /></td></tr>
<tr><td></td><td><input type="submit" value="Login" name="loginAttempt" /></td></tr>
</table>
</form>
</center>
</body>
</html>
<?php } else { ?>
<?php include("header.php"); ?>
<center>
<fieldset class="narrow">
<legend>Pulse</legend>
Last hearbeat sent
<?php
echo mysql_fetch_object(mysql_query("SELECT `heartbeat` FROM `updater` WHERE `id`=1"))->heartbeat;
echo " UTC". $config->timezone ."". (($config->dst)?" in accordance to daylight savings.":"disregarding daylight savings.");
?>
</fieldset>
2014-07-11 21:03:57 +00:00
<br />
<fieldset class="wide">
<legend>Error Log</legend>
<a href="jews.php?do=cerrs">Clear Error List</a>
<?php
$q = mysql_query("SELECT * FROM `error` ORDER BY `id` DESC");
while($err = mysql_fetch_object($q)) {
echo "<p class='error'>". $err->time ." - ". $err->msg ."</p>";
}
?>
</fieldset>
</center>
<?php include("footer.php"); ?>
<?php } ?>