Esempio n. 1
0
<?php

header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$IP = new IP\IP();
$admin = new LTE\AdminLte2();
$admin->config()->title = $REMOTE_ADDR;
//menu override//
$admin->config()->menu = $IP->menuleft();
echo $admin;
//
?>

<section class="content-header">
  <h1>Ports</h1>
</section>

<section class="content">

	<div class="col-md-12">
	
	<?php 
include "box_ports.php";
?>
	</div>

</section>

<script src="js/ports.js"></script>
Esempio n. 2
0
<?php

header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$IP = new IP\IP();
if (!$IP->user_id()) {
    die("Login error");
}
switch ($_POST['do']) {
    case 'saveComment':
        //print_r($_POST);
        $ip_id = $_POST['ip_id'];
        if ($ip_id < 1) {
            die("Error");
        }
        $sql = "UPDATE ip_ports SET ip_comment=" . $IP->db()->quote(trim($_POST['comment'])) . " WHERE ip_id={$ip_id} AND ip_user_id=" . $IP->user_id() . " LIMIT 1;";
        $q = $IP->db()->query($sql) or die("Error {$sql}");
        echo "document.location.href='?id={$ip_id}';";
        exit;
    case 'deletePort':
        // TODO
        //print_r($_POST);
        $ip_id = $_POST['id'];
        if ($ip_id < 1) {
            die("Error");
        }
        $sql = "UPDATE ip_ports (ip_user_id, ip_ip, ip_port,ip_name) VALUES (" . $IP->user_id() . "," . $IP->db()->quote("{$ip_name}") . ",{$ip_port},'new');";
        $q = $IP->db()->query($sql) or die("Error {$sql}");
        echo "document.location.href='?name={$ip_name}';";
        exit;
Esempio n. 3
0
<?php

// ip.jambonbill.org :: /ip controller
header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$IP = new IP\IP();
if (!$IP->user_id()) {
    die("Login error");
}
switch ($_POST['do']) {
    case 'saveComment':
        print_r($_POST);
        $sql = "INSERT INTO ip_comment () VALUES ();";
        $q = $IP->db()->query($sql) or die("Error {$sql}");
        exit;
    case 'newport':
        //print_r($_POST);
        $ip_name = $_POST['ip_name'];
        $ip_port = $_POST['port'] * 1;
        if (!$ip_name || !$ip_port) {
            die("Error");
        }
        $sql = "INSERT INTO ip_ports (ip_user_id, ip_ip, ip_port,ip_name) VALUES (" . $IP->user_id() . "," . $IP->db()->quote("{$ip_name}") . ",{$ip_port},'new');";
        $q = $IP->db()->query($sql) or die("Error {$sql}");
        echo "document.location.href='?name={$ip_name}';";
        exit;
    case 'deletePort':
        print_r($_POST);
        exit;
    default:
Esempio n. 4
0
<?php

// register a public ip
// call this page during your computer init sequence so i can register its public ip
header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$IP = new IP\IP();
$ip = $_SERVER['REMOTE_ADDR'];
$name = @$_GET['name'];
if (!$name) {
    die('name?');
}
if ($IP->registerIp($ip, $name)) {
    echo 'ok';
}
Esempio n. 5
0
<?php

// register a public ip
// call this page during your computer init sequence so i can register its public ip
header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$admin = new LTE\AdminLte2();
$admin->config()->title = $REMOTE_ADDR;
echo $admin;
//
$IP = new IP\IP();
?>
<section class="content-header">
  <h1><i class='fa fa-chevron-right'></i> Register</h1>
</section>

<section class='content'>

<?php 
$ip = $_SERVER['REMOTE_ADDR'];
$NAME = @$_GET['name'];
if (!$NAME) {
    $NAME = 'Anonymous';
}
if ($IP->registerIp($ip, $NAME)) {
    echo new LTE\Callout("success", "<i class='fa fa-check'></i> Success", "Ip '{$ip}' registered successfuly");
    echo "<a href='http://ip.jambonbill.org' class='btn btn-default'>ip.jambonbill.org</a>";
    //die("Ip '$ip' registered successfuly");
    exit;
Esempio n. 6
0
<?php

//ip.jambonbill.org :: port
header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$IP = new IP\IP();
$admin = new LTE\AdminLte2();
$admin->title("Port");
$admin->config()->title = $REMOTE_ADDR;
$admin->config()->menu = $IP->menuleft();
echo $admin;
//
//print_r($_GET);
$id = $_GET['id'] * 1;
$sql = "SELECT * FROM ip_ports WHERE ip_id={$id} AND ip_user_id=" . $IP->user_id() . " LIMIT 1;";
$q = $IP->db()->query($sql) or die("Error {$sql}");
$r = $q->fetch(PDO::FETCH_ASSOC);
if (!$r) {
    die("Error");
}
echo "<input type='hidden' id='ip_id' value=" . $r['ip_id'] . ">";
?>

<section class="content-header">
  <h1><i class='fa fa-terminal'></i> <?php 
echo $r['ip_ip'] . ":" . $r['ip_port'];
?>
</h1>
</section>
Esempio n. 7
0
<?php

header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$IP = new IP\IP();
if (!$IP->user_id()) {
    die("Login error");
}
switch ($_POST['do']) {
    case 'newPort':
        //print_r($_POST);
        $dat = $_POST['port'];
        $ip = explode(":", $dat)[0];
        $port = explode(":", $dat)[1];
        $sql = "INSERT INTO ip_ports (ip_user_id,ip_ip,ip_port,ip_name) ";
        $sql .= "VALUES ('" . $IP->user_id() . "'," . $IP->db()->quote($ip) . "," . $IP->db()->quote($port) . "," . $IP->db()->quote($dat) . ");";
        $q = $IP->db()->query($sql) or die(print_r($IP->db()->errorInfo(), true) . "<hr />{$sql}");
        echo "document.location.href='?';";
        //brutal!
        exit;
    case 'editPort':
        //print_r($_POST);
        $id = $_POST['id'] * 1;
        $sql = "SELECT * FROM ip_ports WHERE ip_id={$id};";
        $q = $IP->db()->query($sql) or die("Error {$sql}");
        $r = $q->fetch(PDO::FETCH_ASSOC);
        //print_r($r);
        echo "\$('#ip_id').val({$id});\n";
        echo "\$('#ip_ip').val('" . $r['ip_ip'] . "');\n";
        echo "\$('#ip_port').val('" . $r['ip_port'] . "');\n";
Esempio n. 8
0
<?php

header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
//$_SERVER['REMOTE_ADDR']='61.15.194.152';//deboug
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
//echo 'ok';
$admin = new LTE\AdminLte2();
//$admin->config()->title=$REMOTE_ADDR;
//menu override//
$IP = new IP\IP();
$admin->config()->menu = $IP->menuleft();
if (!$IP->is_staff()) {
    $admin->config()->layout->{'sidebar-collapse'} = true;
    //print_r($IP->user());
}
echo $admin;
?>

<section class="content-header container">
  <h1><?php 
echo $_SERVER['REMOTE_ADDR'];
?>
</h1>
</section>

<section class="content container">

	<div class="col-md-12">	
	<?php 
Esempio n. 9
0
<?php

header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$IP = new IP\IP();
if (!$IP->user_id()) {
    die("Login error");
}
switch ($_POST['do']) {
    case 'newRoute':
        //print_r($_POST);
        $dat = $_POST['port'];
        $ip = explode(":", $dat)[0];
        $port_fr = explode(":", $dat)[1];
        $port_to = 0;
        $name = 'new';
        $comment = '';
        //$sql ="INSERT INTO ip_routes (ir_user_id,ir_ip,ir_port_from,ir_name) ";
        //$sql.="VALUES ('".$IP->user_id()."',".$IP->db()->quote($ip).",".$IP->db()->quote($port).",".$IP->db()->quote($dat).");";
        //$q=$IP->db()->query($sql) or die(print_r($IP->db()->errorInfo(), true) . "<hr />$sql");
        $IP->routeCreate($name, $ip, $port_fr, $port_to, $comment);
        echo "document.location.href='?';";
        //brutal!
        exit;
    case 'getRoute':
        //print_r($_POST);
        $id = $_POST['id'] * 1;
        $sql = "SELECT * FROM ip_routes WHERE ir_id={$id};";
        $q = $IP->db()->query($sql) or die("Error {$sql}");
        $r = $q->fetch(PDO::FETCH_ASSOC);