public static function YM_transaction_submit()
 {
     $usr = usr::getCurrentUser(1);
     if ($usr == null) {
         header('Location: /');
         exit;
     }
     if ($usr->getId() != 2) {
         header('Location: /');
         exit;
     }
     if (!isset($_GET['code'])) {
         $to = self::getVar('wallet');
         $UID = self::getVar('UID');
         Session::setSessionVariable('currentUIDTransaction', $UID);
         $scope = "account-info " . "operation-history " . "operation-details " . "payment.to-account(\"" . $to . "\",\"account\") ";
         $authUri = YandexMoney::authorizeUri(YM_OUT_ACCESSTOKEN, YM_OUT_REDIRECTPAGE, $scope);
         header('Location: ' . $authUri);
         exit;
     }
     $UID = Session::getSessionVariable('currentUIDTransaction');
     $code = $_GET['code'];
     $ym = new YandexMoney(YM_OUT_ACCESSTOKEN);
     $receiveTokenResp = $ym->receiveOAuthTokenOut($code, YM_OUT_REDIRECTPAGE, YM_OUT_SECRETTOKEN);
     if (!$receiveTokenResp->isSuccess()) {
         header('Location: /');
         exit;
     }
     $token = $receiveTokenResp->getAccessToken();
     $purseList = Purse::findBy(array('UID' => $UID, 'CurId' => 1));
     if (empty($purseList)) {
         header('Location: /admin/ym');
         exit;
     }
     $purse = $purseList[0];
     $prs = new Purse();
     $prs->findById($purse['id']);
     $prs->update(array('out_id' => $token));
     $at = new AtYm();
     $at->findBy(array('UID' => $UID));
     $at->delete();
     header('Location: /admin/ym');
     exit;
 }
Exemplo n.º 2
0
 static function generateCaptcha()
 {
     $width = 99;
     //Ширина изображения
     $height = 40;
     //Высота изображения
     $font_size = 10;
     //Размер шрифта
     $let_amount = 5;
     //Количество символов, которые нужно набрать
     $fon_let_amount = 5;
     //Количество символов, которые находятся на фоне
     $path_fonts = $_SERVER['DOCUMENT_ROOT'] . '/public/fonts/ttf/';
     //Путь к шрифтам
     $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '9');
     $colors = array('10', '30', '50', '70', '90', '110', '130', '150', '170', '190', '210');
     $src = imagecreatetruecolor($width, $height);
     $fon = imagecolorallocate($src, 255, 255, 255);
     imagefill($src, 0, 0, $fon);
     $fonts = array();
     $dir = opendir($path_fonts);
     while ($fontName = readdir($dir)) {
         if ($fontName != "." && $fontName != "..") {
             $fonts[] = $fontName;
         }
     }
     closedir($dir);
     for ($i = 0; $i < $fon_let_amount; $i++) {
         $color = imagecolorallocatealpha($src, rand(0, 255), rand(0, 255), rand(0, 255), 100);
         $font = $path_fonts . $fonts[rand(0, sizeof($fonts) - 1)];
         $letter = $letters[rand(0, sizeof($letters) - 1)];
         $size = rand($font_size - 2, $font_size + 2);
         imagettftext($src, $size, rand(0, 45), rand($width * 0.1, $width - $width * 0.1), rand($height * 0.2, $height), $color, $font, $letter);
     }
     for ($i = 0; $i < $let_amount; $i++) {
         $color = imagecolorallocatealpha($src, $colors[rand(0, sizeof($colors) - 1)], $colors[rand(0, sizeof($colors) - 1)], $colors[rand(0, sizeof($colors) - 1)], rand(20, 40));
         $font = $path_fonts . $fonts[rand(0, sizeof($fonts) - 1)];
         $letter = $letters[rand(0, sizeof($letters) - 1)];
         $size = rand($font_size * 2.1 - 2, $font_size * 2.1 + 2);
         $x = ($i + 1) * $font_size + rand(4, 7);
         $y = $height * 2 / 3 + rand(0, 5);
         $cod[] = $letter;
         imagettftext($src, $size, rand(0, 15), $x, $y, $color, $font, $letter);
     }
     $_SESSION['sdf'];
     Session::setSessionVariable('security_code', implode('', $cod));
     header("Content-type: image/gif");
     imagegif($src);
 }
 public static function SwitchLanguage()
 {
     $newLangId = Core::validate(self::getVar('langId'));
     switch ($newLangId) {
         case 2:
             $lang = 'RU';
             break;
         case 3:
             $lang = 'ES';
             break;
         default:
             $lang = 'EN';
     }
     Session::setSessionVariable('lang', $lang);
     header('Location: ' . $_SERVER['HTTP_REFERER']);
 }