Exemplo n.º 1
0
                        }
                    }
                }
            }
        }
    } else {
        if (($payment_direct_token = $payment->execute_direct_payment()) && isset($_SESSION['payment_direct_token']) && ($_SESSION['payment_direct_token'] = $payment_direct_token)) {
            unset($_SESSION['payment_direct_token']);
            try {
                $answer = $payment->execute_payment();
                echo '<div class="success">' . $LANG['payments_msg_confirmed'] . '</div>';
                /*
                Action after purchase, add credits or something ...
                */
                // add user credits
                $delivered = \user\update::add_credits($GLOBALS['me']->ID, $plan->credits);
                // update transaction
                // state, userID, paid, delivered, transactionID
                \query\payments::update_payment(array($answer['state'], $GLOBALS['me']->ID, 1, $delivered, $answer['id']));
            } catch (Exception $e) {
                echo '<div class="error">' . $e->getMessage() . '</div>';
            }
        }
    }
    $csrf = $_SESSION['payment_csrf'] = \site\utils::str_random(10);
    echo '<div class="table">';
    echo '<section>

  <h2>' . $LANG['payments_title_infos'] . '</h2>

  <ul class="table2">
Exemplo n.º 2
0
      </section>
  </body>
  </html>';
            die;
        } else {
            if (isset($_GET['user']) && isset($_GET['token']) && \user\mail_sessions::check('confirmation', array('user' => (int) $_GET['user'], 'session' => $_GET['token']))) {
                $stmt = $db->stmt_init();
                $stmt->prepare("UPDATE " . DB_TABLE_PREFIX . "users SET valid = 1 WHERE id = ?");
                $stmt->bind_param("i", $_GET['user']);
                $stmt->execute();
                @$stmt->close();
                \user\mail_sessions::clear('confirmation', array('user' => (int) $_GET['user']));
                // check if user has been refered
                $uinfo = \query\main::user_infos($_GET['user']);
                if (!empty($uinfo->refid)) {
                    \user\update::add_points($uinfo->refid, \query\main::get_option('u_points_refer'));
                }
                echo '<!DOCTYPE html>

  <html>
      <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="robots" content="noindex, nofollow">
        <meta http-equiv="Refresh" content="5; url=index.php" />

        <title>' . $LANG['uverify_metatitle'] . '</title>

        <link href="' . MISCDIR . '/verify.css" media="all" rel="stylesheet" />
Exemplo n.º 3
0
 public static function get_reward($id, $post)
 {
     global $db, $LANG;
     if (!$GLOBALS['me']) {
         throw new \Exception($LANG['msg_error']);
     }
     if (!\query\main::reward_exists($id, array('user_view'))) {
         throw new \Exception($LANG['claim_reward_dontexist']);
     } else {
         if (($reward = \query\main::reward_infos($id)) && $reward->points > $GLOBALS['me']->Points) {
             throw new \Exception($LANG['claim_reward_mrepts']);
         } else {
             // check required fields
             foreach ($reward->fields as $field) {
                 if ((bool) $field['require']) {
                     switch ($field['type']) {
                         case 'email':
                             if (!isset($post[$field['name']]) || !filter_var($post[$field['name']], FILTER_VALIDATE_EMAIL)) {
                                 throw new \Exception($LANG['claim_reward_reqinv']);
                             }
                             break;
                         case 'number':
                             if (!isset($post[$field['name']]) || !filter_var($post[$field['name']], FILTER_VALIDATE_INT)) {
                                 throw new \Exception($LANG['claim_reward_reqinv']);
                             }
                             break;
                         default:
                             if (empty($post[$field['name']])) {
                                 throw new \Exception($LANG['claim_reward_reqinv']);
                             }
                             break;
                     }
                 }
             }
             $stmt = $db->stmt_init();
             $stmt->prepare("INSERT INTO " . DB_TABLE_PREFIX . "rewards_reqs (name, user, points, reward, fields, lastupdate_by, lastupdate, claimed, date) VALUES (?, ?, ?, ?, ?, ?, NOW(), 0, NOW())");
             $fields = @serialize($post);
             $stmt->bind_param("siiisi", $reward->title, $GLOBALS['me']->ID, $reward->points, $reward->ID, $fields, $GLOBALS['me']->ID);
             if ($stmt->execute()) {
                 // deduct points from this user
                 \user\update::add_points($GLOBALS['me']->ID, -$reward->points);
                 $stmt->close();
                 return true;
             } else {
                 $stmt->close();
                 throw new \Exception($LANG['msg_error']);
             }
         }
     }
 }