?

แEำ๊คฮ๏Lwebshll2019

Current Path : /home/webyoo/www/leumi/site/
Upload File :
Current File : /home/webyoo/www/leumi/site/cron_expire_subscriptions.php

<?php
// =====================================================================
//  CRON quotidien โ€” abonnements ืžืชื•ื•ืš
//  1) Relance par email la VEILLE de la fin de l'essai gratuit
//  2) Expire (sub_status='expired') les comptes dont la pรฉriode est finie
//  ร€ planifier 1x/jour (cron-job.org).
// =====================================================================

include "start.php";
include "send_email.php";

// Sรฉcuritรฉ : autorisรฉ en ligne de commande (php) OU via URL avec la bonne clรฉ.
$CRON_KEY = 'ashkara_cron_2026';
if (php_sapi_name() !== 'cli' && (!isset($_GET['key']) || $_GET['key'] !== $CRON_KEY)) {
    http_response_code(403);
    exit('forbidden');
}

// ---- 1) Relance la veille (essai gratuit qui se termine DEMAIN) ----
$sent = 0;
$rem = mysqli_query($link, "SELECT id, name, email FROM rent_users
    WHERE fk_type = 3
      AND sub_status = 'active'
      AND (sub_payer_id IS NULL OR sub_payer_id = '')
      AND sub_until = DATE_ADD(CURDATE(), INTERVAL 1 DAY)");
if ($rem) {
    while ($u = mysqli_fetch_assoc($rem)) {
        $subject = "ืชื–ื›ื•ืจืช: ืชืงื•ืคืช ื”ื”ื˜ื‘ื” ืฉืœืš ืžืกืชื™ื™ืžืช ืžื—ืจ - ืืฉื›ืจื”";
        $msg  = "<html><head><meta charset='UTF-8'></head><body dir='rtl' style='font-family:Arial,sans-serif;color:#222;'>";
        $msg .= "<h2>ืฉืœื•ื " . htmlspecialchars($u['name']) . ",</h2>";
        $msg .= "<p>ื—ื•ื“ืฉ ื”ื”ื˜ื‘ื” ื”ื—ื™ื ืžื™ ืฉืœืš ื‘ืืชืจ <strong>ืืฉื›ืจื”</strong> ืžืกืชื™ื™ื <strong>ืžื—ืจ</strong>.</p>";
        $msg .= "<p>ื›ื“ื™ ืฉื”ื ื›ืกื™ื ืฉืœืš ื™ืžืฉื™ื›ื• ืœื”ื•ืคื™ืข ื•ืขืžื•ื“ ื”ืžืชื•ื•ืš ื™ื™ืฉืืจ ืคืขื™ืœ, ื™ืฉ ืœื”ืคืขื™ืœ ืžื ื•ื™ ื—ื•ื“ืฉื™ ื‘ืกืš 99 โ‚ช.</p>";
        $msg .= "<p style='text-align:center;margin:24px 0;'>";
        $msg .= "<a href='https://ashkara.co/agent-subscribe.php' style='background:#0ec6d5;color:#fff;padding:12px 28px;border-radius:6px;text-decoration:none;font-weight:bold;'>ื”ืคืขืœ ืžื ื•ื™ ืขื›ืฉื™ื•</a>";
        $msg .= "</p>";
        $msg .= "<p style='font-size:13px;color:#666;'>ืื ืœื ื™ื•ืคืขืœ ืžื ื•ื™, ื”ื ื›ืกื™ื ืฉืœืš ื™ื•ืกืชืจื• ืžืจืฉื™ืžืช ื”ื ื›ืกื™ื ืขื“ ืœื”ืกื“ืจืช ื”ืชืฉืœื•ื.</p>";
        $msg .= "</body></html>";
        sendEmail($u['email'], $subject, $msg, 'ืืฉื›ืจื” - ืชื–ื›ื•ืจืช ืžื ื•ื™');
        $sent++;
    }
}

// ---- 2) Expiration (pรฉriode terminรฉe) ----
mysqli_query($link, "UPDATE rent_users
    SET sub_status = 'expired'
    WHERE fk_type = 3
      AND sub_status = 'active'
      AND sub_until IS NOT NULL
      AND sub_until < CURDATE()");
$expired = mysqli_affected_rows($link);

echo "OK - relances: " . $sent . " ยท expirรฉs: " . $expired;



web shell, Coded By 2019