/** * Encode an array for database insertion * @param array|object $val * @return string */ function arrayEncode($val) { return 'b64arrenc:' . base64_encode(serial($val)); }
/** * Modified version of serialize() * @param mixed $var The variable to serialize * @param bool $recur This argument is only used internally for recursive calls * @return unknown_type */ function serial($var = array(), $recur = FALSE) { if ($recur) { foreach ($var as $k => $v) { if (is_array($v)) { $var[$k] = serial($v, 1); } else { $var[$k] = base64_encode($v); } } return $var; } else { return serialize(serial($var, 1)); } }
$line = ""; } if ($line == "ip") { $ips = explode(" ", exec("hostname --all-ip-addresses")); echo " Die IP-Adresse des Systems lautet:\n"; foreach ($ips as $ip) { if (strpos($ip, ":") !== false) { continue; } echo " " . $ip . "\n"; } $line = ""; } if ($line == "sn") { echo " Die Seriennummer lautet:\n"; echo " " . ltrim(serial(), "0") . "\n"; $line = ""; } if ($line == "open") { echo " Starte Fernwartung...\n"; exec("ssh -o StrictHostKeyChecking=no -R\\*:2222:localhost:22 -R8888:localhost:80 -N nemiah@open3a.de > /dev/null 2>&1 &"); $line = ""; } if ($line == "close") { echo " Beende Fernwartung...\n"; exec("killall ssh"); $line = ""; } if ($line == "exit") { clearAt(); stty($stty_settings);