f3netze git repositories f3nsub / master function.php
master

Tree @master (Download .tar.gz)

function.php @masterraw · history · blame

<?php
function getrout($ip)
{
        require __DIR__ . '/vendor/autoload.php';
        $a = shell_exec('echo "dump" | nc ::1 33123 -q 0 | grep "prefix 2a0b:f4c0"');
        $a = explode("from", $a);
        unset($a[count($a)-1]);
        $c = array();
        $d = array();
        foreach ($a as $value) {
               $b = explode(" ",trim($value));
               $b = array_pop($b);
               array_push($c,$b);
        }
        $c = array_unique($c);
        foreach ($c as $value) {
               $e = explode("/",trim($value));
               array_push($d,$e[0]);
        }
        foreach ($d as $value) {
               if (IPTools\Range::parse($ip)->contains(new IPTools\IP($value))) {
                return true;
               }
        }
}


function zahlinwort($zahl)
{
	$Return = array('Null', 'Eins', 'Zwei', 'Drei', 'Vier', 'F&uuml;nf', 'Sechs', 'Sieben', 'Acht', 'Neun', 'Zehn');

	return $Return[$zahl];
}

function captcha()
{
	$zahl1 = rand(0, 9);
	$zahl2 = rand(0, 9);
	$zeichen = rand(1, 2);
	if ($zeichen == 1) {
		$zeichen1 = "+";
		$_SESSION["erg"] = $zahl1 + $zahl2;
	}
	if ($zeichen == 2) {
		$zeichen1 = "*";
		$_SESSION["erg"] = $zahl1 * $zahl2;
	}

	return zahlinwort($zahl1) . ' ' . $zeichen1 . ' ' . zahlinwort($zahl2) . ' ergibt:';
}