0

Looking for help. I am new to the ob_start and believe I'm not using this correctly as users are sent back to my load-data.php after browsing my website without cause. I've paid very close attention to each page that is loaded, and it looks like there is something kept on the client that get's reposted? The code I use loads FB data, then based on whether a new user, or existing user I redirect using this code...

ob_start();

...Load FB Data then

if(isset($_SESSION['user_id']) && $isNewUser == 0)
{
    header('Location:loading-data.php?x=4');
    exit();
} 
else 
{
    $_SESSION['user_id'] = $user_id;

This 'loading-data.php' is called a number of times for some users and I'm not sure why, but have a feeling that there is something in the buffer on the client's machine that reposts stacked memory? What is the best coding technique to insure it doesn't get posted more than once?

Jocelyn
  • 11,209
  • 10
  • 43
  • 60
  • looks like your condition `isset($_SESSION['user_id']) && $isNewUser == 0` is true for every request. I don't think it is the buffer that causes the problem. the buffer is nothing but a way to keep the content from being outputted unless you flush the buffer (*the client machine has nothing to do with the buffer*) – Accountant م Mar 26 '17 at 14:36
  • Thanks... but this page "loading-data.php" keeps getting called 10 or 15 minutes after the user already logged in. The code here is the only place that points to the page so I was thinking that it was the culprit. I even when as far as assigning the variable x=4 to make sure that there was no other page calling 'loading-data.php'. There is none. Something is happening here that the client calls the server page over, and over again. Can't put my finger on it! :) – Frederico Nash Mar 26 '17 at 22:29

0 Answers0