Esempio n. 1
0
 public static function guid($op = false, $namespace = '')
 {
     $uid = uniqid("", true);
     $data = $namespace;
     $data .= $_SERVER['REQUEST_TIME'];
     $data .= $_SERVER['HTTP_USER_AGENT'];
     $data .= $_SERVER['SERVER_ADDR'];
     $data .= $_SERVER['SERVER_PORT'];
     $data .= $_SERVER['REMOTE_ADDR'];
     $data .= $_SERVER['REMOTE_PORT'];
     $hash = strtoupper(hash('ripemd128', $uid . self::$_GUID . md5($data)));
     if ($op) {
         self::$_GUID = substr($hash, 0, 32);
     } else {
         self::$_GUID = substr($hash, 0, 8) . '-' . substr($hash, 8, 4) . '-' . substr($hash, 12, 4) . '-' . substr($hash, 16, 4) . '-' . substr($hash, 20, 12);
     }
     return self::$_GUID;
 }