diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/admin/site.php | 12 | ||||
| -rw-r--r-- | src/fcontest.php | 8 |
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) { |