Файловый менеджер - Редактировать - /home/gqdcvggs/go.imators.com/api.zip
Назад
PK �4�[�<�p p get_content.phpnu �[��� <?php require_once '../config.php'; header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Headers: Content-Type'); if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); exit; } if (!isset($_POST['age_limit'])) { http_response_code(400); echo json_encode(['error' => 'Missing age_limit']); exit; } $age_limit = (int)$_POST['age_limit']; try { $stmt = $pdo->prepare("SELECT DISTINCT category FROM content WHERE status = 'approved' AND category IS NOT NULL AND category != '' ORDER BY category ASC"); $stmt->execute(); $categories = $stmt->fetchAll(PDO::FETCH_COLUMN); $content_by_category = []; foreach ($categories as $category) { $stmt = $pdo->prepare("SELECT * FROM content WHERE status = 'approved' AND age_rating <= ? AND category = ? ORDER BY created_at DESC LIMIT 12"); $stmt->execute([$age_limit, $category]); $content = $stmt->fetchAll(PDO::FETCH_ASSOC); if (!empty($content)) { $content_by_category[$category] = $content; } } echo json_encode($content_by_category); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => 'Database error']); } ?>PK �4�[�}�S S search_content.phpnu �[��� <?php require_once '../config.php'; header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Headers: Content-Type'); if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); exit; } if (!isset($_POST['search']) || !isset($_POST['age_limit'])) { http_response_code(400); echo json_encode(['error' => 'Missing search or age_limit']); exit; } $search = $_POST['search']; $age_limit = (int)$_POST['age_limit']; try { $stmt = $pdo->prepare("SELECT * FROM content WHERE status = 'approved' AND age_rating <= ? AND (title LIKE ? OR description LIKE ? OR author LIKE ?) ORDER BY created_at DESC LIMIT 20"); $search_term = "%$search%"; $stmt->execute([$age_limit, $search_term, $search_term, $search_term]); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); echo json_encode($results); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => 'Database error']); } ?>PK �4�[��=� � get_profiles.phpnu �[��� <?php require_once '../config.php'; header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Headers: Content-Type'); if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); exit; } if (!isset($_POST['user_id'])) { http_response_code(400); echo json_encode(['error' => 'Missing user_id']); exit; } $user_id = $_POST['user_id']; try { $stmt = $pdo->prepare("SELECT * FROM profiles WHERE user_id = ? ORDER BY is_main DESC, created_at ASC"); $stmt->execute([$user_id]); $profiles = $stmt->fetchAll(PDO::FETCH_ASSOC); if (empty($profiles)) { echo json_encode([]); } else { echo json_encode($profiles); } } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => 'Database error']); } ?>PK �4�[]��C6 6 create_profile.phpnu �[��� <?php require_once '../config.php'; header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Headers: Content-Type'); if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); exit; } $required_fields = ['user_id', 'name', 'avatar', 'age_limit', 'is_main']; foreach ($required_fields as $field) { if (!isset($_POST[$field])) { http_response_code(400); echo json_encode(['error' => "Missing $field"]); exit; } } $user_id = $_POST['user_id']; $name = $_POST['name']; $avatar = $_POST['avatar']; $age_limit = (int)$_POST['age_limit']; $is_main = $_POST['is_main'] === '1' ? 1 : 0; try { $stmt = $pdo->prepare("INSERT INTO profiles (user_id, name, avatar, age_limit, is_main) VALUES (?, ?, ?, ?, ?)"); $stmt->execute([$user_id, $name, $avatar, $age_limit, $is_main]); $profile_id = $pdo->lastInsertId(); $stmt = $pdo->prepare("SELECT * FROM profiles WHERE id = ?"); $stmt->execute([$profile_id]); $profile = $stmt->fetch(PDO::FETCH_ASSOC); echo json_encode($profile); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => 'Database error']); } ?>PK ;�[�y�Ԡ � send-email.phpnu �[��� <?php session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['merchant_id'])) { echo json_encode(['success' => false, 'message' => 'Non connecté']); exit(); } require_once '../config/db_comm.php'; require_once '../config/db.php'; $merchant_id = $_SESSION['merchant_id']; $subject = trim($_POST['subject'] ?? ''); $content = trim($_POST['content'] ?? ''); if (empty($subject) || empty($content)) { echo json_encode(['success' => false, 'message' => 'Sujet et contenu requis']); exit(); } try { $stmt = $pdo_comm->prepare("SELECT setting_value FROM settings WHERE setting_key IN ('email_limit_daily', 'email_cooldown_hours', 'start_hour', 'end_hour')"); $stmt->execute(); $settings = []; while ($row = $stmt->fetch()) { $settings[$row['setting_key']] = $row['setting_value']; } $current_hour = (int)date('H'); if ($current_hour < $settings['start_hour'] || $current_hour >= $settings['end_hour']) { echo json_encode(['success' => false, 'message' => 'Emails autorisés de 7h à 22h uniquement']); exit(); } $today = date('Y-m-d'); $stmt = $pdo_comm->prepare("SELECT COUNT(*) FROM emails_log WHERE merchant_id = ? AND DATE(sent_at) = ?"); $stmt->execute([$merchant_id, $today]); $sent_today = $stmt->fetchColumn(); if ($sent_today >= $settings['email_limit_daily']) { echo json_encode(['success' => false, 'message' => 'Limite quotidienne atteinte (2 emails/jour)']); exit(); } $stmt = $pdo_comm->prepare("SELECT sent_at FROM emails_log WHERE merchant_id = ? AND DATE(sent_at) = ? ORDER BY sent_at DESC LIMIT 1"); $stmt->execute([$merchant_id, $today]); $last_email = $stmt->fetchColumn(); if ($last_email) { $cooldown_minutes = $settings['email_cooldown_hours'] * 60; $time_diff = (time() - strtotime($last_email)) / 60; if ($time_diff < $cooldown_minutes) { $remaining = ceil($cooldown_minutes - $time_diff); echo json_encode(['success' => false, 'message' => "Cooldown actif. Prochain email dans {$remaining} minutes"]); exit(); } } $stmt = $pdo->prepare("SELECT email FROM residents WHERE email IS NOT NULL AND email != ''"); $stmt->execute(); $recipients = $stmt->fetchAll(PDO::FETCH_COLUMN); if (empty($recipients)) { echo json_encode(['success' => false, 'message' => 'Aucun destinataire trouvé']); exit(); } $headers = [ 'MIME-Version: 1.0', 'Content-type: text/html; charset=UTF-8', 'From: noreply@aktascorp.com', 'Reply-To: support@aktascorp.com' ]; $email_content = " <!DOCTYPE html> <html> <head> <meta charset='UTF-8'> <style> body { font-family: 'Poppins', Arial, sans-serif; font-weight: 300; } .container { max-width: 600px; margin: 0 auto; padding: 20px; } .header { text-align: center; margin-bottom: 30px; } .content { background: #f9f9f9; padding: 30px; border-radius: 8px; } .footer { text-align: center; margin-top: 30px; font-size: 12px; color: #666; } </style> </head> <body> <div class='container'> <div class='header'> <h1>aktascorp</h1> </div> <div class='content'> <h2>{$subject}</h2> <p>" . nl2br(htmlspecialchars($content)) . "</p> </div> <div class='footer'> <p>© 2025 aktascorp. Tous droits réservés.</p> <p>Email promotionnel envoyé via Comm Access</p> </div> </div> </body> </html>"; $success_count = 0; foreach ($recipients as $email) { if (mail($email, $subject, $email_content, implode("\r\n", $headers))) { $success_count++; } } if ($success_count > 0) { $stmt = $pdo_comm->prepare("INSERT INTO emails_log (merchant_id, subject, content) VALUES (?, ?, ?)"); $stmt->execute([$merchant_id, $subject, $content]); echo json_encode(['success' => true, 'message' => "Email envoyé à {$success_count} destinataires"]); } else { echo json_encode(['success' => false, 'message' => 'Erreur lors de l\'envoi des emails']); } } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Erreur serveur']); } ?>PK ;�[d:�V V send-notification.phpnu �[��� <?php session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['merchant_id'])) { echo json_encode(['success' => false, 'message' => 'Non connecté']); exit(); } require_once '../config/db_comm.php'; require_once '../config/onesignal.php'; $merchant_id = $_SESSION['merchant_id']; $message = trim($_POST['message'] ?? ''); $platform = 'both'; if (empty($message)) { echo json_encode(['success' => false, 'message' => 'Message requis']); exit(); } try { $stmt = $pdo_comm->prepare("SELECT setting_value FROM settings WHERE setting_key IN ('notification_limit_daily', 'start_hour', 'end_hour')"); $stmt->execute(); $settings = []; while ($row = $stmt->fetch()) { $settings[$row['setting_key']] = $row['setting_value']; } $current_hour = (int)date('H'); if ($current_hour < $settings['start_hour'] || $current_hour >= $settings['end_hour']) { echo json_encode(['success' => false, 'message' => 'Notifications autorisées de 7h à 22h uniquement']); exit(); } $today = date('Y-m-d'); $stmt = $pdo_comm->prepare("SELECT COUNT(*) FROM notifications_log WHERE merchant_id = ? AND DATE(sent_at) = ?"); $stmt->execute([$merchant_id, $today]); $sent_today = $stmt->fetchColumn(); if ($sent_today >= $settings['notification_limit_daily']) { echo json_encode(['success' => false, 'message' => 'Limite quotidienne atteinte (4 notifications/jour)']); exit(); } $result = sendPushNotification($message, $platform); if ($result && isset($result['id'])) { $stmt = $pdo_comm->prepare("INSERT INTO notifications_log (merchant_id, message, platform) VALUES (?, ?, ?)"); $stmt->execute([$merchant_id, $message, $platform]); echo json_encode(['success' => true, 'message' => 'Notification envoyée avec succès']); } else { echo json_encode(['success' => false, 'message' => 'Erreur lors de l\'envoi de la notification']); } } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Erreur serveur']); } ?>PK ;�[3f�S S live-data.phpnu �[��� <?php session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['merchant_id'])) { echo json_encode(['success' => false, 'message' => 'Non connecté']); exit(); } require_once '../config/db_comm.php'; $merchant_id = $_SESSION['merchant_id']; $today = date('Y-m-d'); try { $stmt = $pdo_comm->prepare("SELECT setting_key, setting_value FROM settings"); $stmt->execute(); $settings = []; while ($row = $stmt->fetch()) { $settings[$row['setting_key']] = $row['setting_value']; } $current_hour = (int)date('H'); $in_time_window = $current_hour >= $settings['start_hour'] && $current_hour < $settings['end_hour']; $stmt = $pdo_comm->prepare("SELECT COUNT(*) FROM notifications_log WHERE merchant_id = ? AND DATE(sent_at) = ?"); $stmt->execute([$merchant_id, $today]); $notifications_sent = $stmt->fetchColumn(); $notifications_remaining = max(0, $settings['notification_limit_daily'] - $notifications_sent); $stmt = $pdo_comm->prepare("SELECT COUNT(*) FROM emails_log WHERE merchant_id = ? AND DATE(sent_at) = ?"); $stmt->execute([$merchant_id, $today]); $emails_sent = $stmt->fetchColumn(); $emails_remaining = max(0, $settings['email_limit_daily'] - $emails_sent); $stmt = $pdo_comm->prepare("SELECT sent_at FROM emails_log WHERE merchant_id = ? AND DATE(sent_at) = ? ORDER BY sent_at DESC LIMIT 1"); $stmt->execute([$merchant_id, $today]); $last_email = $stmt->fetchColumn(); $email_cooldown = false; if ($last_email) { $cooldown_minutes = $settings['email_cooldown_hours'] * 60; $time_diff = (time() - strtotime($last_email)) / 60; $email_cooldown = $time_diff < $cooldown_minutes; } $stmt = $pdo_comm->prepare("SELECT COUNT(*) FROM system_messages WHERE merchant_id = ? AND read_at IS NULL"); $stmt->execute([$merchant_id]); $unread_messages = $stmt->fetchColumn(); $stmt = $pdo_comm->prepare("SELECT COUNT(*) FROM shop_updates WHERE merchant_id = ? AND status = 'pending'"); $stmt->execute([$merchant_id]); $pending_updates = $stmt->fetchColumn(); echo json_encode([ 'success' => true, 'counters' => [ 'notifications_remaining' => $notifications_remaining, 'emails_remaining' => $emails_remaining, 'in_time_window' => $in_time_window, 'email_cooldown' => $email_cooldown ], 'system' => [ 'ios_enabled' => (bool)$settings['ios_enabled'], 'android_enabled' => (bool)$settings['android_enabled'] ], 'messages' => [ 'unread' => $unread_messages ], 'shop_updates' => [ 'pending' => $pending_updates ] ]); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Erreur serveur']); } ?>PK ;�[6c!/� � save-message.phpnu �[��� <?php session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['merchant_id'])) { echo json_encode(['success' => false, 'message' => 'Non connecté']); exit(); } require_once '../config/db_comm.php'; $merchant_id = $_SESSION['merchant_id']; $subject = trim($_POST['subject'] ?? ''); $message = trim($_POST['message'] ?? ''); if (empty($subject) || empty($message)) { echo json_encode(['success' => false, 'message' => 'Sujet et message requis']); exit(); } try { $stmt = $pdo_comm->prepare("INSERT INTO communications (merchant_id, subject, message) VALUES (?, ?, ?)"); $stmt->execute([$merchant_id, $subject, $message]); echo json_encode(['success' => true, 'message' => 'Message envoyé à notre équipe avec succès']); } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Erreur lors de l\'envoi du message']); } ?>PK ;�[�6��j j get-shop-info.phpnu �[��� <?php session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['merchant_id'])) { echo json_encode(['success' => false, 'message' => 'Non connecté']); exit(); } require_once '../config/db.php'; $shop_ids = json_decode($_SESSION['shop_ids'], true); if (!$shop_ids || empty($shop_ids)) { echo json_encode(['success' => false, 'message' => 'Aucun commerce associé']); exit(); } $shop_id = $shop_ids[0]; try { $stmt = $pdo->prepare("SELECT * FROM shops WHERE id = ?"); $stmt->execute([$shop_id]); $shop = $stmt->fetch(); if ($shop) { echo json_encode(['success' => true, 'shop' => $shop]); } else { echo json_encode(['success' => false, 'message' => 'Commerce non trouvé']); } } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Erreur serveur']); } ?>PK ;�[� �� � update-shop.phpnu �[��� <?php session_start(); header('Content-Type: application/json'); if (!isset($_SESSION['merchant_id'])) { echo json_encode(['success' => false, 'message' => 'Non connecté']); exit(); } require_once '../config/db_comm.php'; $merchant_id = $_SESSION['merchant_id']; $shop_name = trim($_POST['shop_name'] ?? ''); $shop_description = trim($_POST['shop_description'] ?? ''); $shop_address = trim($_POST['shop_address'] ?? ''); $shop_phone = trim($_POST['shop_phone'] ?? ''); $shop_ids = json_decode($_SESSION['shop_ids'], true); if (!$shop_ids || empty($shop_ids)) { echo json_encode(['success' => false, 'message' => 'Aucun commerce associé à ce compte']); exit(); } $shop_id = $shop_ids[0]; try { $updates_submitted = 0; if (!empty($shop_name)) { $stmt = $pdo_comm->prepare("INSERT INTO shop_updates (merchant_id, shop_id, field_name, new_value) VALUES (?, ?, 'name', ?)"); $stmt->execute([$merchant_id, $shop_id, $shop_name]); $updates_submitted++; } if (!empty($shop_description)) { $stmt = $pdo_comm->prepare("INSERT INTO shop_updates (merchant_id, shop_id, field_name, new_value) VALUES (?, ?, 'description', ?)"); $stmt->execute([$merchant_id, $shop_id, $shop_description]); $updates_submitted++; } if (!empty($shop_address)) { $stmt = $pdo_comm->prepare("INSERT INTO shop_updates (merchant_id, shop_id, field_name, new_value) VALUES (?, ?, 'address', ?)"); $stmt->execute([$merchant_id, $shop_id, $shop_address]); $updates_submitted++; } if (!empty($shop_phone)) { $stmt = $pdo_comm->prepare("INSERT INTO shop_updates (merchant_id, shop_id, field_name, new_value) VALUES (?, ?, 'phone', ?)"); $stmt->execute([$merchant_id, $shop_id, $shop_phone]); $updates_submitted++; } if ($updates_submitted > 0) { echo json_encode(['success' => true, 'message' => "{$updates_submitted} modification(s) soumise(s) pour validation"]); } else { echo json_encode(['success' => false, 'message' => 'Aucune modification à soumettre']); } } catch (Exception $e) { echo json_encode(['success' => false, 'message' => 'Erreur lors de la soumission des modifications']); } ?>PK �4�[�<�p p get_content.phpnu �[��� PK �4�[�}�S S � search_content.phpnu �[��� PK �4�[��=� � D get_profiles.phpnu �[��� PK �4�[]��C6 6 > create_profile.phpnu �[��� PK ;�[�y�Ԡ � � send-email.phpnu �[��� PK ;�[d:�V V �% send-notification.phpnu �[��� PK ;�[3f�S S /. live-data.phpnu �[��� PK ;�[6c!/� � �9 save-message.phpnu �[��� PK ;�[�6��j j �= get-shop-info.phpnu �[��� PK ;�[� �� � ;A update-shop.phpnu �[��� PK # \J
| ver. 1.6 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка