1
Due to an obscure need of the system, when clicking a button, I need to know the IP that triggered it to direct the correct page. With $_SERVER['REMOTE_ADDR']
I have this information. But how could I pass it to a JS ? More or less this way:
document.getElementById('LIMPAR').onclick = function() {
if ($_SERVER['REMOTE_ADDR'] == 'XXX') {
location.href = '1';
} ELSE {
location.href = '2';
}
}
Testing the above logic, I was unsuccessful. Any suggestions?
Maybe in the onclick attribute of the wipe button, call a function to do this redirection, passing as parameter the $_SERVER['REMOTE_ADDR'] coming straight from PHP when mounting the HTML.
– Augusto