修复复制竞赛没有名单的BUG
This commit is contained in:
@@ -29,13 +29,6 @@ if(isset($_POST['startdate'])){
|
||||
$password = $_POST['password'];
|
||||
$description = $_POST['description'];
|
||||
|
||||
if(false){
|
||||
$title = stripslashes($title);
|
||||
$private = stripslashes($private);
|
||||
$password = stripslashes($password);
|
||||
$description = stripslashes($description);
|
||||
}
|
||||
|
||||
$lang = $_POST['lang'];
|
||||
$langmask = 0;
|
||||
foreach($lang as $t){
|
||||
@@ -43,7 +36,6 @@ if(isset($_POST['startdate'])){
|
||||
}
|
||||
|
||||
$langmask = ((1<<count($language_ext))-1)&(~$langmask);
|
||||
//echo $langmask;
|
||||
|
||||
$sql = "INSERT INTO `contest`(`title`,`start_time`,`end_time`,`private`,`langmask`,`description`,`password`,`user_id`)
|
||||
VALUES(?,?,?,?,?,?,?,?)";
|
||||
@@ -83,21 +75,17 @@ if(isset($_POST['startdate'])){
|
||||
pdo_query($sql) ;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM `privilege` WHERE `rightstr`=?";
|
||||
pdo_query($sql,"c$cid");
|
||||
|
||||
$sql = "INSERT INTO `privilege` (`user_id`,`rightstr`) VALUES(?,?)";
|
||||
pdo_query($sql,$_SESSION[$OJ_NAME.'_'.'user_id'],"m$cid");
|
||||
|
||||
$_SESSION[$OJ_NAME.'_'."m$cid"] = true;
|
||||
$sql = "DELETE FROM `testusers` WHERE `contest_id`=?";
|
||||
pdo_query($sql, $cid);
|
||||
$pieces = explode("\n", trim($_POST['ulist']));
|
||||
$pieces = array_unique($pieces);
|
||||
if (count($pieces) > 0 && strlen($pieces[0]) > 0) {
|
||||
$sql_1 = "INSERT INTO `testusers`(`user_id`,`contest_id`) VALUES (?,?)";
|
||||
for ($i = 0; $i < count($pieces); $i++) {
|
||||
pdo_query($sql_1, trim($pieces[$i]), $cid);
|
||||
}
|
||||
}
|
||||
|
||||
if(count($pieces)>0 && strlen($pieces[0])>0){
|
||||
$sql_1 = "INSERT INTO `privilege`(`user_id`,`rightstr`) VALUES (?,?)";
|
||||
for($i=0; $i<count($pieces); $i++){
|
||||
pdo_query($sql_1,trim($pieces[$i]),"c$cid") ;
|
||||
}
|
||||
}
|
||||
echo "<script>window.location.href=\"contest_list.php\";</script>";
|
||||
}
|
||||
else{
|
||||
@@ -121,8 +109,8 @@ else{
|
||||
}
|
||||
|
||||
$ulist = "";
|
||||
$sql = "SELECT `user_id` FROM `privilege` WHERE `rightstr`=? order by user_id";
|
||||
$result = pdo_query($sql,"c$cid");
|
||||
$sql = "SELECT `user_id` FROM `testusers` WHERE `contest_id`=? order by user_id";
|
||||
$result = pdo_query($sql,$cid);
|
||||
|
||||
foreach($result as $row){
|
||||
if($ulist) $ulist .= "\n";
|
||||
|
||||
Reference in New Issue
Block a user