OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
quiz
/
backup
/
old_backup
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📁
backup
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
callback.php
846 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📁
data
-
02/15/2025 11:20:34 AM
rwxr-xr-x
📄
function.php
5.06 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
index.html
2.27 KB
02/15/2025 11:21:46 AM
rw-r--r--
📄
oauth.php
332 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
register.php
5.29 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
subscription_check.php
1.37 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
verify.php
2.21 KB
05/19/2025 10:07:16 AM
rw-r--r--
Editing: subscription_check.php
Close
<?php session_start(); // Include the functions file require_once('function.php'); // Step 1: Ensure the user is authenticated (access token is available) if (!isset($_SESSION['access_token'])) { // If not authenticated, send back a message to prompt login echo json_encode(['error' => 'User not authenticated', 'login_required' => true]); exit(); } // Step 2: Get the access token from session $access_token = getAccessTokenFromSession(); try { $subscriptions_data = fetchYouTubeSubscriptions($access_token); // If the response is empty or not valid, handle as an error if (!$subscriptions_data || !isset($subscriptions_data['items'])) { echo json_encode(['error' => 'Failed to fetch subscriptions', 'login_required' => false]); exit(); } } catch (Exception $e) { // If there's an exception (e.g., network error, invalid response) echo json_encode(['error' => 'An error occurred while fetching subscriptions', 'login_required' => false]); exit(); } $channel_id_to_check = 'UC4MqIPSKb2FLYyPZQTDuqPQ'; // Replace with the channel ID you want to check // Step 5: Check if the user is subscribed to the specified channel $is_subscribed = checkIfSubscribed($subscriptions_data, $channel_id_to_check); // Step 6: Return the result as JSON echo json_encode(['is_subscribed' => $is_subscribed]); ?>