HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/nclive/wp-content/plugins/nc_plugin/nc_current_affairs_single.php
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
// $url_slug = basename($actual_link);

global $wpdb;
$slug = get_query_var('pid');
if (!isset($_SESSION['web_med'])) {
    $_SESSION['web_med'] = 2;
}
$type = 'daily';
$medium_id = $_SESSION['web_med'];
$status = 0;
$message = '';
$apiValue = json_encode(['type' => $type]);
// print_r($apiValue);
$cch = curl_init();
curl_setopt($cch, CURLOPT_URL, "https://sarkaripariksha.com/dashboardApi/current-affairs-apis/api_for_category_dates.php");
curl_setopt($cch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cch, CURLOPT_POST, true);
curl_setopt($cch, CURLOPT_POSTFIELDS, $apiValue);
curl_setopt($cch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Content-Length: ' . strlen($apiValue)
]);
$response = curl_exec($cch);
$httpCode = curl_getinfo($cch, CURLINFO_HTTP_CODE);
$curlError = curl_error($cch);
curl_close($cch);
if ($response === false) {
    $message = "cURL eerror: " . $curlError;
} elseif ($httpCode !== 200) {
    $message = "HTTP eerror: " . $httpCode;
} else {
    $news_output = json_decode($response, true);
    if (json_last_error() === JSON_ERROR_NONE) {
        $status = 1;
    } else {
        $message = "JSON decode eerror: " . json_last_error_msg();
    }
}

?>
<link rel="stylesheet" href="/wp-content/themes/nctheme/css/swiper-bundle.min.css" />
<script src="/wp-content/themes/nctheme/js/swiper-bundle.min.js"></script>
<link href="/wp-content/plugins/nc_plugin/currentAffairs-style.css?v=<?php echo date('ymd'); ?>" rel="stylesheet" type="text/css" />

<style>
    .smallcardslider {
        padding: 2px;
    }

    .small-cards {
        width: 100%;
        position: relative;
    }

    .current-affairs-section .current-header-menu {
        width: 520px;
    }

    @media screen and (max-width: 920px) {
        .current-affairs-section .current-header-menu {
            width: 330px;
        }
    }

    @media screen and (min-width: 921px) and (max-width: 1023px) {
        .current-affairs-section .current-header-menu {
            width: 240px;
        }
    }

    @media screen and (min-width: 1024px) and (max-width: 1366px) {
        .current-affairs-section .current-header-menu {
            width: 300px;
        }
    }

    .protected-content {
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
    }
</style>
<!-- ALL PAGE HEADER SECTION -->
<section class="allPageheaderSection">
    <div class="currentPageheaderSectionbg"></div>
    <div class="container">
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <h1 id="pageHead" class="sec_head"></h1>
            </div>
        </div>
    </div>
</section>

<!-- END ALL PAGE HEADER SECTION -->
<section class="current-affairs-section">
    <div class="container">
        <div class="current-affairs-cardBox current-affairs-singleheader" style="overflow: hidden;">
            <div class="main-header">
                <div class="main-header-left">
                    <div class="mobile_hide">
                        <a href="/current-affairs/" class="mobile_hide all_tabCurrent">
                            <img src="/wp-content/plugins/nc_plugin/images/current-navImg.png" alt=""
                                style="width: 25px;object-fit:contain;">
                        </a>
                    </div>
                    <div class="scroll-left-btn">
                        <i class="fas fa-chevron-left"></i>
                    </div>
                    <div class="current-header-menu">
                        <?php if ($status == 1 && $news_output[0]['status'] == 1) {
                            foreach ($news_output[0]['categories'] as $cat) { ?>
                                <a href="https://naukriconnect.com/daily-current-affairs/">
                                    <li class="categories" id="<?php echo $cat['id']; ?>">
                                        <?php echo $cat['topic_name_english']; ?>
                                    </li>
                                </a>
                            <?php }
                        } else { ?>
                            <li>No Category</li>
                        <?php } ?>
                    </div>
                    <div class="scroll-right-btn">
                        <i class="fas fa-chevron-right"></i>
                    </div>
                </div>

                <div class="headerrightExtra block-div">
                    <ul class="nav-tabs right-button-menu">
                        <li class="navItem web_hides">
                            <a href="/current-affairs/" style="padding: 5px;">
                                <img src="/wp-content/plugins/nc_plugin/images/current-navImg.png" alt=""
                                    style="width: 25px;object-fit:contain;">
                            </a>
                        </li>
                        <li class="navItem active"> <a href="/daily-current-affairs/">Daily Current Affairs <span class="notify"></span> </a> </li>
                        <li class="navItem"><a href="/one-liner-current-affairs/">One Liner Current Affairs</a> </li>
                        <li class="navItem"> <a href="/static-gk/">Static GK </a></li>
                        <li class="select-item">
                            <select class="form-control" onchange="chngMed(this.value)">
                                <option value="1" <?php if ($medium_id == "1") {
                                                        echo 'selected';
                                                    } ?>>English</option>
                                <option value="2" <?php if ($medium_id == "2") {
                                                        echo 'selected';
                                                    } ?>>Hindi</option>
                            </select>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="current-affairs-singlePage row">
                <div class="current-affairs-DailyBox col-md-9 col-sm-12 col xs-12 protected-content">
                    <div class="main-daily-card"></div>
                    <div class="small-cards">
                        <div class="swiper smallcardslider">
                            <div class="swiper-wrapper" id="newSlider"></div>
                            <div class="nextPre_button">
                                <div class="swiper-button-next"></div>
                                <div class="swiper-button-prev"></div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="download-box col-md-3 col-sm-12 col xs-12">
                    <!-- multiplex-vertical -->
                    <ins class="adsbygoogle"
                        style="display:block"
                        data-ad-format="autorelaxed"
                        data-ad-client="ca-pub-2967295438144070"
                        data-ad-slot="1651949782"></ins>
                    <script>
                        (adsbygoogle = window.adsbygoogle || []).push({});
                    </script>
                </div>
            </div>
        </div>
    </div>
</section>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
    jQuery(".notify").removeClass("badge_notify");
    var spans = Number(localStorage.getItem("spanCounter"));
    if (spans > 0) {
        jQuery(".notify").addClass("badge_notify");
        jQuery(".badge_notify").text(spans);
    }

    jQuery(function($) {
        viewContent(<?php echo $medium_id; ?>);
    });

    function chngMed(med) {
        viewContent(med);
    }

    /****on-change function ****/
    function viewContent(medium_id) {
        var category = '<?php echo $slug; ?>';
        var type = '<?php echo $type; ?>';
        // console.log(category + '=final=' + type + '=' + medium_id);
        var arr = {
            "slug": category,
            "type": type,
            "medium_id": medium_id
        };
        $.ajax('https://sarkaripariksha.com/dashboardApi/current-affairs-apis/api_for_single_news.php', {
            type: 'POST',
            data: JSON.stringify(arr),
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function(response) {
                // console.log(response);
                if (response.length > 0 && response[0].status === 1) {
                    $("#pageHead").text(response[0].data.news_heading);
                    $(".main-daily-card").html("");
                    $(".main-daily-card").html(
                        `<div class="main-cardBox">
                            <img src="https://sarkaripariksha.com/daily-news-images/${response[0].data.news_image}" alt="image">
                            <div style="position:relative;"> 
                                <h3>${response[0].data.news_heading}</h3>
                                <div class="data-list">${response[0].data.news_content}</div>
                                <p class="content-date">${response[0].data.topic_name_english}, ${response[0].data.add_date}</p>
                            </div> 
                        </div>`
                    );
                    var news_array = response[0].other;
                    openSlider(news_array);
                } else {
                    $(".main-daily-card").html("No data found");
                }
            },
            error: function(jqXhrs, textStatus, errorMessage) {
                console.log("Error:", textStatus, errorMessage);
            }
        });
    }

    let swiper;

    function openSlider(news_array) {
        $("#newSlider").html("");
        // console.log("slider found Questions:", news_array);
        $.each(news_array, function(index, item) {
            // console.log("Question " + (index + 1) + ": " + classType);
            var slide =
                `<div class="swiper-slide"><a href="https://naukriconnect.com/current-affairs/${item.news_slug}"> <div class="slidercard"><div class="slidercard-image"><i class="fas fa-arrow-right arrow-icon"></i><img src="https://sarkaripariksha.com/daily-news-images/${item.news_image}" alt="image"></div><div class="card-container"><p>${item.news_heading}</p><p>${item.topic_name_english}, ${item.add_date}</p></div> </div> </a></div>`;
            $("#newSlider").append(slide);
        });

        if (swiper) {
            swiper.destroy(true, true); // Destroy the existing swiper instance
        }
        // Ensure Swiper is available
        // if (typeof Swiper !== "undefined") { }

        swiper = new Swiper(".smallcardslider", {
            slidesPerView: 3,
            spaceBetween: 16,
            grabCursor: true,

            navigation: {
                nextEl: ".swiper-button-next",
                prevEl: ".swiper-button-prev",
            },

            keyboard: true,
            // mousewheel: true,
            loop: false,

            breakpoints: {
                0: {
                    slidesPerView: 1,
                },
                576: {
                    slidesPerView: 2,
                },
                992: {
                    slidesPerView: 3,
                }
            }
        });
    }

    // current-header-menu arrow slide
    const menus = document.querySelectorAll('.current-header-menu');
    const rightBtns = document.querySelectorAll('.scroll-right-btn');
    const leftBtns = document.querySelectorAll('.scroll-left-btn');

    // Attach scroll behavior for each menu
    menus.forEach((menu, index) => {

        const rightBtn = rightBtns[index];
        const leftBtn = leftBtns[index];

        // Scroll Right
        rightBtn.addEventListener('click', () => {
            menu.scrollBy({
                left: 300,
                behavior: 'smooth'
            });
        });

        // Scroll Left
        leftBtn.addEventListener('click', () => {
            menu.scrollBy({
                left: -300,
                behavior: 'smooth'
            });
        });

        // Update arrows visibility
        function updateArrows() {
            // Left End
            if (menu.scrollLeft <= 0) {
                leftBtn.style.opacity = "0.1";
                leftBtn.style.pointerEvents = "none";
                leftBtn.style.cursor = "none";
            } else {
                leftBtn.style.opacity = "1";
                leftBtn.style.pointerEvents = "auto";
                leftBtn.style.cursor = "pointer";
            }

            // Right End
            if (menu.scrollLeft + menu.clientWidth >= menu.scrollWidth - 5) {
                rightBtn.style.opacity = "0.1";
                rightBtn.style.pointerEvents = "none";
                rightBtn.style.cursor = "none";
            } else {
                rightBtn.style.opacity = "1";
                rightBtn.style.pointerEvents = "auto";
                rightBtn.style.cursor = "pointer";
            }
        }

        // Attach scroll listener
        menu.addEventListener('scroll', updateArrows);
        // Initial check
        updateArrows();
    });
</script>
<script>
    document.addEventListener('contextmenu', event => event.preventDefault());
    document.addEventListener('keydown', function(e) {
        if (
            (e.ctrlKey && (e.key === 'c' || e.key === 'u' || e.key === 's')) ||
            (e.key === 'F12')
        ) {
            e.preventDefault();
        }
    });
</script>