示例#1
0
 function load()
 {
     $AppConfig = $GLOBALS['AppConfig'];
     if ($this->isPost()) {
         $usedPackage = NULL;
         foreach ($AppConfig['plus']['packages'] as $package) {
             if ($package['cost'] == $_POST['amount']) {
                 $usedPackage = $package;
                 continue;
             }
         }
         if (isset($_POST['merchant_id'])) {
             $merchant_id = $AppConfig['plus']['payments']['cashu']['merchant_id'];
         } else {
             $merchant_id = $AppConfig['plus']['payments']['onecard']['merchant_id'];
             $key = $merchant_id . $_POST['OneCard_TransID'] . $_POST['OneCard_Amount'] . $_POST['OneCard_Currency'] . $_POST['OneCard_RTime'] . $payment['plus']['payments']['cashu']['testKey'] . $_POST['OneCard_Code'];
             $token = md5($key);
             if ($usedPackage != NULL && $_POST['OneCard_Code'] == '00' && $_POST['OneCard_RHashKey'] == $token) {
                 $playerId = base64_decode($_POST['OneCard_Field1']);
                 $goldNumber = $usedPackage['gold'];
                 $m = new PaymentModel();
                 $m->incrementPlayerGold($playerId, $goldNumber);
                 $m->dispose();
                 echo '<h2 style="color:#00ff00;">success</h2>';
             } else {
                 echo '<h2 style="color:#ff0000;">failed</h2>';
             }
             $p = new GPage();
             $p->run();
             return null;
         }
         $usedPayment = NULL;
         foreach ($AppConfig['plus']['payments'] as $payment) {
             if ($payment['merchant_id'] == $merchant_id) {
                 $usedPayment = $payment;
                 continue;
             }
         }
         if (!isset($_GET[$usedPayment['returnKey']])) {
             return null;
         }
         if ($usedPackage != NULL && $usedPayment != NULL && $_POST['token'] == md5(sprintf('%s:%s:%s:%s', $merchant_id, $_POST['amount'], strtolower($_POST['currency']), $_POST['test_mode'] ? $usedPayment['testKey'] : $usedPayment['key']))) {
             $playerId = base64_decode($_POST['session_id']);
             $goldNumber = $usedPackage['gold'];
             $m = new PaymentModel();
             $m->incrementPlayerGold($playerId, $goldNumber);
             $m->dispose();
             echo '<h2 style="color:#00ff00;">success</h2>';
             return null;
         }
         echo '<h2 style="color:#ff0000;">failed</h2>';
     }
 }
示例#2
0
            $this->err[0] = $m->isPlayerNameExists($name) ? register_player_txt_usedname : '';
            $this->err[1] = $m->isPlayerEmailExists($email) ? register_player_txt_usedemail : '';
            if (0 < strlen($this->err[0]) || 0 < strlen($this->err[1])) {
                $m->dispose();
                return null;
            }
            $villageName = new_village_name_prefix . ' ' . $name;
            $result = $m->createNewPlayer($name, $email, $pwd, $_POST['tid'], $_POST['kid'], $villageName, $this->setupMetadata['map_size'], PLAYERTYPE_NORMAL, 1, $this->SNdata);
            if ($result['hasErrors']) {
                $this->err[3] = register_player_txt_fullserver;
                $m->dispose();
                return null;
            }
            $m->dispose();
            $link = WebHelper::getbaseurl() . 'activate.php?id=' . $result['activationCode'];
            $to = $email;
            $from = $this->appConfig['system']['email'];
            $subject = register_player_txt_regmail_sub;
            $message = sprintf(register_player_txt_regmail_body, $name, $name, $pwd, $link, $link);
            WebHelper::sendmail($to, $from, $subject, $message);
            $this->success = TRUE;
        }
    }
}
$p = new GPage();
$p->run();
?>