I get the following issue with this code : The localhost
page caused too many redirections.
Status code is 302 Found
.
After deleting last else, I come succesfull to my site with 200 OK
respone but then $user
is not defined.
if (empty($_GET['unique_user'])) {
if (!empty($_COOKIE['unique_user_D_']) && mysqli_num_rows(mysqli_query($connection, "SELECT `id` FROM `users` WHERE `hash`='".myFunction($_COOKIE['unique_user_D_'])."' LIMIT 1"))!=0) {
header('Location: ./?unique='.$_COOKIE['unique_user_D_']);
exit();
}
newUser($add);
}
else {
if (mysqli_num_rows(mysqli_query($connection, "SELECT `id` FROM `users` WHERE `hash`='".myFunction($_GET['unique_user'])."' LIMIT 1"))!=0) {
$user=mysqli_fetch_array(mysqli_query($polaczenie, "SELECT * FROM `users` WHERE `hash`='".myFunction($_GET['unique_user'])."' LIMIT 1"));
$unique=myFunction($_GET['unique_user']);
setcookie('unique_user_D_',myFunction($_GET['unique']),(time()+60*60*24*365*5),'/');
}
else {
setcookie('unique_user_D_',false,1),'/');
header('Location: ./');
exit();
}
}