mirror of
https://github.com/PirateBox-Dev/PirateBoxScripts_Webserver.git
synced 2023-12-14 07:22:58 +01:00
Use webserver's php-fcgi, which is much faster on embedded devices then cli mode
This commit is contained in:
parent
7086c581bf
commit
9d6f90297a
3 changed files with 46 additions and 1 deletions
|
@ -8,6 +8,8 @@ if ( ! ( isset ( $argv['1'] ) &&
|
||||||
die("
|
die("
|
||||||
Add and removes IPs to captive.sqlite database
|
Add and removes IPs to captive.sqlite database
|
||||||
|
|
||||||
|
Note: DNSMASQ is using webrequests to speed up on embedded devices!
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
captive_cli.php <action> <ip> (path)
|
captive_cli.php <action> <ip> (path)
|
||||||
|
|
||||||
|
|
|
@ -30,4 +30,4 @@ fi
|
||||||
|
|
||||||
echo "$op ; $ip"
|
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
|
||||||
|
|
43
piratebox/piratebox/www/captive/dnsmasq_cli.php
Normal file
43
piratebox/piratebox/www/captive/dnsmasq_cli.php
Normal 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");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in a new issue