I need a php function that checks if the user has already accessed such a file, if yes, open X javascript file, if not accessed, open another javascript file.
Example: 1st access = open test.js 2 ° or more hits = open ola.js
I need a php function that checks if the user has already accessed such a file, if yes, open X javascript file, if not accessed, open another javascript file.
Example: 1st access = open test.js 2 ° or more hits = open ola.js
You can add a cookie to the user's browser when he first signs in, and then check that he already has such a cookie.
//Primeiro, verificamos se o usuário já possui o cookie
if(isset($_COOKIE['acesso'])) {
//Se o usuário possuir o cookie no navegador, significa que já acessou a pagina
//Então carregaremos o js ola
echo '<script type="text/javascript" src="ola.js"></script>';
} else {
//Se o usuário não possuir o cookie significa que nunca acessou a pagina
//Então vamos setar o cookie, e carregar o js teste
setcookie("acesso", 1, (time() + 100000));
echo '<script type="text/javascript" src="teste.js"></script>'
}