Example #1
0
function plug_upload($d, $p)
{
    if ($_GET['im']) {
        return upload_sav($d, $p);
    } else {
        return up_iframe($d, $p);
    }
}
function Configloaded()
{
    if (!is_file('/usr/bin/unzip')) {
        up_iframe("ERROR: unable to stat \"/usr/bin/unzip\", please advise your Administrator");
        exit;
    }
    $tmp_file = $_FILES['fichier']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        mkdir($content_dir);
    }
    if (!is_uploaded_file($tmp_file)) {
        up_iframe('{error_unable_to_upload_file}');
        exit;
    }
    $type_file = $_FILES['fichier']['type'];
    if (!strstr($type_file, 'application/octet-stream')) {
        if (!strstr($type_file, 'application/zip')) {
            up_iframe('{error_file_extension_not_match} :' . $type_file . ' did not match application/zip');
            exit;
        }
    }
    $name_file = $_FILES['fichier']['name'];
    $ext = file_ext($name_file);
    if (!strstr($ext, 'zip')) {
        up_iframe('{error_file_extension_not_match} :.' . $ext . ' did not match .zip');
        exit;
    }
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    $script_file = $content_dir . "/" . $name_file;
    if (!move_uploaded_file($tmp_file, $script_file)) {
        up_iframe("{error_unable_to_move_file} : {$tmp_file}");
        exit;
    }
    shell_exec("/usr/bin/unzip -j -o {$script_file} -d {$content_dir}/ >{$content_dir}/unzip.txt 2>&1");
    $output = explode("\n", @file_get_contents("{$content_dir}/unzip.txt"));
    $export = implode("<br>", $output);
    $handle = opendir($content_dir);
    $f = false;
    while (false !== ($file = readdir($handle))) {
        if (preg_match("#(.+?).ovpn\$#", $file)) {
            $export = $export . implode("<br>", import_ovpn("{$content_dir}/{$file}"));
            $f = true;
        }
    }
    if (!$f) {
        $res[] = "unable to find ovpn file...";
    }
    if (is_array($res)) {
        $export = $export . implode("<br>", $res);
    }
    $export = str_replace("{$content_dir}/", "", $export);
    up_iframe($export);
}
Example #3
0
function NTConfigloaded()
{
    $tmp_file = $_FILES['fichier']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        mkdir($content_dir);
    }
    if (!is_uploaded_file($tmp_file)) {
        up_iframe('{error_unable_to_upload_file}');
        exit;
    }
    $type_file = $_FILES['fichier']['type'];
    if (!strstr($type_file, 'application/octet-stream')) {
        up_iframe('{error_file_extension_not_match} :' . $type_file . ' did not match application/octet-stream');
        exit;
    }
    $name_file = $_FILES['fichier']['name'];
    $ext = file_ext($name_file);
    if (!strstr($ext, 'pol')) {
        up_iframe('{error_file_extension_not_match} :.' . $ext . ' did not match .pol');
        exit;
    }
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/NTconfig.pol")) {
        up_iframe("{error_unable_to_move_file} : {$content_dir}/NTconfig.pol");
        exit;
    }
    $_GET["moved_file"] = $content_dir . "/" . $name_file;
    $res = "{success}";
    $sock = new sockets();
    $sock->getfile("PushNTconfig:{$content_dir}/NTconfig.pol");
    up_iframe($res);
}