Answer the question
In order to leave comments, you need to log in
Why are the conditions not met?
The point is that authorization occurs on the login.php page and then a redirect is made to the Approved page upon successful authorization.
login.php page code
if ($oneday) {
if (password_verify($data['login'], $oneday->password))
$SESSION['logged_user'] = $oneday;
$active = R::dispense('activen');
$active->token = $hashone;
$active->join_date = $date;
$active->expire = $date_expire_oneday;
$active->login = $data['login'];
$active->token = $hashone;
R::store($active);
R::exec("DELETE FROM oneday WHERE login = ?", [$data]);
if ($oneday == false) {
session_start();
$_SESSION ['reason'] = R::getCell('SELECT `token` FROM activen WHERE `login` = ? LIMIT 1', [$data]);
header('Location: http://localhost/approved.php');
}
}
if ($sevendays) {
if (password_verify($data['login'], $sevendays->password))
$SESSION['logged_user'] = $sevendays;
$activeseven = R::dispense('activen');
$activeseven->token = $sevendays;
$activeseven->join_date = $date;
$activeseven->expire = $date_expire_sevendays;
$activeseven->login = $data['login'];
$activeseven->token = $hashseven;
R::store($activeseven);
R::exec("DELETE FROM sevendays WHERE login = ?", [$data]);
header('Location: http://localhost/approved.php');
}
if ($sevendays == false) {
$_SESSION ['sevendays'] = R::getCell('SELECT `token` FROM activen WHERE `login` = ? LIMIT 1', [$data]);
header('Location: http://localhost/approved.php');
}
$errors = array();
session_start();
$activesevendouble = $_SESSION['reason'];
$activesevendays = $_SESSION['sevendays'];
if ($activesevendouble) {
echo '<div style="color: green;">Ну все oneday </div>';
$url = "http://example.com/activate.php?token=$activesevendouble";
echo $url;
if ($activesevendouble == false) {
$errors[] = 'no akk';
}
}
elseif ($activesevendays) {
echo '<div style="color: green;">Ну все SEVENDAYs </div>';
$urll = "http://example.com/activate.php?token=$activesevendays";
echo $urll;
if ($activesevendays == false) {
$errors[] = 'no akk';
}
Answer the question
In order to leave comments, you need to log in
Maybe in login.php before
if ($oneday) {
you need
session_start();
$oneday = isset( $_SESSION['oneday'] ) ? $_SESSION['oneday'] : false;
$sevendays = isset( $_SESSION['sevendays'] ) ? $_SESSION['sevendays'] : false;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question