aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCassio de Campos <cassiopc@gmail.com>2017-10-19 13:36:44 +0000
committerCassio de Campos <cassiopc@gmail.com>2017-10-19 13:36:44 +0000
commit380285bd9dadbd9e8fc7f9217044560e1efa6981 (patch)
treef9d8ecaabd740141556bb341198309fc8d62dc93
parentc416fd4f6f06bd8c2a35288821e280dd45034375 (diff)
downloadboca-380285bd9dadbd9e8fc7f9217044560e1efa6981.tar.gz
boca-380285bd9dadbd9e8fc7f9217044560e1efa6981.zip
bf
-rw-r--r--src/admin/site.php12
-rw-r--r--src/fcontest.php8
2 files changed, 13 insertions, 7 deletions
diff --git a/src/admin/site.php b/src/admin/site.php
index 986f57e..dd88d1c 100644
--- a/src/admin/site.php
+++ b/src/admin/site.php
@@ -26,12 +26,18 @@ if ($main) {
if(isset($_GET["Number"]) && isset($_GET["Go"]) && is_numeric($_GET["Number"]) && $_GET["Number"]>0) {
$param = array();
$param['number'] = $_GET["Number"];
- $n = DBNewSite($_SESSION["usertable"]["contestnumber"],null,$param);
+ if(($n = DBNewSite($_SESSION["usertable"]["contestnumber"],null,$param)) === false) {
+ MSGError("Error creating site");
+ $n = 1;
+ }
ForceLoad("site.php?site=$n");
}
if(isset($_GET["new"]) && $_GET["new"]=="1") {
- $n = DBNewSite($_SESSION["usertable"]["contestnumber"]);
- ForceLoad("site.php?site=$n");
+ if(($n = DBNewSite($_SESSION["usertable"]["contestnumber"])) === false) {
+ MSGError("Error creating site");
+ $n = 1;
+ }
+ ForceLoad("site.php?site=$n");
}
}
if (isset($_GET["site"]) && is_numeric($_GET["site"]))
diff --git a/src/fcontest.php b/src/fcontest.php
index e4a6f5d..f8f2cff 100644
--- a/src/fcontest.php
+++ b/src/fcontest.php
@@ -1121,8 +1121,8 @@ function DBNewSite ($contest, $c=null, $param=array()) {
} else {
$a = DBGetRow ("select * from sitetable where contestnumber=$contest and sitenumber=$number", 0, $c);
if($a != null) {
- if($cw) DBExec($c, "commit work");
- return 1;
+ if($cw) DBExec($c, "commit work");
+ return false;
}
}
if($duration=='') $duration = $ct["contestduration"];
@@ -1140,7 +1140,7 @@ function DBNewSite ($contest, $c=null, $param=array()) {
$ct["contestlastmileanswer"].",".$ct["contestlastmilescore"].
", $duration, 't', '$number', '$number', '$number', $sitescorelevel, 0, 0, 0, 0, 10, $updatetime)")) {
if($cw) DBExec($c, "commit work");
- return 1;
+ return false;
}
$cf=globalconf();
@@ -1160,7 +1160,7 @@ function DBNewSite ($contest, $c=null, $param=array()) {
if($cw) DBExec($c, "commit work");
LOGLevel("User " . $_SESSION["usertable"]["username"]."/". $_SESSION["usertable"]["usersitenumber"] .
" created site $number on contest $contest.",2);
- return 2;
+ return $number;
}
function DBUserUpdate($contest, $site, $user, $username, $userfull, $userdesc, $passo, $passn) {