<?php
if (!isset($_SESSION)) {
session_start();
}
require_once 'init.php';
?>
<?php
class Login
{
protected $id;
public function Login()
{
$msg = '';
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$json = $firebase->get(DEFAULT_PATH . "/ARCusers/");
$json_ary = json_decode($json, true);
if (is_array($json_ary) || is_object($json_ary)) {
foreach ($json_ary as $this->id => $val) {
$getEmail = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->id/email");
$getPassword = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->id/password");
$activation = $firebase->get(DEFAULT_PATH . "ARCusers/$this->id/activation");
if (isset($_POST['login']) && !empty($_POST['email'])
&& !empty($_POST['password'])
) {
if ('"' . $_POST['email'] . '"' == $getEmail &&
'"' . $_POST['password'] . '"' == $getPassword
) {
$_SESSION['email'] = '"' . $_POST['email'] . '"';
$_SESSION['id'] = $this->id;
if ($activation == 'true') {
echo "Logged in.";
header("Location: activation.php");
$_SESSION['email'] = $getEmail;
} else {
echo "verify your email";
}
} else {
$msg = 'Wrong email or password';
}
}
}
}
}
}
$login = new Login();
?>
<?php
session_start();
if (!$_SESSION['email']) {
header("Location: login.php");
}
include_once "LoginClass.php";
class LicenseKey extends Login
{
private $getId;
function LicenseKey()
{
$this->Login();
$this->getId = $_SESSION['id'];
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$license_key = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->getId/License");
$license_key_activation_date_ary = json_decode($license_key, true);
foreach ($license_key_activation_date_ary as $key => $val) {
$license_key_date = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->getId/License/$key/license key date");
$license_key_date = substr($license_key_date, 1, 10);
$DateNow = date('Y-m-d', strtotime(date("Y-m-d")));
}
$_SESSION['DateNow'] = $DateNow;
$_SESSION['LicenseKeyDate'] = $license_key_date;
$license_key = json_decode($license_key);
foreach ($license_key as $key => $val) {
}
$license_key_activation = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->getId/License/$key/license key activation");
if ($license_key_activation == "true") {
header("Location:profile.php");
} else {
echo "ERROR 1003";
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Firebase</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<form class="pure-form" method="get">
<h2>License key</h2>
<input name="addlicensekey" placeholder="put your license key" type="text">
<br><br><br>
<button type="submit" onclick="" name="LicenseKey" class="pure-button pure-button-primary">
Submit
</button>
<br>
<br>
<br>
<?php
echo $_SESSION['email'];
?>
<a href="logout.php">Logout here</a>
<br>
<hr>
<br>
</form>
<form method="get">
<button type="submit" onclick="" name="GetLicenseKey"
class="pure-button pure-button-primary">
Get
</button>
<?php
if (isset($_GET['GetLicenseKey'])) {
echo $key;
}
?>
</form>
</body>
</html>
<?php }
if (isset($_GET['LicenseKey'])) {
if ($key == $_GET['addlicensekey']) {
$firebase->set(DEFAULT_PATH . "/ARCusers/$this->getId/License/$key/license key activation", true);
header("Location:profile.php");
} else {
echo "false";
}
}
}
}
$licensekey = new LicenseKey();
?>
<?php
require_once 'activation.php';
?>
<form method="post">
<button name="PostTarget">Post target</button>
<form>
<?php
class Post extends LicenseKey
{
protected $getDateNow;
protected $getLicenseKeyDate;
public function posttarget()
{
$this->LicenseKey();
$this->getDateNow = $_SESSION['DateNow'];
$this->getLicenseKeyDate = $_SESSION['LicenseKeyDate'];
if (isset($_POST["PostTarget"])) {
echo $this->getDateNow;
echo "<br>";
echo "<br>";
echo $this->getLicenseKeyDate;
}
}
}
$Post =new Post();
?>