示例#1
0
function deleteFilesInDir($dir)
{
    c_log("files delete from dir = " . $dir);
    if (is_dir($dir)) {
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir . "/" . $object) == "dir") {
                    deleteFilesInDir($dir . "/" . $object);
                } else {
                    unlink($dir . "/" . $object);
                }
            }
        }
        reset($objects);
        rmdir($dir);
    }
}
示例#2
0
<?php

session_start();
include "../inc/chec.php";
include "../inc/func.php";
c_log();
echo "<script>alert('ɾ³ý³É¹¦£¡');lcation='data_stock.php';</script>";
示例#3
0
function getGlobalId($type, $id)
{
    global $ids;
    $uniqueStr = generateUniqueString($type, $id);
    //    echo $type . " <> " . $id . " <> " . $uniqueStr . " <> " . $ids[$uniqueStr] . " <> " . isset($ids[$uniqueStr]) . "\n";
    if (isset($ids[$uniqueStr])) {
        return $ids[$uniqueStr];
    } else {
        c_log("error. No global Id for ( type = " . $type . " , id = " . $id . " ) \n");
        return -1;
    }
}
示例#4
0
function printToFile($loc, $v_out, $e_out, $vs, $h_VGV, $h_VVG, $h_VA, $h_L, $h_EG)
{
    //    print_r("v<br>");
    //    print_r($v_out);
    //    print_r("e<br>");
    //    print_r($e_out);
    $r_number = rand(10000, 99999);
    $loc = $loc . "out-" . $r_number . "/";
    mkdir($loc, 0775);
    $v_l = array();
    foreach ($v_out as $v) {
        $l = $h_L[$v];
        array_push($v_l, $l);
    }
    $e_l = array();
    foreach ($e_out as $e) {
        $e_arr = preg_split("/[_]/", $e);
        //        echo "edges<br>";
        //        print_r($e_arr);
        $l1 = $e_arr[0];
        $l2 = $e_arr[1];
        $l = array($l1, $l2);
        array_push($e_l, $l);
    }
    foreach ($v_l as $l) {
        $file = fopen($loc . $h_L[$l] . ".txt", "w") or die("unable to create " . $loc . $h_L[$l] . ".txt" . " !");
        foreach ($vs as $vg) {
            if (!isset($h_VGV[$vg])) {
                continue;
            }
            $v_id = $h_VGV[$vg];
            $l_id = $v_id % 100;
            if ($l_id == $l) {
                c_log($l . " " . $v_id . "\n");
                $txt = intval($v_id / 100) . "\t" . $h_VA[$v_id] . "\n";
                fwrite($file, $txt);
            }
        }
        fclose($file);
    }
    foreach ($e_l as $l) {
        $l1 = $h_L[$l[0]];
        $l2 = $h_L[$l[1]];
        $file = fopen($loc . $h_L[$l1] . "_" . $h_L[$l2] . ".txt", "w") or die("unable to create " . $loc . $h_L[$l1] . "_" . $h_L[$l2] . ".txt" . " !");
        fwrite($file, $h_L[$l1] . "\t" . $h_L[$l2] . "\n");
        c_log($h_L[$l1] . " " . $h_L[$l2] . "\n");
        foreach ($vs as $vg) {
            $eg = $h_EG[$vg];
            if (!isset($h_VGV[$vg])) {
                continue;
            }
            $v_id = $h_VGV[$vg];
            $l_id = $v_id % 100;
            if ($l_id == $l1) {
                $v1 = intval($v_id) / 100;
                foreach ($eg as $vg2) {
                    if (!isset($h_VGV[$vg2])) {
                        continue;
                    }
                    $v2_id = $h_VGV[$vg2];
                    $l2_id = $v2_id % 100;
                    if ($l2_id == $l2 && in_array($h_VVG[$v2_id], $vs)) {
                        $txt = intval($v_id / 100) . "\t" . intval($v2_id / 100) . "\n";
                        fwrite($file, $txt);
                    }
                }
            }
        }
        fclose($file);
    }
    return $loc;
}