Answer the question
In order to leave comments, you need to log in
I can't pass the id from the Login class to the LicenseKey, the problem is in the Login() function, "help" please?
Login
<?php
class Login
{
protected $id;
public function Login()
{
include_once 'init.php';
if (!isset($_SESSION)) {
session_start();
}
if (!isset($_SESSION['email'])) {
$email = isset($_POST['email']) ? $_POST['email'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
$email = htmlspecialchars($email);
$password = htmlspecialchars($password);
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$json = $firebase->get(DEFAULT_PATH . "/ARCusers/", array('activation' => '"true"'));
$error = false;
$conn = false;
if (isset($_POST['submit'])) {
if (!empty($email) && !empty($password)) {
//check if it matches
/*$email = '"' . $email . '"';
$password = '"' . $password . '"';*/
$json_ary = json_decode($json, true);
foreach ($json_ary as $this->id => $val) {
if ($email == $firebase->get(DEFAULT_PATH . "/ARCusers/$this->id/email") && $password == $firebase->get(DEFAULT_PATH . "/ARCusers/$this->id/password")) {
$activation = $firebase->get(DEFAULT_PATH . "ARCusers/$this->id/activation");
if ($activation == 'true') {
$conn = true;
} else {
echo "<br>";
echo "<br>";
echo "Verify your email";
echo "<br>";
}
}
}
if ($conn == true) {
$error = false;
} else {
$error = true;
}
if ($error) {
echo "Error in email or/and password.";
}
if (!$error) {
//login
$_SESSION['email'] = $email;
echo "Logged in.";
header("Location: welcome.php");
}
} else {
echo "Fill in all the details.";
}
}
}
}
}
<?php
include_once "Login.php";
if (!isset($_SESSION)) {
session_start();
}
class LicenseKey extends Login
{
private $getId;
public function LicenseKey()
{
$this->getId = $this->id;
echo $this->getId;
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$license_key = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->getId/License/license key");
// $license_key_activation = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->getId/License/license key activation ");
if (isset($_GET['LicenseKey'])) {
if ($license_key == '"' . $_GET['addlicensekey'] . '"') {
$firebase->set(DEFAULT_PATH . "/ARCusers/$this->getId/License/license key activation", true);
} else {
// echo "false";
echo $this->getId;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question