One way would be to monitor one of the GPIO as an input and when it goes low have it run a Bash script to issue a shutdown command.
This probably requires another program running (PHP?) running as a background task.
Read up about the exec command for Bash and PHP.