Skip to content

Instantly share code, notes, and snippets.

@nprussell
Created June 13, 2016 14:50
Show Gist options
  • Select an option

  • Save nprussell/7442adbfd1928cda1c055a96b9362f7e to your computer and use it in GitHub Desktop.

Select an option

Save nprussell/7442adbfd1928cda1c055a96b9362f7e to your computer and use it in GitHub Desktop.
$uploadedFile = "uploads/out.upz";
$handle = fopen($uploadedFile, 'rb');
if( ! $handle ) {
throw new Exception( "Can't open file" );
}
$buffer = fread( $handle, 14 );
while (($read = fgetc($handle)) !== "\0") {
$buffer .= $read;
}
$header_format =
'A3Magic/' .
'v1UpdaterVer/' .
'C1TestingMode/' .
'V2BuildTime/' .
'A5BuildVersion' ;
$buildTime64 = $header_format['BuildTime1'] + ($header_format['BuildTime2'] * 0x100000000);
$header = unpack ($header_format, $buffer);
print_r($header);
//echo $str;
fclose( $handle );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment