From my code in PHP I want to run another PHP file. For this I use this line:
header('Location: proceso.php');
exit;
How can I run this file in such a way that it is more secure and only executes from this line of code?
From my code in PHP I want to run another PHP file. For this I use this line:
header('Location: proceso.php');
exit;
How can I run this file in such a way that it is more secure and only executes from this line of code?
Hello, you could use something like this at the beginning of your file, process.php, we should know if that process you send to call from a submit or button, or just want to include its functionality in your php page here you would use include or require_once.
//si tu llamado a este proceso viene de un POST
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
Lo que quieres que se ejecute
} else {
//Redirecciona si quieres entrar por URL
header('Location: proceso.php');
exit;
}
Greetings!