Use webserver's php-fcgi, which is much faster on embedded devices then cli mode

This commit is contained in:
Matthias Strubel 2017-07-02 09:21:32 +02:00
parent 7086c581bf
commit 9d6f90297a
3 changed files with 46 additions and 1 deletions

View File

@ -8,6 +8,8 @@ if ( ! ( isset ( $argv['1'] ) &&
die("
Add and removes IPs to captive.sqlite database
Note: DNSMASQ is using webrequests to speed up on embedded devices!
Usage:
captive_cli.php <action> <ip> (path)

View File

@ -30,4 +30,4 @@ fi
echo "$op ; $ip"
php "$PIRATEBOX_FOLDER"/bin/captive_cli.php "$op" "$ip" "$PIRATEBOX_FOLDER/"
wget -q -O - "http://127.0.0.1/captive/dnsmasq_cli.php?type=$op&ip=$ip" > /dev/null

View File

@ -0,0 +1,43 @@
<?php
// general handler to give answers to "internet available checks"
//
// GPL3 (C) 2017 Matthias Strubel <matthias.strubel@aod-rpg.de>
//
// $_SERVER['REMOTE_ADDR'] - Clients IP
if ( $_SERVER['REMOTE_ADDR'] != '127.0.0.1' ) {
echo "403";
exit;
}
require_once ("captive.func.php");
$config = get_config();
$action = $_GET['type'];
$ip = $_GET['ip'];
if ( $action == "add" ) {
count_ip("$ip" , "yes" );
exit ;
} elseif ( $action == "del" ) {
del_ip("$ip" );
exit ;
} elseif ( $action == "old" ) {
// Refresh or relogin
$config = get_config();
if ( $config['old_triggers_login'] ) {
del_ip("$ip" );
count_ip("$ip" , "yes" );
}
exit;
} else {
die ("unknown action");
}
?>