15
Apr
On campus detection script
To further increase the functionality of Moodle I added a small PHP script which detects if a user is on campus or working remotely. With this script I am able to show different information and restrict information based upon location.
First we need to get the network information of the user
$IP = $_SERVER[''REMOTE_ADDR''];
$hostname = @gethostbyaddr ($IP);
Then we can create a variable which stores the hostname
$hostnamecheck = strstr($hostname,"college"); Read more »