Answer the question
In order to leave comments, you need to log in
Problem with return. Why does it always return the first variable?
you need to display the id that was entered in the input
<?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['valid'] = true;
$_SESSION['timeout'] = time();
$_SESSION['email'] = '"' . $_POST['email'] . '"';
if ($activation == 'true') {
echo "Logged in.";
header("Location: newwelcome.php");
// echo "$this->id";
// return $this->id;
} else {
echo "verify your email";
}
} else {
$msg = 'Wrong email or password';
}
}
}
return;
}
}
}
$login = new Login();
?>
<?php
include_once "new login.php";
class OpenPage extends Login
{
private $getId;
public function openpage()
{
$this->Login();
$this->getId = $this->id;
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
// echo $this->id;;
// echo $this->id;
$license_key = $firebase->get(DEFAULT_PATH . "/ARCusers/$this->getId/License/$this->getId/license key activation");
if ($license_key == 'true') {
// header("Location: profile.php");
// echo $license_key;
echo $this->getId;
} else {
// header("Location: activation.php");
// echo $license_key;
echo $this->getId;
}
}
}
$openpage = new OpenPage();
?>
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