function _check_header($fd)
	{
		fseek($fd, 0, SEEK_SET);
		$buf = fread($fd, 32);
		if (strlen($buf) !== 32) return false;
		$hdr = unpack('a3tag/Cver/Ibase/Iprime/Ifsize/fcheck/a12reversed', $buf);
		if ($hdr['tag'] != XDB_TAGNAME) return false;

		// check the fsize
		$fstat = fstat($fd);
		if ($fstat['size'] != $hdr['fsize'])
			return false;

		// check float?
		
		$this->hash_base = $hdr['base'];
		$this->hash_prime = $hdr['prime'];
		$this->version = $hdr['ver'];
		$this->fsize = $hdr['fsize'];
		return true;
	}
function _check_header($fd)
	{
		fseek($fd, 0, SEEK_SET);
		$buf = fread($fd, 32);
		if (strlen($buf) !== 32) return false;
		$hdr = unpack('a3tag/Cver/Ibase/Iprime/Ifsize/fcheck/a12reversed', $buf);
		if ($hdr['tag'] != XDB_TAGNAME) return false;

		// check the fsize
		$fstat = fstat($fd);
		if ($fstat['size'] != $hdr['fsize'])
			return false;

		// check float?
		
		$this->hash_base = $hdr['base'];
		$this->hash_prime = $hdr['prime'];
		$this->version = $hdr['ver'];
		$this->fsize = $hdr['fsize'];
		return true;
	}
function _check_header ( $ fd ) { fseek ( $ fd , 0 , SEEK_SET ) ; $ buf = fread ( $ fd , 32 ) ; if ( strlen ( $ buf ) !== 32 ) return false ; $ hdr = unpack ( 'a3tag/Cver/Ibase/Iprime/Ifsize/fcheck/a12reversed' , $ buf ) ; if ( $ hdr [ 'tag' ] != XDB_TAGNAME ) return false ; // check the fsize $ fstat = fstat ( $ fd ) ; if ( $ fstat [ 'size' ] != $ hdr [ 'fsize' ] ) return false ; // check float? $ this -> hash_base = $ hdr [ 'base' ] ; $ this -> hash_prime = $ hdr [ 'prime' ] ; $ this -> version = $ hdr [ 'ver' ] ; $ this -> fsize = $ hdr [ 'fsize' ] ; return true ; }
Check XDB Header
Check XDB Header