From: Matteo Nastasi (mop) Date: Sat, 19 Jan 2008 15:12:12 +0000 (+0000) Subject: obsolete tool X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=98b56bb041d45ebce75f8cf0c9c15a872e1a548f;p=brisk.git obsolete tool --- diff --git a/web/info_main.php b/web/info_main.php deleted file mode 100644 index 126c54f..0000000 --- a/web/info_main.php +++ /dev/null @@ -1,162 +0,0 @@ -name = $name; - $this->sess = $sess; - $this->table = $table; - } -} - -class brisco { - var $user; - - function brisco () { - $this->user = array(); - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - $this->user[$i] = new User("", "", ""); - } - } -} - -function init_data() -{ - $brisco = new brisco(); - - return $brisco; -} - -function load_data() -{ - if (($tok = ftok(FTOK_PATH."/main", "B")) == -1) { - echo "FTOK FAILED"; - exit; - } - echo "FTOK ".$tok."
"; - if (($res = sem_get($tok)) == FALSE) { - echo "SEM_GET FAILED"; - exit; - } - if (sem_acquire($res)) { - if ($shm = shm_attach($tok)) { - echo "fin qui
"; - $bri = @shm_get_var($shm, $tok); - } - - shm_detach($shm); - } - sem_release($res); - - return ($bri); -} - - -function save_data($bri) -{ - $ret = FALSE; - $shm = FALSE; - $isacq = FALSE; - - if (($tok = ftok(FTOK_PATH."/main", "B")) == -1) - return (FALSE); - - if (($res = sem_get($tok)) == FALSE) - return (FALSE); - - do { - if (sem_acquire($res) == FALSE) - break; - $isacq = TRUE; - - if (($shm = shm_attach($res)) == FALSE) - break; - - if (shm_put_var($shm, $res, $bri) == FALSE) - break; - $ret = TRUE; - } while (0); - - if ($shm) - shm_detach($shm); - - if ($isacq) - sem_release($res); - - return ($ret); -} - -function &check_session($bri, $sess) -{ - if (strlen($sess) == SESS_LEN) { - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - if (strcmp($sess, $bri->user[$i]->sess) == 0) { - // find it - return ($bri->user[$i]); - } - } - } - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - if ($bri->user[$i]->sess == "") { - $bri->user[$i]->sess = uniqid(""); - return ($bri->user[$i]); - } - } - - return (NULL); -} - -function duplicated_name($bri, $name) -{ - if (!isset($name)) - return (FALSE); - - for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { - if (strcmp($bri->user[$i]->name,$name) == 0) { - return (TRUE); - } - } - return (FALSE); -} - -function main() { - GLOBAL $sess, $name; - $bri = load_data(); - - echo ""; - var_dump($bri); -} - -main(); -?>