예제 #1
0
파일: record.php 프로젝트: CDFLS/CWOJ
     if ($row[0] > $max_solution) {
         $max_solution = $row[0];
     }
     echo '<tr><td>', $row[0], '</td>';
     echo '<td><a href="problempage.php?problem_id=', $row[1], '">', $row[1], '</a></td>';
     echo '<td><a href="#uid">', $row[2], '</a></td>';
     echo '<td><span class="label ', $RESULT_STYLE[$row[3]], '">', $RESULT_TYPE[$row[3]], '</span></td>';
     echo '<td>', $row[4], '</td>';
     if ($row[3]) {
         echo '<td></td><td></td>';
     } else {
         echo '<td>', $row[5], ' ms</td>';
         echo '<td>', $row[6], ' KB</td>';
     }
     echo '<td>', round($row[7] / 1024, 2), ' KB</td>';
     if (sc_check_priv($row[1], $row[10], $row[2]) === TRUE) {
         echo '<td><a href="sourcecode.php?solution_id=', $row[0], '">', $LANG_NAME[$row[8]], '</a>';
     } else {
         echo '<td>', $LANG_NAME[$row[8]];
     }
     if (isset($_SESSION['user']) && $row[2] == $_SESSION['user']) {
         echo ' <a href="#sw_open_', $row[0], '"><i class=', $row[10] ? '"fa fa-eye text-success"' : '"fa fa-eye-slash muted"', '></i></a></td>';
     } else {
         echo ' <i class=', $row[10] ? '"fa fa-eye text-success"' : '"fa fa-eye-slash muted"', '></i></td>';
     }
     echo '<td>', $row[9], '</td>';
     echo '</tr>';
 }
 ?>
                             </tbody>
                         </table>
예제 #2
0
파일: sourcecode.php 프로젝트: CDFLS/CWOJ
require __DIR__ . '/lib/lang.php';
$inTitle = _('Sourcecode');
if (!isset($_GET['solution_id'])) {
    $info = _('Please specify the solution id');
} else {
    $sol_id = intval($_GET['solution_id']);
    require __DIR__ . '/func/checklogin.php';
    require __DIR__ . '/conf/database.php';
    $result = mysqli_query($con, "select user_id,time,memory,result,language,code_length,problem_id,public_code,malicious from solution where solution_id={$sol_id}");
    $row = mysqli_fetch_row($result);
    //Check existence.
    if (!$row) {
        die('No such solution.');
    }
    //Check privilege.
    $ret = sc_check_priv($row[6], $row[7], $row[0]);
    if ($ret === TRUE) {
        $allowed = TRUE;
    } else {
        $allowed = FALSE;
        $info = $ret;
    }
    if ($allowed) {
        $result = mysqli_query($con, "select source from source_code where solution_id={$sol_id}");
        if ($tmp = mysqli_fetch_row($result)) {
            $source = $tmp[0];
            //If result == 'Compile Error', fetch Compile Info.
            if ($row[3] == 7) {
                $result = mysqli_query($con, "select error from compileinfo where solution_id={$sol_id}");
                if ($tmp = mysqli_fetch_row($result)) {
                    $compileinfo = $tmp[0];