Ticket #9: index.php
| File index.php, 3.5 KB (added by Prospere, 4 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
| 4 | |
| 5 | // +-------------------------------------------------------------------+ |
| 6 | // | WiFiDog Authentication Server | |
| 7 | // | ============================= | |
| 8 | // | | |
| 9 | // | The WiFiDog Authentication Server is part of the WiFiDog captive | |
| 10 | // | portal suite. | |
| 11 | // +-------------------------------------------------------------------+ |
| 12 | // | PHP version 5 required. | |
| 13 | // +-------------------------------------------------------------------+ |
| 14 | // | Homepage: http://www.wifidog.org/ | |
| 15 | // | Source Forge: http://sourceforge.net/projects/wifidog/ | |
| 16 | // +-------------------------------------------------------------------+ |
| 17 | // | This program is free software; you can redistribute it and/or | |
| 18 | // | modify it under the terms of the GNU General Public License as | |
| 19 | // | published by the Free Software Foundation; either version 2 of | |
| 20 | // | the License, or (at your option) any later version. | |
| 21 | // | | |
| 22 | // | This program is distributed in the hope that it will be useful, | |
| 23 | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 24 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 25 | // | GNU General Public License for more details. | |
| 26 | // | | |
| 27 | // | You should have received a copy of the GNU General Public License | |
| 28 | // | along with this program; if not, contact: | |
| 29 | // | | |
| 30 | // | Free Software Foundation Voice: +1-617-542-5942 | |
| 31 | // | 59 Temple Place - Suite 330 Fax: +1-617-542-2652 | |
| 32 | // | Boston, MA 02111-1307, USA gnu@gnu.org | |
| 33 | // | | |
| 34 | // +-------------------------------------------------------------------+ |
| 35 | |
| 36 | /** |
| 37 | * This will respond to the gateway to tell them that the gateway is still up, |
| 38 | * and also log the gateway checking in for network monitoring |
| 39 | * |
| 40 | * @package WiFiDogAuthServer |
| 41 | * @author Alexandre Carmel-Veilleux <acv@acv.ca> |
| 42 | * @copyright 2004-2006 Alexandre Carmel-Veilleux |
| 43 | * @version Subversion $Id: index.php 916 2006-01-23 05:28:15Z max-horvath $ |
| 44 | * @link http://www.wifidog.org/ |
| 45 | */ |
| 46 | |
| 47 | /** |
| 48 | * Load required files |
| 49 | */ |
| 50 | require_once('../include/common.php'); |
| 51 | |
| 52 | echo "Pong"; |
| 53 | |
| 54 | $node_id = $db->escapeString($_REQUEST['gw_id']); |
| 55 | $user_agent = $db->escapeString($_SERVER['HTTP_USER_AGENT']); |
| 56 | |
| 57 | $db->execSql("SELECT * FROM nodes WHERE node_id='$node_id'",$result,false); |
| 58 | $numrow = count($result); |
| 59 | |
| 60 | if ($numrow == 0){ |
| 61 | $db->execSql("INSERT into nodes(network_id,last_heartbeat_ip,last_heartbeat_timestamp,last_heartbeat_user_agent,node_id) values('default-network','$_SERVER[REMOTE_ADDR]', NOW(), '$user_agent', '$node_id')",$result,false); |
| 62 | } else { |
| 63 | $db->execSqlUpdate("UPDATE nodes SET last_heartbeat_ip='$_SERVER[REMOTE_ADDR]', last_heartbeat_timestamp=NOW(), last_heartbeat_user_agent='$user_agent' WHERE node_id='$node_id'"); |
| 64 | } |
| 65 | |
| 66 | /* |
| 67 | * Local variables: |
| 68 | * tab-width: 4 |
| 69 | * c-basic-offset: 4 |
| 70 | * c-hanging-comment-ender-p: nil |
| 71 | * End: |
| 72 | */ |
| 73 | |
| 74 | ?> |
