X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=7460da5388ef365b45fa4c93d4c57e241b558aad;hb=f8d98f354ae51f7223e08e8a3dfaa2b2b466c8dc;hp=4acf0a7b7e688712af421921e8c51e58fe54083c;hpb=71ce428520a8650430f38327a5d443c7222f89a6;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 4acf0a7..7460da5 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -808,39 +808,46 @@ class User { */ } - function step_set($step) { - $this->step = $step; - - do { - if (validate_sess($this->sess) == FALSE) - break; - if (file_exists(PROXY_PATH) == FALSE) - mkdir(PROXY_PATH); - if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE) - break; - fwrite($fp, pack("LL",$this->step, $this->idx)); - fclose($fp); - - return (TRUE); - } while (0); + function step_set($step) + { + $this->step = $step & 0x7fffffff; + + do { + if (validate_sess($this->sess) == FALSE) + break; + if (file_exists(PROXY_PATH) == FALSE) + mkdir(PROXY_PATH); + if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE) + break; + fwrite($fp, pack("LL",$this->step, $this->idx)); + fclose($fp); - return (FALSE); + log_main("step_set [".$this->sess. "] [".$this->step."]"); + + return (TRUE); + } while (0); + + return (FALSE); } - + function step_inc($delta = 1) { - $this->step += $delta; - - if (validate_sess($this->sess)) { - if (file_exists(PROXY_PATH) == FALSE) - mkdir(PROXY_PATH); - $fp = fopen(PROXY_PATH."/".$this->sess.".step", 'w'); - fwrite($fp, pack("LL", $this->step, $this->idx)); - fclose($fp); + $this->step += $delta; + /* modularization because unpack() not manage unsigned 32bit int correctly */ + $this->step &= 0x7fffffff; + + if (validate_sess($this->sess)) { + if (file_exists(PROXY_PATH) == FALSE) + mkdir(PROXY_PATH); + $fp = fopen(PROXY_PATH."/".$this->sess.".step", 'w'); + fwrite($fp, pack("LL", $this->step, $this->idx)); + fclose($fp); - return (TRUE); - } - - return (FALSE); + log_main("step_inc [".$this->sess. "] [".$this->step."]"); + + return (TRUE); + } + + return (FALSE); } function reset() { @@ -864,12 +871,12 @@ class User { // SHSPLIT save and load function for the User class. - function load_data($id) + static function load_data($id, $sess) { - GLOBAL $sess; - // error_log("User::load_data BEGIN", 0); + log_main("load_data: id [".$id."] sess [".($sess == FALSE ? "FALSE" : $sess)."] "); + $doexit = FALSE; do { if (($tok = @ftok(FTOK_PATH."/user".$id, "B")) == -1) {