コード例 #1
0
ファイル: index.php プロジェクト: epayinfo/simple_faucet
        $smarty->assign('epay_err_msg', $msg);
        unset($_SESSION['error']);
    }
    if ($solvemedia_active) {
        $smarty->assign('solvemedia_box', solvemedia_get_html($privkey));
    }
    if ($recap_active) {
        $smarty->assign('recaptcha_box', '<div class="g-recaptcha" data-sitekey="' . $recap_site . '"></div>');
    }
    if ($solvemedia_active) {
        $smarty->assign('solvemedia_active', true);
    } else {
        $smarty->assign('recap_active', true);
    }
    if ($faucet_steps == 2 && isset($_POST['step2'])) {
        check_wallet();
        $prize = $_SESSION['prize'];
        if (!isset($_SESSION['prize'])) {
            $prize = $_SESSION['prize'] = chance_creator($rewards);
        }
        $smarty->assign('step', 2);
    }
}
if ($adb) {
    $smarty->assign('adb', true);
}
if ($bwait) {
    $smarty->assign('bwait', true);
}
$smarty->assign('token_id', $csrf->get_token_id());
$smarty->assign('token', $csrf->get_token());
コード例 #2
0
ファイル: install.lib.php プロジェクト: cyberpay/multifaucet
function install_process_post_request($step, &$vars = array())
{
    $redirect_complete = "";
    try {
        switch ($step) {
            case 2:
                //Check if Config directory is writable
                if (!@touch(APPLICATION_CONFDIR)) {
                    throw new Exception("Configuration directory is not writable", 2);
                }
                break;
            case 3:
                //Database Setup
                write_db_config($_POST['baseserver'], $_POST['basename'], $_POST['baseuser'], $_POST['basepass'], $_POST['tableprefix'], APPLICATION_CONFDIR . 'db.conf.php');
                if ($vars['clean_install']) {
                    install_database_schema();
                }
                break;
            case 4:
                //Wallet Setup
                write_wallet_config($_POST['wallet_type'], $_POST['rpcserver'], $_POST['rpcport'], $_POST['rpcuser'], $_POST['rpcpass'], $_POST['addressV'], $_POST['coldwallet_file'], $_POST['hotwallet_encrypt'], APPLICATION_CONFDIR . 'wallet.conf.php');
                //Check Connection/Permissions
                check_wallet($_POST['wallet_type']);
                break;
            case 5:
                //Basic Site Preferences
                $settings = array('minimum_payout' => sprintf('%.8f', $_POST['minimum_payout']), 'maximum_payout' => sprintf('%.8f', $_POST['maximum_payout']), 'payout_precision' => $_POST['payout_precision'], 'payout_threshold' => sprintf('%.8f', $_POST['payout_threshold']), 'payout_interval' => $_POST['payout_interval'], 'user_check' => $_POST['user_check'], 'use_captcha' => $_POST['captcha_type'], 'captcha_config' => array('simple_captcha_session_name' => $_POST['simple_captcha_session_name'], 'recpatcha_private_key' => $_POST['recpatcha_private_key'], 'recpatcha_public_key' => $_POST['recpatcha_public_key'], 'solvemedia_private_key' => $_POST['solvemedia_private_key'], 'solvemedia_challenge_key' => $_POST['solvemedia_challenge_key'], 'solvemedia_hash_key' => $_POST['solvemedia_hash_key']), 'use_promo_codes' => isset($_POST['use_promo_codes']), 'use_spammerslapper' => isset($_POST['use_spammerslapper']), 'spammerslapper_key' => $_POST['spammerslapper_key'], 'donation_address' => $_POST['donation_address'], 'title' => $_POST['title'], 'sitename' => $_POST['sitename'], 'sitedesc' => $_POST['sitedesc'], 'template' => $_POST['template'], 'coin_code' => $_POST['coin_code'], 'lang' => $_POST['lang']);
                //Save
                write_faucet_config($settings, APPLICATION_CONFDIR . 'faucet.conf.php');
                break;
            case 6:
                //Done Installing
                if ($_POST['install_complete']) {
                    finish_install(@$vars['clean_install']);
                }
                break;
            default:
                //Do nothing
        }
    } catch (Exception $e) {
        //Default error code is 1
        $error = $e->getCode() == 0 ? 1 : $e->getCode();
        $step--;
        //If this fails, the redirect back to previous step and specyfy error code
        if ($step <= 1) {
            //Redirect back to first page
            $redirect_complete = $_SERVER['PHP_SELF'] . "?error={$error}";
        } else {
            //Redirect to previous page
            $redirect_complete = $_SERVER['PHP_SELF'] . "?step={$step}&error={$error}";
        }
    }
    return $redirect_complete;
}