Skip to content

Commit

Permalink
Added Logviewer Web-UI
Browse files Browse the repository at this point in the history
  • Loading branch information
tiotdev committed May 15, 2018
1 parent a0f5a51 commit 46813a8
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 0 deletions.
67 changes: 67 additions & 0 deletions botlogviewer/authors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
session_start();
include 'config.php'; //Include config (pw and paths)
if (!isset($_SESSION["is_auth"])) {
header("location: login.php");
exit;
}
else if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "true") {
unset($_SESSION['is_auth']);
session_destroy();
header("location: login.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Author Log - TravelFeed</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="page.css">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">Travelfeed</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="index.php">Post Log</a>
</li>
<li class="nav-item">
<a class="nav-link" href="pylog.php">Bot Log</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">Author Log <span class="sr-only">(current)</span></a>
</li>
</ul>
<a class="text-light" href="/?logout=true">Logout</a>
</div>
</nav>

<main role="main" class="container">
<div class="starter-template">
<h1>Recent Author Log</h1>
<p>Authors who have received advertisement by the @de-travelfeed bot</p>
<div class="card bg-faded bg-dark text-success"><div class="card-body">
<p class="card-text">
<?php
$file = file($authorlist);
$file = array_reverse($file);
foreach($file as $f){ echo "<a class='text-success' href='https://steemit.com/@".$f."' target='_blank'>@".$f."</a><br />";
}
?>
</p>
</div>
</div>
</div>
</main>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions botlogviewer/example.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
$passwdfrontend = "mypassword123";
$authorlist = "author_list.log";
$pylog = "pylog.log";
$postslog = "posts.log";
?>
67 changes: 67 additions & 0 deletions botlogviewer/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
session_start();
include 'config.php'; //Include config (pw and paths)
if (!isset($_SESSION["is_auth"])) {
header("location: login.php");
exit;
}
else if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "true") {
unset($_SESSION['is_auth']);
session_destroy();
header("location: login.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Processed Posts - TravelFeed</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="page.css">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">Travelfeed</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Post Log <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="pylog.php">Bot Log</a>
</li>
<li class="nav-item">
<a class="nav-link" href="authors.php">Author Log</a>
</li>
</ul>
<a class="text-light" href="/?logout=true">Logout</a>
</div>
</nav>

<main role="main" class="container">
<div class="starter-template">
<h1>Recently Processed Posts</h1>
<div class="card bg-faded bg-dark text-success"><div class="card-body">
<p class="card-text">
<?php
$file = file($postslog);
$file = array_reverse($file);
foreach($file as $f){ echo "<a class='text-success' href='https://steemit.com/".$f."' target='_blank'>".$f."</a><br />";
}
?></p>
</div>
</div>
</div>
</main>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</body>
</html>

44 changes: 44 additions & 0 deletions botlogviewer/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
html,
body {
height: 100%;
}

body {
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}

.form-signin {
width: 100%;
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .checkbox {
font-weight: 400;
}
.form-signin .form-control {
position: relative;
box-sizing: border-box;
height: auto;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
48 changes: 48 additions & 0 deletions botlogviewer/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
session_start();
include 'config.php'; //Include config (pw and paths)
if (isset($_POST['login-submit']))
{
if (isset($_POST['passwd'])) {
$passwd = $_POST['passwd'];
if ($passwd == $passwdfrontend) {
$_SESSION['is_auth'] = true;
header('location: index.php');
exit;
}
else {
$error = "Invalid Password. Please try again.";
}
}
else {
$error = "Invalid Password. Please try again.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Travelfeed</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="login.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</head>
<body class="text-center">
<div class="container">
<form class="form-signin" method="post" action="">
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<?php
if (isset($error)) {
echo "<div class='alert alert-danger'>$error</div>";
}
?>
<label for="inputpassword" class="sr-only">Password</label>
<input type="Password" name="passwd" id="passwd" class="form-control" placeholder="Password" required>
<button class="btn btn-lg btn-primary btn-block" name="login-submit" id="login-submit" type="submit">Sign in</button>
</form>
</div>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions botlogviewer/page.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
padding-top: 5rem;
}
.starter-template {
padding: 3rem 1.5rem;
text-align: center;
}
67 changes: 67 additions & 0 deletions botlogviewer/pylog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
session_start();
include 'config.php'; //Include config (pw and paths)
if (!isset($_SESSION["is_auth"])) {
header("location: login.php");
exit;
}
else if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "true") {
unset($_SESSION['is_auth']);
session_destroy();
header("location: login.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Python Log - TravelFeed</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="page.css">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">Travelfeed</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="index.php">Post Log</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">Bot Log <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="authors.php">Author Log</a>
</li>
</ul>
<a class="text-light" href="/?logout=true">Logout</a>
</div>
</nav>

<main role="main" class="container">

<div class="starter-template">
<h1>Recent Python Log</h1>
<div class="card bg-faded bg-dark text-success"><div class="card-body">
<p class="text-left card-text"><?php
$file = file($pylog);
$file = array_reverse($file);
foreach($file as $f){
echo $f."<br />";
}
?></p>
</div></div>
</div>

</main>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</body>
</html>

0 comments on commit 46813a8

Please sign in to comment.