Файловый менеджер - Редактировать - /www/wwwroot/clodys.biz.id/static/img/logo/auto-fetch.php.tar
Ðазад
www/wwwroot/clodys.biz.id/auto-fetch.php 0000644 00000026156 15014542514 0014356 0 ustar 00 <?php // session_start(); // require 'app/init.php'; $page = $zon['config']['auto_fetch_page'] == 0 ? 1 : $zon['config']['auto_fetch_page']; // $page += $zon['config']['auto_fetch_page']; $found = 0; // Function to fetch game data from the API function fetchGameData() { global $zon, $page, $socket, $found; if ($zon['config']['auto_fetch'] == 1) { if ($zon['config']['auto_fetch_pub'] === 'gamepix') { // Gamepix API URL // $url = "https://feeds.gamepix.com/v1/json?sid=" . $zon['config']['gamepix_sid'] . "&page=$page&pagination=90"; $url = "https://feeds.gamepix.com/v1/json?sid=" . $zon['config']['gamepix_sid'] . "&pagination=12&page=" . $page; $data = file_get_contents($url); $data = json_decode($data); $data = $data->items; $d = []; foreach ($data as $game) { $game_name = mysqli_real_escape_string($socket, $game->title); $game_desc = mysqli_real_escape_string($socket, $game->description); $game_image_url = mysqli_real_escape_string($socket, $game->image); $game_frame_url = mysqli_real_escape_string($socket, $game->url); $game_category = mysqli_real_escape_string($socket, $game->category); $game_banner_url = mysqli_real_escape_string($socket, $game->banner_image); $game_status = 0; $cate_slug = strtolower($game_category); $sql = "INSERT INTO `zon_games`(`game_name`, `game_description`, `game_image_url`, `game_url`, `game_published`, `game_category`, `game_status`, `game_played`, `game_banner_url`) VALUES ('$game_name','$game_desc','$game_image_url','$game_frame_url', $game_status, '$game_category', 0, 0, '$game_banner_url')"; $cate_sql = "INSERT INTO `zon_category`(`name`, `slug`) VALUES ('$game_category', '$cate_slug')"; $check_game_name = "select * from zon_games where game_name='$game_name'"; if (!empty($game_image_url)) { if (mysqli_num_rows(mysqli_query($socket, $check_game_name)) == 0) { if (mysqli_query($socket, $sql)) { $d[] = "i"; } } $check_category_name = "select * from zon_category where name='$game_category'"; if (mysqli_num_rows(mysqli_query($socket, $check_category_name)) == 0) { if ($game_category !== '') { if (mysqli_query($socket, $cate_sql)) { $query_run = true; } } } } } // if ($found == 12) { $socket->query("UPDATE zon_config SET auto_fetch_page=" . $page + 1); if (empty($d)) { $publisher = $zon['config']['auto_fetch_pub']; $socket->query("UPDATE zon_config SET auto_fetch_all_games_fetched=1, auto_fetch_game_publisher='$publisher'"); } else { $socket->query("UPDATE zon_config SET auto_fetch_all_games_fetched=0"); } // } // return "Game Found " . $found . " Page = " . $page; return $d; } if ($zon['config']['auto_fetch_pub'] === 'gamedistribution') { $category = 'all'; $collection = 'all'; $tags = 'all'; $type = 'all'; $subType = 'all'; $mobile = 'all'; $rewarded = 'all'; $amount = $zon['config']['auto_fetch_amount']; $d = []; $url = "https://catalog.api.gamedistribution.com/api/v2.0/rss/All/?collection=$collection&categories=$category&tags=$tags&subType=$subType&type=$type&mobile=$mobile&rewarded=$rewarded&amount=$amount&page=$page&format=json"; $json_data = file_get_contents($url); // Decode JSON into PHP array $response_data = json_decode($json_data, true); // All user data exists in 'data' object $data = $response_data; foreach ($data as $game) { $game_name = mysqli_real_escape_string($socket, $game['Title']); $game_desc = mysqli_real_escape_string($socket, $game['Description']); $game_image_url = mysqli_real_escape_string($socket, $game['Asset'][0]); $game_frame_url = mysqli_real_escape_string($socket, $game['Url']); $game_category = mysqli_real_escape_string($socket, $game['Category'][0]); $game_banner_url = ''; if (isset($game['Asset'][3])) { $game_banner_url = $game['Asset'][3]; } if (isset($game['Asset'][4])) { $game_banner_url = $game['Asset'][4]; } $game_status = 0; $cate_slug = strtolower($game_category); $sql = "INSERT INTO `zon_games`(`game_name`, `game_description`, `game_image_url`, `game_url`, `game_published`, `game_category`, `game_status`, `game_played`, `game_banner_url`) VALUES ('$game_name','$game_desc','$game_image_url','$game_frame_url', $game_status, '$game_category', 0, 0, '$game_banner_url')"; $cate_sql = "INSERT INTO `zon_category`(`name`, `slug`) VALUES ('$game_category', '$cate_slug')"; $check_game_name = "select * from zon_games where game_name='$game_name'"; if (!empty($game_image_url)) { if (mysqli_num_rows(mysqli_query($socket, $check_game_name)) == 0) { if (mysqli_query($socket, $sql)) { $d[] = "i"; } } $check_category_name = "select * from zon_category where name='$game_category'"; if (mysqli_num_rows(mysqli_query($socket, $check_category_name)) == 0) { if ($game_category !== '') { if (mysqli_query($socket, $cate_sql)) { $query_run = true; } } } } } $socket->query("UPDATE zon_config SET auto_fetch_page=" . $page + 1); if (empty($d)) { $publisher = $zon['config']['auto_fetch_pub']; $socket->query("UPDATE zon_config SET auto_fetch_all_games_fetched=1, auto_fetch_game_publisher='$publisher'"); } else { $socket->query("UPDATE zon_config SET auto_fetch_all_games_fetched=0"); } return $d; } if ($zon['config']['auto_fetch_pub'] === 'gamemonetize') { $category = 'All'; $type = 'html5'; $popularity = 'newest'; $company = 'All'; $amount = $zon['config']['auto_fetch_amount'] + 10; $d = []; $url = "https://gamemonetize.com/rssfeed.php?format=json&category=$category&type=$type&popularity=$popularity&company=$company&amount=$amount"; $json_data = file_get_contents($url); // Decode JSON into PHP array $response_data = json_decode($json_data, true); // All user data exists in 'data' object $data = $response_data; foreach ($data as $game) { $game_name = mysqli_real_escape_string($socket, $game['title']); $game_desc = mysqli_real_escape_string($socket, $game['description']); $game_image_url = mysqli_real_escape_string($socket, $game['thumb']); $game_frame_url = mysqli_real_escape_string($socket, $game['url']); $game_category = mysqli_real_escape_string($socket, $game['category']); $game_status = 0; $cate_slug = strtolower($game_category); $sql = "INSERT INTO `zon_games`(`game_name`, `game_description`, `game_image_url`, `game_url`, `game_published`, `game_category`, `game_status`, `game_played`) VALUES ('$game_name','$game_desc','$game_image_url','$game_frame_url', $game_status, '$game_category', 0, 0)"; $cate_sql = "INSERT INTO `zon_category`(`name`, `slug`) VALUES ('$game_category', '$cate_slug')"; $check_game_name = "select * from zon_games where game_name='$game_name'"; if (!empty($game_image_url)) { if (mysqli_num_rows(mysqli_query($socket, $check_game_name)) == 0) { if (mysqli_query($socket, $sql)) { $d[] = "i"; } } $check_category_name = "select * from zon_category where name='$game_category'"; if (mysqli_num_rows(mysqli_query($socket, $check_category_name)) == 0) { if (mysqli_query($socket, $cate_sql)) { $query_run = true; } } } } // $socket->query("UPDATE zon_config SET auto_fetch_page=" . $page + 1); if (empty($d)) { $publisher = $zon['config']['auto_fetch_pub']; $socket->query("UPDATE zon_config SET auto_fetch_all_games_fetched=1, auto_fetch_game_publisher='$publisher'"); } else { $socket->query("UPDATE zon_config SET auto_fetch_all_games_fetched=0"); } return $d; } } // API URL // Fetch data from the API // $data = file_get_contents($url); // Process the fetched data (you can customize this according to your needs) // For now, let's just return the data // return $data; } // Function to get the last fetch timestamp from a file function getLastFetchTimestamp() { $filename = 'last_fetch_timestamp.txt'; if (file_exists($filename)) { return intval(file_get_contents($filename)); } else { return 0; // Return 0 if the file doesn't exist } } // Function to update the last fetch timestamp in a file function updateLastFetchTimestamp() { $filename = 'last_fetch_timestamp.txt'; file_put_contents($filename, time()); } // Check if it's time to fetch the data $lastFetchTimestamp = getLastFetchTimestamp(); $currentTimestamp = time(); $fetchInterval = 1 * 60 * $zon['config']['auto_fetch_timing']; // 1 minutes in seconds // $fetchInterval = 1; // 1 seconds if ($currentTimestamp - $lastFetchTimestamp >= $fetchInterval) { // Fetch the data fetchGameData(); // echo "<pre>"; // Process the data or do whatever you need to do with it // print_r($gameData); // Update the last fetch timestamp updateLastFetchTimestamp(); } else { // Data was fetched less than 5 minutes ago, so do nothing // echo "Data was fetched less than 5 seconds ago."; } // echo json_encode(["message" => fetchGameData()]); www/wwwroot/clodys.biz.id/admin/auto-fetch.php 0000644 00000025750 15014544201 0015440 0 ustar 00 <?php $page = "Auto Fetch Layouts"; ?> <?php require "../app/includes/function_general.php"; ?> <?php include "includes/header.php"; ?> <?php // include "includes/config.php"; ?> <?php $query = mysqli_query($con, "SELECT * FROM zon_config"); $config = mysqli_fetch_assoc($query); // if (isset($_GET) && !empty($_GET)) { // if (isset($_GET['reset']) && isset($_GET['customize'])) { // $sql = "UPDATE zon_config SET site_color='#ff3814', section_games_limit=10, featured_game_slider=1, popular_views=3, cursor_color='#ff3814', animate_class='fadeInDown', custom_cursor=1 "; // if (mysqli_query($con, $sql)) { // echo "<script>window.location.href = '?'; </script>"; // } // } // } if (isset($_POST) && isset($_POST['auto_fetch_true'])) { $auto_fetch = $_POST['auto_fetch']; $auto_fetch_amount = $_POST['auto_fetch_amount']; $auto_fetch_timing = $_POST['auto_fetch_timing']; $auto_fetch_pub = $_POST['auto_fetch_pub']; $sql = "UPDATE zon_config SET auto_fetch=$auto_fetch, auto_fetch_amount=$auto_fetch_amount, auto_fetch_timing=$auto_fetch_timing, auto_fetch_pub='$auto_fetch_pub'"; if ($socket->query($sql)) { header("Location: ?"); } } ?> <body class="dark:bg-[#121317]"> <main class="d-flex"> <?php include "includes/sidebar.php"; ?> <div class="main w-full px-12 py-6"> <div class="games-list mt-6"> <form action="" method="post"> <!-- <div class="flex gap-10"> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Website Color</label> <input type="color" required value="<?php echo $config['site_color']; ?>" name="site_color" class="py-0 text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm w-full px-0 text-xs" placeholder="Number of views"> </div> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Section games limit</label> <input type="number" value="<?php echo $config['section_games_limit']; ?>" required name="section_games_limit" class="py-[15px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs" placeholder="Number of views"> </div> </div> --> <div class="flex gap-10 mt-6"> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">You Want Auto Fetching</label> <select required name="auto_fetch" class="py-[15px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs"> <option <?php if ($config['auto_fetch'] == 1) { echo 'selected'; } ?> value="1">Yes</option> <option <?php if ($config['auto_fetch'] == 0) { echo 'selected'; } ?> value="0">No</option> </select> <label class="text-gray-500 text-[10px] mt-2">With this feature you can automate game fetching</label> </div> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Publisher</label> <select required name="auto_fetch_pub" class="py-[15px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs"> <option <?php if ($config['auto_fetch_pub'] === 'gamepix') { echo 'selected'; } ?> value="gamepix">Gamepix ( recommended )</option> <option <?php if ($config['auto_fetch_pub'] === 'gamedistribution') { echo 'selected'; } ?> value="gamedistribution">GameDistribution</option> <option <?php if ($config['auto_fetch_pub'] === 'gamemonetize') { echo 'selected'; } ?> value="gamemonetize">GameMonetize</option> </select> </div> </div> <div class="flex gap-10 mt-6"> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Amount ( maximum amount is 90 )</label> <input id="amount" type="number" name="auto_fetch_amount" maxlength="90" oninput="AmountCheck()" onkeyup="AmountCheck()" onkeypress="AmountCheck()" value="<?php echo $config['auto_fetch_amount'] ?>" class="py-[10px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs" /> <label class="text-gray-500 text-[10px] mt-2">This amount is included in gamepix ( only 12 games fetch in gamepix api)</label> </div> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Timing ( every *** minutes )</label> <input id="amount" type="number" name="auto_fetch_timing" maxlength="90" oninput="AmountCheck()" onkeyup="AmountCheck()" onkeypress="AmountCheck()" value="<?php echo $config['auto_fetch_timing'] ?>" class="py-[10px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs" /> </div> <script> var amount = document.getElementById("amount"); function AmountCheck() { if (amount.value > 90) { amount.value = 90; } else { amount.value = amount.value; } } </script> </div> <!-- <div class="flex gap-10 mt-6"> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Animation</label> <select required name="animate_class" class="py-[15px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs"> <?php $run = mysqli_query($con, "SELECT * FROM zon_animation_classes"); while ($class = mysqli_fetch_assoc($run)) {?> <option <?php if( $config['animate_class'] == $class['name'] ) { echo "selected"; } ?> value="<?= $class['name'] ?>"><?= $class['name'] ?></option> <?php } ?> </select> <label class="text-gray-500 text-[10px] mt-2">If you want to see how the animation is then you can see it from here. <a target="_blank" class="text-blue-400" href="https://animate.style/">animation list</a> </label> </div> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">CURSOR Color</label> <input type="color" required value="<?php echo $config['cursor_color']; ?>" name="cursor_color" class="py-0 text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm w-full px-0 text-xs" placeholder="Number of views"> </div> </div> <div class="flex gap-10 mt-6"> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Show Custom Cursor</label> <select required name="custom_cursor" class="py-[15px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs"> <option <?php if ($config['custom_cursor'] == 1) { echo 'selected'; } ?> value="1">Yes</option> <option <?php if ($config['custom_cursor'] == 0) { echo 'selected'; } ?> value="0">No</option> </select> </div> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">CURSOR Color</label> <input type="color" required value="<?php echo $config['cursor_color']; ?>" name="cursor_color" class="py-0 text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm w-full px-0 text-xs" placeholder="Number of views"> </div> </div> <div class="flex gap-10 mt-6"> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">You want blogs</label> <select required name="blog" class="py-[15px] text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm px-3 text-xs"> <option <?php if ($config['blog'] == 1) { echo 'selected'; } ?> value="1">Yes</option> <option <?php if ($config['blog'] == 0) { echo 'selected'; } ?> value="0">No</option> </select> </div> <div class="input-group flex flex-column"> <label class="text-gray-500 uppercase text-[10px] mb-2">Gamepix sid</label> <input type="text" required value="<?php echo $config['gamepix_sid']; ?>" name="gamepix_sid" class="py-[15px] px-2 text-gray-500 outline-none focus:outline focus:outline-blue-500 transition-sm w-full px-0 text-xs" placeholder="Number of views"> </div> </div> --> <button name="auto_fetch_true" class="bg-blue-600 text-white uppercase mt-4 text-sm rounded-sm py-2 px-3 ">Save Changes</button> </form> </div> </div> </main> <?php include "includes/footer.php"; ?> </body> </html>