コード例 #1
0
ファイル: skin.class.php プロジェクト: strangerandy/raid
 function tabs($num, $mass = false, $option = array(), $function = false)
 {
     $num = intval($num);
     $hash = hashs();
     $name = $this->in_array($mass);
     $function = $this->in_array($function);
     for ($i = 1; $num >= $i; $i++) {
         if (preg_match("#\\[li\\](.*?)\\[\\/li\\]#si", $this->skin['tabs'], $html)) {
             $res = $this->replase("/{name}/", $name[$i], $html[1]);
             if ($i == 1) {
                 $res = $this->replase("/{class}/", 'active', $res);
             } else {
                 $res = $this->replase("/{class}/", '', $res);
             }
             $res = $this->replase("/{id}/", $i, $res);
             $res = $this->replase("/{hash}/", $hash, $res);
             $i_fun = $function[$i] ? ';' . $function[$i] : '';
             $res = $this->replase("/{function}/", $i_fun, $res);
             $output .= $res;
         }
         if (preg_match("#\\[content\\](.*?)\\[\\/content\\]#si", $this->skin['tabs'], $cbi)) {
             $res_c = $this->replase("/{content}/", $option[$i], $cbi[1]);
             $res_c = $this->replase("/{id}/", $i, $res_c);
             $res_c = $this->replase("/{hash}/", $hash, $res_c);
             if ($i == 1) {
                 $res_c = $this->replase("/{class}/", 'tabs_active', $res_c);
             } else {
                 $res_c = $this->replase("/{class}/", '', $res_c);
             }
             $content .= $res_c;
         }
     }
     $tabs = $this->replase("#\\[li\\](.*?)\\[\\/li\\]#si", $output, $this->skin['tabs']);
     $tabs = $this->replase("#\\[content\\](.*?)\\[\\/content\\]#si", $content, $tabs);
     return $tabs;
 }
コード例 #2
0
ファイル: upload.php プロジェクト: shibunath/Plagiarism
    foreach ($b as $key) {
        $sumVal += ord($key);
    }
    return $sumVal % 50;
}
if (isset($_FILES['cfile']) && isset($_FILES['rfile'])) {
    $rfile = $_FILES['rfile']['name'];
    $cfile = $_FILES['cfile']['name'];
    $matched = array();
    $words = getWords(fread(fopen($rfile, 'r'), filesize($rfile)));
    $words1 = getWords(fread(fopen($cfile, 'r'), filesize($cfile)));
    $x = 0;
    $per = 0;
    foreach ($words as $val) {
        foreach ($words1 as $val1) {
            if (hashs($val) === hashs($val1)) {
                if ($val === $val1) {
                    $x++;
                    array_push($matched, $val1);
                }
            }
        }
    }
    if ($x > 0) {
        $per = $x / count($words1) * 100;
    }
    print_r("<center><font color=red size=6>" . $per . "%" . " Plagiarism" . "</font></center><br>");
    foreach ($matched as $d) {
        //	print_r($d."<br>");
    }
    $contents = file_get_contents($cfile);