From c8994053b1ff9ccf47b532be6567c0f7f33f5f3c Mon Sep 17 00:00:00 2001 From: Cassio de Campos Date: Fri, 24 Aug 2018 21:08:09 +0200 Subject: fixed typos, back some required files --- src/scoretable.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/scoretable.php') diff --git a/src/scoretable.php b/src/scoretable.php index 3f785f3..2010bc1 100644 --- a/src/scoretable.php +++ b/src/scoretable.php @@ -91,7 +91,7 @@ if($ds=="") $ds = "/"; $scoretmp = $_SESSION["locr"] . $ds . "private" . $ds . "scoretmp" . $ds . $_SESSION["usertable"]["usertype"] . '-' . $_SESSION["usertable"]["username"] . ".php"; $redo = TRUE; if(file_exists($scoretmp)) { - if(($strtmp = file_get_contents($scoretmp,FALSE,NULL,-1,100000)) !== FALSE) { + if(($strtmp = file_get_contents($scoretmp,FALSE,NULL,0,5000000)) !== FALSE) { list($d) = sscanf($strtmp,"%*s %d"); if($d > time() - $actualdelay) { $redo = FALSE; @@ -398,11 +398,14 @@ if($redo) { if(isset($conf['doenc']) && $conf['doenc']) $strtmp = " \n" . encryptData($strtmp,$conf["key"],false); else $strtmp = " \n" . $strtmp; - if(file_put_contents($scoretmp, $strtmp,LOCK_EX)===FALSE) { + $randnum = session_id() . "_" . rand(); + if(file_put_contents($scoretmp . "_" . $randnum, $strtmp,LOCK_EX)===FALSE) { if($_SESSION["usertable"]["usertype"] == 'admin') { MSGError("Cannot write to the score cache file -- performance might be compromised"); } LOGError("Cannot write to the ".$_SESSION["usertable"]["usertype"]."-score cache file -- performance might be compromised"); + } else { + @rename($scoretmp . "_" . $randnum, $scoretmp); } $conf=globalconf(); if(isset($conf['doenc']) && $conf['doenc']) -- cgit v1.2.3