How to refresh the php database code without refresh page

Helo there. Thankyou for reading. actually i already searching about this and i cant find one match my problem! So i have a website and i want to use login system so only people that their account in my database that can access my content. But there a problem in my content. I use flip builder for make my pdf file looks interactive like real book.

and i already put php code in there so when the page open they will check login token in my database. But there is a way to bypass this security i made. The user can open my website and open the book link and after the authentication code run. Then in other device, the same user can login and open my content. So my content can be read in two device at the same time until the first device do refresh. I already think about adding auto refresh but it will make the user uncomfortable because the reading progress will restart from beginning. So can u all help me guys? I want the php code for the content run without refresh the page

this is the code i want to add in every content

<?php

include($_SERVER['DOCUMENT_ROOT']."/login/config.php");
include($_SERVER['DOCUMENT_ROOT']."/login/check_token.php");

// Check user login or not
if(!isset($_SESSION['username'])){
    header('Location: https://futuresystem-online.com/login/');
}
?>



<html> 
<head><title>content</title></head>
<body>
<p> this is my content</p>
</body>
</html>

how do i make the code run every 1 minute?
Thankyou all for helping

1 Like

there’s no bulletproof way to get the contents back/unread/deleted once you send them to the client. maybe you could try to change the “flip builder” software to periodically check for a second login.

i understand there is no bullet prof way about that problem, i know when my content in client side there is the end. but at least i want to make the code refresh i trying calling my file check.php using AJAX which one i used for login check but the command didn’t run.

what does your browser show when you open the console with F12 and look in the network tab?

I mean… if you’re that paranoid about it, don’t let the second device log in until the first one has been signed out?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.