coinhive-example/index.php

200 lines
12 KiB
PHP
Raw Permalink Normal View History

2017-10-09 15:42:31 +02:00
<?php
require_once 'config.php';
require_once 'classes/github_api.php';
session_start();
if (isset($_SESSION["access_token"])) {
$user = apiRequest('https://api.github.com/user');
$uid = $user->id;
if (isset($_GET["logout"])) {
session_destroy();
header('Location: ' . $_SERVER['PHP_SELF']);
}
} else {
if (isset($_GET['login'])) {
getLogin();
} else if (isset($_GET["code"])) {
if (!isset($_GET['state']) || $_SESSION['state'] != $_GET['state']) {
header('Location: ' . $_SERVER['PHP_SELF']);
die();
}
// Exchange the auth code for a token
$token = apiRequest("https://github.com/login/oauth/access_token", array(
'client_id' => $GITHUB_CLIENT_ID,
'client_secret' => $GITHUB_CLIENT_SECRET,
'redirect_uri' => $HTTP_PROTO . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],
'state' => $_SESSION['state'],
'code' => $_GET['code']
));
$_SESSION['access_token'] = $token->access_token;
header('Location: ' . $_SERVER['PHP_SELF']);
}
}
?>
2017-10-06 19:32:01 +02:00
<!doctype html>
2017-10-08 00:03:57 +02:00
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="A front-end template that helps you build fast, modern mobile web apps.">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>Miner Lite</title>
<link rel="shortcut icon" href="images/favicon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-deep_purple.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dialog-polyfill/0.4.4/dialog-polyfill.min.css">
<link rel="stylesheet" type="text/css" href="//csshake.surge.sh/csshake.min.css">
2017-10-09 15:42:31 +02:00
<link rel="stylesheet" href="css/styles.css">
2017-10-08 00:03:57 +02:00
</head>
<body class="mdl-demo mdl-color--grey-100 mdl-color-text--grey-700 mdl-base">
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header mdl-layout__header--scroll mdl-color--primary">
<div class="mdl-layout--large-screen-only mdl-layout__header-row">
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<div class="mdl-layout--large-screen-only mdl-layout__header-row">
<h3>Miner Lite</h3>
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<div class="mdl-layout--large-screen-only mdl-layout__header-row">
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<div class="mdl-layout__tab-bar mdl-js-ripple-effect mdl-color--primary-dark">
<a href="#overview" class="mdl-layout__tab is-active">Startseite</a>
<a href="#user" class="mdl-layout__tab">Benutzer Details</a>
<a href="#server" class="mdl-layout__tab">Server Details</a>
<a href="#faq" class="mdl-layout__tab">FAQ</a>
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--colored" id="add">
2017-10-09 15:42:31 +02:00
<i class="material-icons" role="presentation">lock</i>
<span class="visuallyhidden">Lock</span>
</button>
<button style="display: none" class="mdl-button mdl-js-button mdl-button--fab mdl-button--colored" id="remove">
<i class="material-icons" role="presentation">delete</i>
<span class="visuallyhidden">Delete</span>
2017-10-08 00:03:57 +02:00
</button>
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
</header>
<main class="mdl-layout__content">
<div class="mdl-layout__tab-panel is-active" id="overview">
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
<header class="section__play-btn mdl-cell mdl-cell--3-col-desktop mdl-cell--2-col-tablet mdl-cell--4-col-phone mdl-color--teal-100 mdl-color-text--white">
<i class="material-icons">play_circle_filled</i>
</header>
<div class="mdl-card mdl-cell mdl-cell--9-col-desktop mdl-cell--6-col-tablet mdl-cell--4-col-phone">
<div class="mdl-card__supporting-text">
<h4>Features</h4>
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Nostrud in laboris labore nisi amet do dolor eu fugiat consectetur elit cillum esse.
</div>
<div class="mdl-card__actions">
<a href="#" class="mdl-button">Read our features</a>
</div>
</div>
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" for="btn1">
<li class="mdl-menu__item">Lorem</li>
<li class="mdl-menu__item" disabled>Ipsum</li>
<li class="mdl-menu__item">Dolor</li>
</ul>
</section>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__supporting-text mdl-grid mdl-grid--no-spacing">
<h4 class="mdl-cell mdl-cell--12-col">Details</h4>
<div class="section__circle-container mdl-cell mdl-cell--2-col mdl-cell--1-col-phone">
<div class="section__circle-container__circle mdl-color--primary"></div>
</div>
<div class="section__text mdl-cell mdl-cell--10-col-desktop mdl-cell--6-col-tablet mdl-cell--3-col-phone">
<h5>Lorem ipsum dolor sit amet</h5>
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis <a href="#">proident minim</a>.
</div>
<div class="section__circle-container mdl-cell mdl-cell--2-col mdl-cell--1-col-phone">
<div class="section__circle-container__circle mdl-color--primary"></div>
</div>
<div class="section__text mdl-cell mdl-cell--10-col-desktop mdl-cell--6-col-tablet mdl-cell--3-col-phone">
<h5>Lorem ipsum dolor sit amet</h5>
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis <a href="#">proident minim</a>.
</div>
<div class="section__circle-container mdl-cell mdl-cell--2-col mdl-cell--1-col-phone">
<div class="section__circle-container__circle mdl-color--primary"></div>
</div>
<div class="section__text mdl-cell mdl-cell--10-col-desktop mdl-cell--6-col-tablet mdl-cell--3-col-phone">
<h5>Lorem ipsum dolor sit amet</h5>
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Duis nulla tempor do aute et eiusmod velit exercitation nostrud quis <a href="#">proident minim</a>.
</div>
</div>
<div class="mdl-card__actions">
<a href="#" class="mdl-button">Read our features</a>
</div>
</div>
</section>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__supporting-text">
<h4>Technology</h4>
Dolore ex deserunt aute fugiat aute nulla ea sunt aliqua nisi cupidatat eu. Nostrud in laboris labore nisi amet do dolor eu fugiat consectetur elit cillum esse. Pariatur occaecat nisi laboris tempor laboris eiusmod qui id Lorem esse commodo in. Exercitation aute dolore deserunt culpa consequat elit labore incididunt elit anim.
</div>
<div class="mdl-card__actions">
<a href="#" class="mdl-button">Read our features</a>
</div>
</div>
</section>
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<div class="mdl-layout__tab-panel" id="user">
<section class="section--center mdl-grid mdl-grid--no-spacing">
<div class="mdl-cell mdl-cell--12-col">
<h4>Benutzer Details</h4>
<span class="mdl-chip" id="notloggedin">
<span class="mdl-chip__text">Nicht eingeloggt</span>
</span>
<div id="loggedin" style="display:none;">
<span class="mdl-chip mdl-chip--contact">
<span class="mdl-chip__contact mdl-color--teal mdl-color-text--white">U</span>
<span class="mdl-chip__text" id="usernametext">USERNAME</span>
</span>
<br />
<p>
Threads: <span id="details_threads">0</span><br />
Hashes/s: <span id="details_hashes">0</span><br />
Accepted Hashes: <span id="details_accepted">0</span><br />
Total Hashes: <span id="details_total">0</span><br />
</p>
</div>
<div style="margin-bottom: 25em">
</div>
</div>
</section>
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<div class="mdl-layout__tab-panel" id="server">
<section class="section--center mdl-grid mdl-grid--no-spacing">
<div class="mdl-cell mdl-cell--12-col">
<h4>Server Details</h4>
<ol id="top10">
</ol>
<div style="margin-bottom: 25em">
</div>
</div>
</section>
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<footer class="mdl-mega-footer">
<div class="mdl-mega-footer--bottom-section">
<div class="mdl-logo">
More Information
</div>
<ul class="mdl-mega-footer--link-list">
<li><a href="https://developers.google.com/web/starter-kit/">Web Starter Kit</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">Privacy and Terms</a></li>
</ul>
</div>
</footer>
</main>
2017-10-06 19:32:01 +02:00
</div>
2017-10-08 00:03:57 +02:00
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dialog-polyfill/0.4.4/dialog-polyfill.js"></script>
2017-10-09 15:42:31 +02:00
<script src="js/coinhive.min.js"></script>
<script>
2017-10-09 15:49:08 +02:00
var sitekey = "<?php echo $COINHIVE_SITEKEY; ?>";
2017-10-09 15:42:31 +02:00
var username = <?php echo (is_numeric($uid) ? $uid : "null"); ?>;
</script>
<script src="js/main.js"></script>
2017-10-08 00:03:57 +02:00
</body>
2017-10-06 19:32:01 +02:00
</html>