forked from BNUACM/bnuoj-web-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_sync_user.php
22 lines (22 loc) · 909 Bytes
/
admin_sync_user.php
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 username from user";
$result=mysql_query($query);
while ($row=mysql_fetch_row($result)) {
$qa="select runid from status where username='$row[0]'";
$ra=mysql_query($qa);
$na=mysql_num_rows($ra);
$qua=mysql_query("update user set total_submit=$na where username='$row[0]'");
// if ($ra) echo "Update Submits for $row[0], OK! Submits: $na<br>";
// else echo "Update Submits for $row[0], Failed!<br>";
$qa="select distinct pid from status where username='$row[0]' and result='Accepted'";
$ra=mysql_query($qa);
$na=mysql_num_rows($ra);
$qua=mysql_query("update user set total_ac=$na where username='$row[0]'");
// if ($qua) echo "Update ACs for $row[0], OK! ACs: $na<br>";
// else echo "Update ACs for $row[0], Failed!<br>";
}
echo "Success.";
}
?>