I have a page on my website that calls a php file using ajax. I require the user to be logged in to access either page, and use session_start()
on the page that calls the php file (let's say main.php
calls bg.php
). I include a session_start()
on bg.php
as well, because I need to access the session variables. However, I am spammed with php notices that say
A session had already been started - ignoring session_start()
So, I tried using
if (!isset($_SESSION)) session_start();
However, I kept getting the error, so I tried removing it entirely, because it said it was being ignored anyways. However, then bg.php
stopped recognizing session variables. How can I stop getting the notices?