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