Better way is check username and group by
It should work well when script is running in web browser, but it need to be tested. Hardcoded username/group isn't good option, someone could change user and/or group in his apache config.
Code:
system('whoami');
system('groups');