2016-07-18 16:39:37 +00:00
|
|
|
<?php
|
2022-03-17 04:00:03 +00:00
|
|
|
if (!Auth::check()) {
|
2022-04-02 10:01:26 +00:00
|
|
|
become403Page(UOJLocale::get('need login'));
|
2022-03-17 04:00:03 +00:00
|
|
|
}
|
|
|
|
|
2016-07-18 16:39:37 +00:00
|
|
|
$conds = array();
|
|
|
|
|
|
|
|
$q_problem_id = isset($_GET['problem_id']) && validateUInt($_GET['problem_id']) ? $_GET['problem_id'] : null;
|
|
|
|
$q_submission_id = isset($_GET['submission_id']) && validateUInt($_GET['submission_id']) ? $_GET['submission_id'] : null;
|
|
|
|
$q_hacker = isset($_GET['hacker']) && validateUsername($_GET['hacker']) ? $_GET['hacker'] : null;
|
|
|
|
$q_owner = isset($_GET['owner']) && validateUsername($_GET['owner']) ? $_GET['owner'] : null;
|
2020-06-25 12:41:16 +00:00
|
|
|
if ($q_problem_id != null) {
|
2016-07-18 16:39:37 +00:00
|
|
|
$conds[] = "problem_id = $q_problem_id";
|
|
|
|
}
|
2020-06-25 12:41:16 +00:00
|
|
|
if ($q_submission_id != null) {
|
2016-07-18 16:39:37 +00:00
|
|
|
$conds[] = "submission_id = $q_submission_id";
|
|
|
|
}
|
2020-06-25 12:41:16 +00:00
|
|
|
if ($q_hacker != null) {
|
2016-07-18 16:39:37 +00:00
|
|
|
$conds[] = "hacker = '$q_hacker'";
|
|
|
|
}
|
2020-06-25 12:41:16 +00:00
|
|
|
if ($q_owner != null) {
|
2016-07-18 16:39:37 +00:00
|
|
|
$conds[] = "owner = '$q_owner'";
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_all = ' selected="selected"';
|
|
|
|
$selected_succ ='';
|
|
|
|
$selected_fail ='';
|
2020-06-25 12:41:16 +00:00
|
|
|
if (isset($_GET['status']) && validateUInt($_GET['status'])) {
|
|
|
|
if ($_GET['status'] == 1) {
|
2016-07-18 16:39:37 +00:00
|
|
|
$selected_all = '';
|
|
|
|
$selected_succ =' selected="selected"';
|
|
|
|
$conds[] = 'success = 1';
|
|
|
|
}
|
2020-06-25 12:41:16 +00:00
|
|
|
if ($_GET['status'] == 2) {
|
2016-07-18 16:39:37 +00:00
|
|
|
$selected_all = '';
|
|
|
|
$selected_fail = ' selected="selected"';
|
|
|
|
$conds[] = 'success = 0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($conds) {
|
|
|
|
$cond = join($conds, ' and ');
|
|
|
|
} else {
|
|
|
|
$cond = '1';
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<?php echoUOJPageHeader(UOJLocale::get('hacks')) ?>
|
2019-09-10 02:15:20 +00:00
|
|
|
<div class="d-none d-sm-block">
|
2016-07-18 16:39:37 +00:00
|
|
|
<?php if ($myUser != null): ?>
|
2019-09-10 02:15:20 +00:00
|
|
|
<div class="float-right">
|
2016-07-18 16:39:37 +00:00
|
|
|
<a href="/hacks?hacker=<?= $myUser['username'] ?>" class="btn btn-success btn-sm"><?= UOJLocale::get('problems::hacks by me') ?></a>
|
|
|
|
<a href="/hacks?owner=<?= $myUser['username'] ?>" class="btn btn-danger btn-sm"><?= UOJLocale::get('problems::hacks to me') ?></a>
|
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
|
|
|
<form id="form-search" class="form-inline" role="form">
|
|
|
|
<div id="form-group-submission_id" class="form-group">
|
|
|
|
<label for="input-submission_id" class="control-label"><?= UOJLocale::get('problems::submission id') ?>:</label>
|
|
|
|
<input type="text" class="form-control input-sm" name="submission_id" id="input-submission_id" value="<?= $q_submission_id ?>" maxlength="6" style="width:5em" />
|
|
|
|
</div>
|
|
|
|
<div id="form-group-problem_id" class="form-group">
|
|
|
|
<label for="input-problem_id" class="control-label"><?= UOJLocale::get('problems::problem id') ?>:</label>
|
|
|
|
<input type="text" class="form-control input-sm" name="problem_id" id="input-problem_id" value="<?= $q_problem_id ?>" maxlength="4" style="width:4em" />
|
|
|
|
</div>
|
|
|
|
<div id="form-group-hacker" class="form-group">
|
|
|
|
<label for="input-hacker" class="control-label"><?= UOJLocale::get('problems::hacker') ?>:</label>
|
|
|
|
<input type="text" class="form-control input-sm" name="hacker" id="input-hacker" value="<?= $q_hacker ?>" maxlength="100" style="width:10em" />
|
|
|
|
</div>
|
|
|
|
<div id="form-group-owner" class="form-group">
|
|
|
|
<label for="input-owner" class="control-label"><?= UOJLocale::get('problems::owner') ?>:</label>
|
|
|
|
<input type="text" class="form-control input-sm" name="owner" id="input-owner" value="<?= $q_owner ?>" maxlength="100" style="width:10em" />
|
|
|
|
</div>
|
|
|
|
<div id="form-group-status" class="form-group">
|
|
|
|
<label for="input-status" class="control-label"><?= UOJLocale::get('problems::result') ?>:</label>
|
|
|
|
<select class="form-control input-sm" id="input-status" name="status">
|
|
|
|
<option value=""<?= $selected_all?>>All</option>
|
|
|
|
<option value="1"<?= $selected_succ ?>>Success!</option>
|
|
|
|
<option value="2"<?= $selected_fail ?>>Failed.</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2019-09-10 02:15:20 +00:00
|
|
|
<button type="submit" id="submit-search" class="btn btn-secondary btn-sm ml-2"><?= UOJLocale::get('search') ?></button>
|
2016-07-18 16:39:37 +00:00
|
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$('#form-search').submit(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
url = '/hacks';
|
|
|
|
qs = [];
|
|
|
|
$(['submission_id', 'problem_id', 'hacker', 'owner', 'status']).each(function () {
|
|
|
|
if ($('#input-' + this).val()) {
|
|
|
|
qs.push(this + '=' + encodeURIComponent($('#input-' + this).val()));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (qs.length > 0) {
|
|
|
|
url += '?' + qs.join('&');
|
|
|
|
}
|
|
|
|
location.href = url;
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<div class="top-buffer-sm"></div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
echoHacksList($cond, 'order by id desc', array('judge_time_hidden' => ''), $myUser);
|
|
|
|
?>
|
|
|
|
<?php echoUOJPageFooter() ?>
|