Beispiel #1
0
function dosettings($data, $user)
{
    $err = '';
    $chg = getparam('Change', false);
    $check = false;
    switch ($chg) {
        case 'EMail':
            $email = getparam('email', false);
            if (stripos($email, 'hotmail') !== false) {
                $err = 'hotmail not allowed';
            } else {
                $pass = getparam('pass', false);
                $twofa = getparam('2fa', false);
                $ans = userSettings($user, $email, null, $pass, $twofa);
                $err = 'EMail changed';
                $check = true;
            }
            break;
        case 'Address':
            if (!isset($data['info']['u_multiaddr'])) {
                $addr = getparam('baddr', false);
                $addrarr = array(array('addr' => $addr));
                $pass = getparam('pass', false);
                $twofa = getparam('2fa', false);
                $ans = userSettings($user, null, $addrarr, $pass, $twofa);
                $err = 'Payout address changed';
                $check = true;
            }
            break;
        case 'Password':
            $oldpass = getparam('oldpass', false);
            $pass1 = getparam('pass1', false);
            $pass2 = getparam('pass2', false);
            $twofa = getparam('2fa', false);
            if (!safepass($pass1)) {
                $err = 'Unsafe password. ' . passrequires();
            } elseif ($pass1 != $pass2) {
                $err = "Passwords don't match";
            } else {
                $ans = setPass($user, $oldpass, $pass1, $twofa);
                $err = 'Password changed';
                $check = true;
            }
            break;
    }
    $doemail = false;
    if ($check === true) {
        if ($ans['STATUS'] != 'ok') {
            $err = $ans['STATUS'];
            if ($ans['ERROR'] != '') {
                $err .= ': ' . $ans['ERROR'];
            }
        } else {
            $doemail = true;
        }
    }
    $ans = userSettings($user);
    if ($ans['STATUS'] != 'ok') {
        dbdown();
    }
    // Should be no other reason?
    if (isset($ans['email'])) {
        $email = $ans['email'];
    } else {
        $email = '';
    }
    // Use the first one - updating will expire all others
    if (isset($ans['rows']) and $ans['rows'] > 0) {
        $addr = $ans['addr:0'];
    } else {
        $addr = '';
    }
    if ($doemail) {
        if ($email == '') {
            if ($err != '') {
                $err .= '<br>';
            }
            $err .= 'An error occurred, check your details below';
            goto iroiroattanoyo;
        }
        $emailinfo = getOpts($user, emailOptList());
        if ($emailinfo['STATUS'] != 'ok') {
            if ($err != '') {
                $err .= '<br>';
            }
            $err .= 'An error occurred, check your details below';
            goto iroiroattanoyo;
        }
        switch ($chg) {
            case 'EMail':
                if (isset($_SESSION['old_set_email'])) {
                    $old = $_SESSION['old_set_email'];
                } else {
                    $old = null;
                }
                emailAddressChanged($email, zeip(), $emailinfo, $old);
                break;
            case 'Address':
                payoutAddressChanged($email, zeip(), $emailinfo);
                break;
            case 'Password':
                passChanged($email, zeip(), $emailinfo);
                break;
        }
    }
    iroiroattanoyo:
    $pg = settings($data, $user, $email, $addr, $err);
    return $pg;
}
Beispiel #2
0
function doaddrmgt($data, $user)
{
    $err = '';
    $OK = getparam('OK', false);
    $count = getparam('rows', false);
    $pass = getparam('pass', false);
    $twofa = getparam('2fa', false);
    $mfail = false;
    if ($OK == 'Save' && !nuem($count) && !nuem($pass)) {
        if ($count > 0 && $count < 1000) {
            $mfail = true;
            $addrarr = array();
            for ($i = 0; $i < $count; $i++) {
                $addr = getparam('addr:' . $i, false);
                $nam = getparam('payname:' . $i, false);
                if (nuem($nam)) {
                    $nam = '';
                }
                $ratio = getparam('ratio:' . $i, false);
                if (!nuem($addr) && !nuem($ratio)) {
                    $addrarr[] = array('addr' => $addr, 'payname' => $nam, 'ratio' => $ratio);
                }
            }
            $ans = userSettings($user, null, $addrarr, $pass, $twofa);
            if ($ans['STATUS'] != 'ok') {
                $err = $ans['ERROR'];
            } else {
                $ans = userSettings($user);
                if ($ans['STATUS'] != 'ok') {
                    goto meh;
                }
                if (isset($ans['email'])) {
                    $email = $ans['email'];
                } else {
                    goto meh;
                }
                $emailinfo = getOpts($user, emailOptList());
                if ($emailinfo['STATUS'] != 'ok') {
                    goto meh;
                } else {
                    payoutAddressChanged($email, zeip(), $emailinfo);
                }
            }
            $mfail = false;
        }
    }
    meh:
    if ($mfail == true) {
        if ($err != '') {
            $err .= '<br>';
        }
        $err .= 'An error occurred, check your details below';
    }
    $pg = addrmgtuser($data, $user, $err);
    return $pg;
}