I have a problem with redirecting to a page. It seems like it is redirecting itself multiple times. I have
if(!isset($_SESSION)){
header("location:index.php");
exit();
}
in my header. and my header is included in my index page and everywhere else. I know that since it is in the header, it will be redirected to index.php then it will the script again and over and over which is giving me problems.
How would I prevent it to stop doing it right after redirecting? Or is there another way to check if user is logged in, if not, go to index.php?
Thanks!
I figured it out, I knew that I had a if statement in my header, so while i’m trying to redirect to index.php, I still have that if statement and not having a session, i’m going to be redirecting myself in a never ending loop.
What I did is just created a new header for index.php