diff options
Diffstat (limited to 'src/globals.php')
| -rwxr-xr-x | src/globals.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/globals.php b/src/globals.php index 1d449c1..fbbecce 100755 --- a/src/globals.php +++ b/src/globals.php @@ -146,6 +146,7 @@ function revertupdatebocafile($dirboca, $t) { return $ok; } function cleardir($dir,$cddir=true,$secure=true,$removedir=true) { + if(file_exists($dir)) { if(is_dir($dir)) { $ds = DIRECTORY_SEPARATOR; if($ds=="") $ds = "/"; @@ -166,6 +167,7 @@ function cleardir($dir,$cddir=true,$secure=true,$removedir=true) { file_put_contents($dir,str_repeat('XXXXXXXXXX',10000)); @unlink($dir); } + } } // gen random alphanum string @@ -318,12 +320,13 @@ function ValidSession() { // $_SESSION["usertable"]["usersession"] != session_id()) return(FALSE); // } else { if($_SESSION["usertable"]["usersession"] != session_id()) return(FALSE); - // } - if($_SESSION["usertable"]["usermultilogin"] == 't') return(TRUE); - + // } $tmp = DBUserInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"]); + if($tmp['usersession']=='') return(FALSE); + if($_SESSION["usertable"]["usermultilogin"] == 't') return(TRUE); + if ($tmp["userip"] != $gip) return(FALSE); //cassiopc: they may create a problem here too... return(TRUE); } |