Skip to content

Instantly share code, notes, and snippets.

@clone1018
Created April 15, 2014 21:45
Show Gist options
  • Save clone1018/10779571 to your computer and use it in GitHub Desktop.
Save clone1018/10779571 to your computer and use it in GitHub Desktop.
<?php
class AjaxController extends ABaseControllerThatAddsHelperAPIMethods {
public function __construct() {
$this->requireAuth(array('getStatus'));
}
...
public function getStatus() {
if(isset($_POST['ip'])) {
if(!@fsockopen($_POST['ip'], 8003, $num, $error, 3)) {
return array('status' => 'offline');
} else {
return array('status' => 'online');
}
} else {
return array('errors' => 'No IP#');
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment