$key = mb_convert_encoding($password, "UTF-8");
$iv = base64_decode($iv_post, true);
$msg = base64_decode($msg_post, true);
if ($iv && $msg) {
    // MCRYPT_RIJNDAEL_128, we use a 16 bit key.
    $json_data = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $msg, MCRYPT_MODE_CBC, $iv);
    $data = json_decode(ltrim($json_data), true);
    if (!array_key_exists('nettype', $data)) {
        // Not upgraded nodes.
        $db->update_node($ip_address, $data['blocks'], $data['connections'], $data['difficulty'], $data['nethashrate']);
    } else {
        if ($db->get_conf("nettype") == 0 && $data['nettype'] == 'default') {
            $db->update_node($ip_address, $data['blocks'], $data['connections'], $data['difficulty'], $data['nethashrate']);
        } else {
            if ($data['nettype'] == 'multi-algo') {
                $db->update_node_ma($ip_address, $data['blocks'], $data['connections'], $data['difficulty_sha256d'], $data['difficulty_scrypt'], $data['difficulty_groestl'], $data['difficulty_qubit'], $data['difficulty_skein']);
            } else {
                die("Nettype mismatch.");
            }
        }
    }
}
if ($db->get_conf("slack-hook") == 1) {
    $offline_nodes = $db->get_offline_nodes();
    if (count($offline_nodes) > 0) {
        $timeout = $db->get_conf("hooks-slack-timeout");
        if ($timeout < time()) {
            // Run Slack webhook.
            foreach ($offline_nodes as $name) {
                $message = "Seed node {$name} seems to be offline.";
                slack_send($message);