Skip to content

Commit

Permalink
fix: 修复错误超过10次不显示视频的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
daizeyao committed Nov 27, 2024
1 parent 9f45904 commit 0c5f341
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
21 changes: 10 additions & 11 deletions web/OJ/problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

if (isset($OJ_LANG)) require_once("./lang/$OJ_LANG.php");

if(isset($_SESSION['user_id'])){
$uid = $mysqli->real_escape_string($_SESSION['user_id']);
}
/* 获取我的标签 start */
// $my_tag;
// if(isset($_SESSION['user_id'])){
// $uid = $mysqli->real_escape_string($_SESSION['user_id']);
// }
// if (isset($_SESSION['user_id']) && isset($_GET['id'])) {
// $id=intval($_GET['id']);
// $sql = "SELECT tag FROM tag WHERE user_id='$uid' AND problem_id='$id'";
Expand Down Expand Up @@ -70,15 +70,15 @@
$sql = "SELECT * FROM `problem` WHERE `problem_id`=$id";
} else
$sql = <<<SQL
SELECT
*
FROM
SELECT
*
FROM
problem
WHERE
defunct='N'
WHERE
defunct='N'
AND problem_id=$id
AND problem_id
NOT IN (
NOT IN (
SELECT DISTINCT
contest_problem.problem_id
FROM
Expand Down Expand Up @@ -236,7 +236,7 @@
//get try times and determine if he can see the video END


//get the gptCode STRAT
//get the gptCode STRAT
$isHaveGPTCode = false;
$GPTCode = NULL;
$sql = "SELECT code FROM gpt_code WHERE problem_id='$real_id'";
Expand Down Expand Up @@ -286,4 +286,3 @@
if (file_exists('./include/cache_end.php'))
require_once('./include/cache_end.php');
?>

44 changes: 22 additions & 22 deletions web/OJ/template/hznu/problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<?php

if (isset($_GET['cid'])) require_once("contest_header.php");
if (isset($_GET['cid'])) require_once("contest_header.php");
else require_once("header.php");

//比赛期间暂时关闭
Expand Down Expand Up @@ -346,10 +346,10 @@ function sss($str){
}
?>

<?php
if (isset($_GET['cid'])) {
$can_see_video = 0;
}
<?php
// if (isset($_GET['cid'])) {
// $can_see_video = 0;
// }
?>

<?php if ($can_see_video || HAS_PRI("watch_solution_video")): ?>
Expand All @@ -359,27 +359,27 @@ function sss($str){
<input type="hidden" name="pid" value="<?php echo $real_id ?>" placeholder="">
<button class="am-btn am-btn-success am-btn-lg">Click To Watch The Video</button>
</form>
<?php else: ?>
<button disabled="1" class="am-btn am-btn-default am-btn-lg">No Solution Video</button>
<?php endif ?>
<div style="display: block; color: grey; padding-bottom: 20px;">
*if you see this button, it means you've submited more than <?php echo $VIDEO_SUBMIT_TIME ?> times.
</div>
<?php else: ?>
<button disabled="1" class="am-btn am-btn-default am-btn-lg">No Solution Video</button>
<?php endif ?>
<div style="display: block; color: grey; padding-bottom: 20px;">
*if you see this button, it means you've submited more than <?php echo $VIDEO_SUBMIT_TIME ?> times.
</div>
<?php endif ?>

<!-- gptcode start -->
<?php if ($isHaveGPTCode && !isset($_GET['cid'])) : ?>
<?php
echo <<<HTML
<h2>GPT Hint</h2>
<pre><code>$GPTCode</code></pre>
<!-- gptcode start -->
<?php if ($isHaveGPTCode && !isset($_GET['cid'])) : ?>
<?php
echo <<<HTML
<h2>GPT Hint</h2>
<pre><code>$GPTCode</code></pre>
HTML;
?>
<?php endif ?>
?>
<?php endif ?>

<!-- 添加一个具有一定高度的空白 div -->
<div style="height: 20px;"></div>
<!-- gptcode end -->
<!-- 添加一个具有一定高度的空白 div -->
<div style="height: 20px;"></div>
<!-- gptcode end -->


<!-- 提交等按钮 start -->
Expand Down

0 comments on commit 0c5f341

Please sign in to comment.