예제 #1
0
    $aes = new Crypt_AES(CRYPT_AES_MODE_ECB);
    $aes->setKey(md5($_REQUEST['password']));
    $text = $privatekey;
    $aes_encr = $aes->encrypt($text);
    $private_key = chunk_split(base64_encode($aes_encr), 64);
    $param = $param['pass'];
    $k_bg_path = ABSPATH . 'img/k_bg.png';
} else {
    $private_key = str_replace(array('-----BEGIN RSA PRIVATE KEY-----', '-----END RSA PRIVATE KEY-----'), '', $privatekey);
    $param = $param['nopass'];
}
$iPod = stripos($_SERVER['HTTP_USER_AGENT'], "iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'], "iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'], "iPad");
if ($iPod || $iPhone || $iPad) {
    $gd = key_to_img($private_key, $param, $_SESSION['user_id']);
    header('Content-Disposition: attachment; filename="Dcoin-private-key-' . $_SESSION['user_id'] . '.png"');
    header('Content-type: image/png');
    imagepng($gd);
} else {
    header('Content-Disposition: attachment; filename="Dcoin-private-key-' . $_SESSION['user_id'] . '.txt"');
    header('Content-type: text/plain');
    echo trim($private_key);
}
/*
echo json_encode(
		array(
					'private_key' => $private_key,
					'public_key' => $publickey,
					'password_hash' => hash('sha256', hash('sha256', @$_POST['password']))
				 )
예제 #2
0
파일: new_user.php 프로젝트: scuba323/dcoin
$param = $param['nopass'];
$my_refs_keys = array();
if (empty($_SESSION['restricted'])) {
    $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `" . DB_PREFIX . MY_PREFIX . "my_new_users`.*,\n\t\t\t\t\t\t `log_id`\n\t\t\tFROM `" . DB_PREFIX . MY_PREFIX . "my_new_users`\n\t\t\tLEFT JOIN `" . DB_PREFIX . "users` ON `" . DB_PREFIX . "users`.`user_id` = `" . DB_PREFIX . MY_PREFIX . "my_new_users`.`user_id`\n\t\t\tWHERE `status` = 'approved'\n\t\t\t");
    while ($row = $db->fetchArray($res)) {
        // проверим, не сменил ли уже юзер свой ключ
        if ($row['log_id']) {
            $my_refs_keys[$row['user_id']] = array('user_id' => $row['user_id']);
        } else {
            $my_refs_keys[$row['user_id']] = $row;
            $k_path = ABSPATH . 'public/' . substr(md5($row['private_key']), 0, 16);
            $k_path_png = $k_path . '.png';
            $k_path_txt = $k_path . '.txt';
            if (!file_exists($k_path_png)) {
                $private_key = str_replace(array('-----BEGIN RSA PRIVATE KEY-----', '-----END RSA PRIVATE KEY-----'), '', $row['private_key']);
                $gd = key_to_img($private_key, $param, $row['user_id']);
                imagepng($gd, $k_path_png);
                file_put_contents($k_path_txt, trim($private_key));
            }
        }
    }
}
// инфа по рефам юзера
$res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `referral`, sum(`amount`) as `amount`,\n\t\t\t\t     `currency_id`\n\t\tFROM `referral_stats`\n\t\tWHERE `user_id` = {$user_id}\n\t\tGROUP BY `currency_id`,\n\t\t\t\t\t\t  `referral`\n\t\t");
$refs = array();
while ($row = $db->fetchArray($res)) {
    $refs[$row['referral']][$row['currency_id']] = $row['amount'];
}
$my_refs_amounts = array();
foreach ($refs as $ref_user_id => $ref_data) {
    $data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT *\n\t\t\tFROM `" . DB_PREFIX . "miners_data`\n\t\t\tWHERE `user_id` = {$ref_user_id}\n\t\t\tLIMIT 1\n\t\t\t", 'fetch_array');