I want to a create a php in my webpage, button press, as an emergency shutdown command to my local server.
I have the following php code that i am using right now. It is working but it is slow. I found the following post in stackoverflow and i was thinking if i can modify my code and use it.
I need on button press to immediately transfer to redirect page and on background to shutdown server.
My code:
<?php
session_start();
unset($_SESSION['valid']);
unset($_SESSION['timeout']);
header("Location: https://www.google.com/");
system('sudo /sbin/shutdown -h now');
?>
The stackoverflow post: