PK

ADDRLIN : /home/questend/public_html/subdomain/coforge.jiffyfilms.com/admin/dashboard/
FLL :
Current File : /home/questend/public_html/subdomain/coforge.jiffyfilms.com/admin/dashboard/get_ask_questions.php

<?php
session_start();

// Ensure the user has the correct admin role
if (!isset($_SESSION['admin_role_id']) || $_SESSION['admin_role_id'] != 2) {
    // Send an unauthorized error and stop execution
    http_response_code(403);
    echo json_encode(['error' => 'Unauthorized Access']);
    exit;
}

// Include your necessary configuration and function files
// Make sure to provide the correct paths
require_once '../includes/settings/PDODB.php'; // Include your database class
require_once '../includes/modules/functions.php'; // Include your functions class

$pdodb = PDODB::getInstance();
$function = new Functions(); // Assuming your functions are in a class

$sqlask = "SELECT id, uId, question, isDated FROM tb_askquestion WHERE status = 'Final' AND isActive = 1 ORDER BY id DESC";
$askQuestionlist = $pdodb->query($sqlask);

$data = [];
foreach ($askQuestionlist as $question) {
    $uId = $question['uId'];
    $userData = $function->getUsers($uId, null, null, 1);
    
    $username = '';
    $email = '';
    if (!empty($userData) && isset($userData[0])) {
        $username = $userData[0]['username'] ?? 'N/A';
        $email = $userData[0]['email'] ?? 'N/A';
    }
    
    $data[] = [
        'question' => htmlspecialchars($question['question']),
        'username' => htmlspecialchars($username),
        'email' => htmlspecialchars($email),
        'date' => $question['isDated']
    ];
}

// Set the content type header to application/json and output the data
header('Content-Type: application/json');
echo json_encode($data);
exit;
?>


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home