You can't do that with PHP as the pages need to be loaded to read the session content, you would need to create / update your htaccess file.
Try this...
htaccess.shtml
Alternatively, if you want to use SecurityAssist to apply the rules to multiple pages within a directory using the Access Pages Manager
Cheers
Ian