Ejemplo n.º 1
0
     } else {
         $uid = 0;
     }
     $la[] = "`uid` = {$uid}";
 }
 if ($la) {
     $limit = "WHERE " . join(" AND ", $la);
 }
 if (isset($_GET['offset'])) {
     $offset = "OFFSET " . (int) $_GET['offset'];
 }
 $res = mysql_query("SELECT * FROM `submit` {$limit} ORDER BY `id` DESC LIMIT 50 {$offset}");
 while ($r = mysql_fetch_object($res)) {
     unset($r->code);
     $r->uname = getUserByID($r->uid)->name;
     $r->pname = getProblemByID($r->pid)->name;
     $list[] = $r;
 }
 mysql_free_result($res);
 if ($offset == '') {
     $offset = "OFFSET 50";
 } else {
     $offset = "OFFSET " . ((int) $_GET['offset'] + 50);
 }
 $msg = new stdClass();
 $res = mysql_query("SELECT * FROM `submit` {$limit} ORDER BY `id` DESC LIMIT 1 {$offset}");
 if (mysql_fetch_object($res)) {
     $msg->more = true;
 } else {
     $msg->more = false;
 }
Ejemplo n.º 2
0
<?php

require_once "query/message.php";
$DOJSS = $_COOKIE['DOJSS'];
$user = checkDOJSS($DOJSS);
if (!isset($_GET['pid'])) {
    send(1, '');
} else {
    $pid = $_GET['pid'];
}
if ($user) {
    $p = getProblemByID($pid);
    if ($p) {
        $p->sampleIn = $p->sampleOut = '';
        if (file_exists("{$oj_data}/{$pid}/0.in")) {
            $p->sampleIn = file_get_contents("{$oj_data}/{$pid}/0.in");
        }
        if (file_exists("{$oj_data}/{$pid}/0.out")) {
            $p->sampleOut = file_get_contents("{$oj_data}/{$pid}/0.out");
        }
        if ($p->sampleIn == '') {
            $p->sampleIn = "`N/A`";
        } else {
            $p->sampleIn = '>' . nl2br($p->sampleIn);
        }
        if ($p->sampleOut == '') {
            $p->sampleOut = "`N/A`";
        } else {
            $p->sampleOut = '>' . nl2br($p->sampleOut);
        }
        $pid = $p->id;