Skip to content

Instantly share code, notes, and snippets.

@eur0pa
Created November 15, 2015 16:13
Show Gist options
  • Save eur0pa/a0b4a5c39258ee0105e1 to your computer and use it in GitHub Desktop.
Save eur0pa/a0b4a5c39258ee0105e1 to your computer and use it in GitHub Desktop.
score.php
// insert detailed score rundown from cdata details
// same for everybody
$details = array();
$details_str = $score['details'];
// old versions still have 10 scores
// new patch goes up to 15
// first versions have none, so we have to pre-populate
// the array or the insert statement will fail
for ($i = 0; $i < 16; $i++) {
$details[$i] = 0;
}
for ($i = 0; $i <= strlen($details_str) - 1; $i += 8) {
$hex = substr($details_str, $i, 8);
$dec = implode('', array_reverse(str_split($hex, 2)));
$details[($i/8)+1] = hexdec($dec);
}
$details[0] = $score['hash'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment