forked from BNUACM/bnuoj-web-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_sync_problem.php
More file actions
22 lines (22 loc) · 906 Bytes
/
admin_sync_problem.php
File metadata and controls
22 lines (22 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include("conn.php");
if (db_user_match($nowuser,$nowpass)&&db_user_isroot($nowuser)) {
$query="select pid from problem";
$result=mysql_query($query);
while ($row=mysql_fetch_row($result)) {
$qa="select runid from status where pid='$row[0]'";
$ra=mysql_query($qa);
$na=mysql_num_rows($ra);
$qua=mysql_query("update problem set total_submit=$na where pid='$row[0]'");
// if ($ra) echo "Update Submits for pid: $row[0], OK! Submits: $na<br>";
// else echo "Update Submits for pid: $row[0], Failed!<br>";
$qa="select runid from status where pid='$row[0]' and result='Accepted'";
$ra=mysql_query($qa);
$na=mysql_num_rows($ra);
$qua=mysql_query("update problem set total_ac=$na where pid='$row[0]'");
// if ($qua) echo "Update ACs for pid: $row[0], OK! ACs: $na<br>";
// else echo "Update ACs for pid: $row[0], Failed!<br>";
}
echo "Success.";
}
?>