//Create Wallet if it is not created $bitcoinInfo = BuckysUser::getUserBitcoinInfo($userID); if (!$bitcoinInfo) { $bitcoinInfo = $bitcoinClass->createWallet($TNB_GLOBALS['user']['userID'], $TNB_GLOBALS['user']['email']); } if (isset($_POST['action']) && $_POST['action'] == 'send-bitcoins') { //Check Token if (!buckys_check_form_token()) { buckys_redirect("/wallet.php", MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $toAddress = $_POST['receiver']; $amount = doubleval($_POST['amount']); $password = $_POST['password']; $user = BuckysUser::getUserData($TNB_GLOBALS['user']['userID']); $is_error = false; if (!$password || !buckys_validate_password($password, $user['password'])) { buckys_redirect("/wallet.php", MSG_CURRENT_PASSWORD_NOT_CORRECT, MSG_TYPE_ERROR); } if (!$toAddress) { buckys_redirect("/wallet.php", MSG_ENTER_BITCOINS_ADDRESS_OF_RECIPIENT, MSG_TYPE_ERROR); } if (!$amount || $amount <= 0) { buckys_redirect("/wallet.php", MSG_INVALID_BITCOIN_AMOUNT, MSG_TYPE_ERROR); } if (!$is_error) { $bitcoinClass->sendBitcoin($userID, $toAddress, $amount); } buckys_redirect("/wallet.php"); } $page = isset($_GET['page']) ? $_GET['page'] : 1; list($totalCount, $bitcoinBalance, $transactions) = $bitcoinClass->getTransactions($userID, $page, $bitcoinClass->COUNT_PER_PAGE);
public function deleteAccountAction() { $data = $_POST; $token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null; if (!$token) { return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')]; } if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) { return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')]; } $current = BuckysUser::getUserData($userID); if (!buckys_validate_password($data['password'], $current['password'])) { return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => buckys_api_get_error_result('Current password is incorrect.')]; } else { if (BuckysUser::deleteUserAccount($userID)) { return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ['STATUS' => 'SUCCESS']]; } else { return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('There was an error to saving your information.')]; } } exit; }
} buckys_redirect($return, MSG_UNBLOCK_USER_SUCCESS); } else { if ($_REQUEST['action'] == 'delete-forum') { $return = isset($_REQUEST['return']) ? base64_decode($_REQUEST['return']) : '/forum/moderator.php?id=' . $categoryID; //Check forum token if (!buckys_check_form_token('request')) { buckys_redirect($return, MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } //Admin, Site Moderator, Category Admin and Category Moderator can't apply if (!(buckys_is_admin() || buckys_is_forum_admin($category['categoryID']))) { buckys_redirect($return, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } //Check Password $userData = BuckysUser::getUserData($userID); if (!buckys_validate_password($_REQUEST['pwd'], $userData['password'])) { buckys_redirect($return, MSG_CURRENT_PASSWORD_NOT_CORRECT, MSG_TYPE_ERROR); } BuckysForumCategory::deleteCategory($category['categoryID']); buckys_redirect("/forum", MSG_REMOVE_FORUM_SUCCESS); } } } } } } } } } } //Admin, Site Moderator, Category Admin and Category Moderator can't apply
$loginError = 1; buckys_redirect('/register.php', MSG_EMPTY_EMAIL, MSG_TYPE_ERROR); } else { if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", $_POST['email'])) { buckys_redirect('/register.php', MSG_INVALID_EMAIL, MSG_TYPE_ERROR); } } //Password if (empty($_POST['password'])) { buckys_redirect('/register.php', MSG_EMPTY_PASSWORD, MSG_TYPE_ERROR); } $email = trim($_POST['email']); $password = trim($_POST['password']); $info = buckys_get_user_by_email($email); if (buckys_not_null($info)) { if (!buckys_validate_password($password, $info['password'])) { buckys_redirect('/register.php', MSG_INVALID_LOGIN_INFO, MSG_TYPE_ERROR); } else { if ($info['status'] == 0) { //Account Not Verified or Banned buckys_redirect('/index.php', !$info['token'] ? MSG_ACCOUNT_BANNED : MSG_ACCOUNT_NOT_VERIFIED, MSG_TYPE_ERROR); } else { //Login Success //Clear Login Attemps BuckysTracker::clearLoginAttemps(); $_SESSION['userID'] = $info['userID']; //Init Some Session Values $_SESSION['converation_list'] = array(); //If the keep me signed in is checked, save data to cookie if ($_POST['keep_sign_in'] == 1) { setcookie('bkuid0', base64_encode($info['userID']), time() + COOKIE_LIFETIME, "/", "buckysroom.com");
} else { if ($_POST['newPassword'] != $_POST['newPassword2']) { buckys_redirect("/change_password.php", MSG_NOT_MATCH_PASSWORD, MSG_TYPE_ERROR); $isValid = false; } else { if (!buckys_check_password_strength($_POST['newPassword'])) { buckys_redirect("/change_password.php", MSG_NEW_PASSWORD_STRENGTH_ERROR, MSG_TYPE_ERROR); $isValid = false; } } } //Check Current Password $data = BuckysUser::getUserData($userID); if (!$data) { buckys_redirect("/index.php"); } if (!buckys_validate_password($_POST['currentPassword'], $data['password'])) { buckys_redirect("/change_password.php", MSG_CURRENT_PASSWORD_NOT_CORRECT, MSG_TYPE_ERROR); $isValid = false; } if ($isValid) { $pwd = buckys_encrypt_password($_POST['newPassword']); BuckysUser::updateUserFields($userID, ['password' => $pwd]); buckys_redirect('/change_password.php', MSG_PASSWORD_UPDATED); } } buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('info.css'); $TNB_GLOBALS['content'] = 'change_password'; $TNB_GLOBALS['title'] = "Change Password - " . TNB_SITE_NAME; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";