•Each release branch of PHP is fully supported for two years from its initial stable release https://www.php.net/supported-versions.php PHP Backup: https://ry3yr.github.io/php.zip Run php server locally (android): https://apkcombo.com/de/palapa-web-server/com.alfanla.android.pws/download/apk#urusai.social/@alcea/111761622206017944#i.ibb.co/cx175BB/Screenshot-20240115-165447-Opera.png Install ComposerPackagesManually(Windows) https://m.youtube.com/watch?v=j8kpwzE6ju0 https://alcea-wisteria.de/PHP/composer-packages/ ___________________________________________________________________________________________________________________ _____https://stackoverflow.com/questions/40545795/how-do-i-install-composer-php-packages-without-composer------ *php-install htaccess deny all access to html files, but still allow php files to write to them serverside ---------------------------------- Require all denied ____________________ VroidHub fetch model info (name image link) ---------------------------- ===allmodelstats.php== array( 'method' => 'GET', 'header' => 'Referer: ' . $base_url . "\r\n" ), 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false ) ); // Create the stream context $context = stream_context_create($options); // Fetch the HTML content $html = file_get_contents($url, false, $context); // Check if we got the HTML content if ($html === false) { die('Failed to retrieve HTML'); } // Load HTML into DOMDocument $doc = new DOMDocument(); libxml_use_internal_errors(true); // Suppress warnings for malformed HTML $doc->loadHTML($html); libxml_clear_errors(); // Use DOMXPath to query the document $xpath = new DOMXPath($doc); // Query to find all href attributes starting with /characters/ $nodes = $xpath->query('//a[starts-with(@href, "/characters/")]'); // Array to keep track of unique URLs $unique_urls = array(); // Process nodes and store unique URLs foreach ($nodes as $node) { // Construct full URL $full_url = $base_url . $node->getAttribute('href'); // Add URL to the array if it's not already present if (!in_array($full_url, $unique_urls)) { $unique_urls[] = $full_url; } } // Parse the limit parameter from the URL $limit = isset($_GET['limit']) ? (int)$_GET['limit'] : count($unique_urls); // Ensure limit is positive and does not exceed the number of unique URLs $limit = max(1, min($limit, count($unique_urls))); // Slice the array to include only the number of items specified by the limit $unique_urls = array_slice($unique_urls, 0, $limit); // Display unique URLs and corresponding iframes if (count($unique_urls) > 0) { echo ""; foreach ($unique_urls as $url) { // Display the URL as a clickable link that opens in a new tab //echo '' . $url . '
' . "\n"; // Encode URL for use in query string $encoded_url = urlencode($url); // Display the iframe echo '

' . "\n"; } } else { echo "No unique character URLs found.\n"; } ?> ==singlemodelstats.php== loadHTML($response); // Create an XPath object for querying the DOM $xpath = new DOMXPath($dom); // Extract the title $title = $xpath->query('//title')->item(0)->nodeValue; // Extract the Open Graph image (or fallback to Twitter image if needed) $ogImage = $xpath->query('//meta[@property="og:image"]/@content')->item(0)->nodeValue; $twitterImage = $xpath->query('//meta[@name="twitter:image"]/@content')->item(0)->nodeValue; // Use the OG image or Twitter image $image = $ogImage ? $ogImage : $twitterImage; // Display the link with the title as the link text echo "$title
"; // Display the image below the link, wrapped in an anchor tag if ($image) { echo "$title Image
"; } else { echo "No image available.
"; } } // Close the cURL session curl_close($ch); ?> __________________ Multi Feed RSS render ---------------------- =====index.html===== RSS Feeds Manager

RSS Feeds Manager

==feed.php=== 'Error fetching the feed: ' . curl_error($ch)]); curl_close($ch); exit(); } curl_close($ch); if ($response) { $rss = simplexml_load_string($response); if ($rss === false) { echo json_encode(['error' => 'Failed to parse the feed']); exit(); } $feedData = []; // Determine whether this is a YouTube feed (Atom) or a standard RSS feed if ($rss->getName() === 'feed' && isset($rss->entry)) { // Handle YouTube (Atom) feed foreach ($rss->entry as $entry) { $namespaces = $entry->getNameSpaces(true); $media = $entry->children($namespaces['media']); $feedData[] = [ 'title' => (string) $entry->title, 'link' => (string) $entry->link['href'], 'pubDate' => (string) $entry->published, 'image' => isset($media->group->thumbnail) ? (string) $media->group->thumbnail->attributes()->url : null, ]; if (count($feedData) >= 10) { break; } } } elseif (isset($rss->channel->item)) { // Handle standard RSS feed foreach ($rss->channel->item as $item) { $namespaces = $item->getNameSpaces(true); $mediaContent = null; // Check for media:content or other image tags if (isset($namespaces['media'])) { $media = $item->children($namespaces['media']); if (isset($media->content)) { $mediaContent = (string) $media->content->attributes()->url; } } // Handle cases where the image might be within an enclosure if (!$mediaContent && isset($item->enclosure)) { $mediaContent = (string) $item->enclosure['url']; } $feedData[] = [ 'title' => (string) $item->title, 'link' => (string) $item->link, 'pubDate' => (string) $item->pubDate, 'image' => $mediaContent, ]; if (count($feedData) >= 10) { break; } } } header('Content-Type: application/json'); echo json_encode(['items' => $feedData]); } else { echo json_encode(['error' => 'Unable to fetch feed']); } } else { echo json_encode(['error' => 'No URL provided']); } ?> _____________________ Request Tracker (v2024) -------------- ====index.html==== ArtRequest
REQUESTS


Submit Form

===parsehtml.php==== Requests (.*?)<\/h1>/s', $content, $h1); preg_match('/

(.*?)<\/p>/s', $content, $p); preg_match('/[\'"](.*?)[\'"]/s', $content, $img); return [ 'h1' => $h1[1] ?? 'N/A', 'p' => isset($p[1]) ? nl2br(htmlspecialchars($p[1])) : 'N/A', 'img_src' => $img[1] ?? 'N/A', 'img_alt' => $img[2] ?? 'N/A', ]; } if (!empty($htmlFiles)) { echo ''; echo ''; foreach ($htmlFiles as $file) { $fields = extractFields($file); echo ''; echo ''; echo ''; echo ''; // Already escaped echo ''; //echo ''; echo '';} echo '
FilenameTitleDescriptionImage Source
' . htmlspecialchars($file) . '' . htmlspecialchars($fields['h1']) . '' . $fields['p'] . '' . htmlspecialchars($fields['img_alt']) . '' . htmlspecialchars($fields['img_alt']) . '
'; } else { echo '

No HTML files found.

'; } ?> ====submit.php=== $title

$title

$description

$title "; // Save the content to a file named with the current date and time $date = date("Ymd_His"); $filename = "$date.html"; $file = fopen($filename, "w"); if ($file) { fwrite($file, $htmlContent); fclose($file); echo "File created: $filename"; } else { echo "Unable to write to file."; } } ?> _____________________ Delete Mastodon Posts programatically --------------------------------------- "; curl_close($ch); return null; } curl_close($ch); $user = json_decode($response); if (!isset($user->id)) { echo "Failed to fetch user info.
"; return null; } $url = $apiBaseUrl . "/accounts/{$user->id}/statuses?limit=40"; if ($max_id) { $url .= "&max_id={$max_id}"; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo "Error fetching statuses: " . curl_error($ch) . "
"; curl_close($ch); return null; } curl_close($ch); return json_decode($response); } function deleteStatus($apiBaseUrl, $accessToken, $id) { $url = $apiBaseUrl . "/statuses/{$id}"; $headers = [ 'Authorization: Bearer ' . $accessToken, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo "Error deleting status {$id}: " . curl_error($ch) . "
"; curl_close($ch); return null; } $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $retry_after = curl_getinfo($ch, CURLINFO_RETRY_AFTER); curl_close($ch); if ($http_code === 429) { $retry_after = $retry_after ?? 60; // Default to 60 seconds if not provided echo "Rate limit exceeded. Waiting for {$retry_after} seconds...
"; sleep($retry_after); } return [ 'response' => json_decode($response), 'http_code' => $http_code, ]; } $max_id = null; $total_deleted = 0; $request_count = 0; $start_time = time(); do { $statuses = fetchStatuses($apiBaseUrl, $accessToken, $max_id); if ($statuses === null) { echo "Failed to fetch statuses. Exiting.
"; break; } foreach ($statuses as $status) { $result = deleteStatus($apiBaseUrl, $accessToken, $status->id); if ($result === null) { echo "Failed to delete status {$status->id}. Exiting.
"; break 2; // Exit both loops } echo "Deleted status {$status->id}
"; $max_id = $status->id; $total_deleted++; // Increment request count and sleep to avoid rate limits $request_count++; sleep($rateLimitDelay); // If the request count reaches the limit, wait for the interval to reset if ($request_count >= $maxRequestsPerInterval) { $elapsed_time = time() - $start_time; $sleep_time = max(0, $intervalSeconds - $elapsed_time); echo "Rate limit reached. Sleeping for {$sleep_time} seconds.
"; sleep($sleep_time); // Reset counters $request_count = 0; $start_time = time(); } } } while (count($statuses) > 0); echo "Total posts deleted: {$total_deleted}
"; } else { ?> Delete Mastodon Posts

Delete All User Posts on Mastodon





__________________ Anti Cors Forward (redirect to *.php via ?query= querystring) (!) ----------------------- 'Invalid URL']; } // Use file_get_contents or cURL to fetch the data $context = stream_context_create(['http' => ['ignore_errors' => true]]); $response = @file_get_contents($url, false, $context); if ($response === false) { return ['error' => 'Unable to fetch data from URL']; } return ['data' => $response, 'headers' => $http_response_header]; } // Check if the request is a GET request if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (isset($_GET['query'])) { $url = htmlspecialchars($_GET['query']); $result = fetchDataFromUrl($url); if (isset($result['error'])) { // Return a JSON response with an error header('Content-Type: application/json'); echo json_encode($result); } else { // Determine the content type from the headers $contentType = 'text/plain'; // Default content type foreach ($result['headers'] as $header) { if (stripos($header, 'Content-Type:') === 0) { $contentType = substr($header, strlen('Content-Type: ')); break; } } header('Content-Type: ' . $contentType); echo $result['data']; } } else { header('Content-Type: application/json'); echo json_encode(['error' => 'No query parameter provided']); } } else { header('Content-Type: application/json'); echo json_encode(['error' => 'Invalid request method']); } ___________________________________- Check php server enabled extensions/modules ---------------------------- (↓)

'; if (in_array($ext, get_loaded_extensions())) { echo ''; } else { echo ''; } echo ''; } function get_unpacked_extensions() { $extension_dir = ini_get('extension_dir'); $extensions = array(); if ($extension_dir) { $dir = new DirectoryIterator($extension_dir); foreach ($dir as $fileinfo) { if ($fileinfo->isFile() && pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION) === 'so') { $extensions[] = pathinfo($fileinfo->getFilename(), PATHINFO_FILENAME); } } } return $extensions; } ?>
PHP Version:
Server Extensions
☑ ' . $ext . '☐ ' . $ext . '
____________________ htaccess disable access to certian filetypes in folder (here: png): -------------------------------------- Order Allow,Deny Deny from all ______________________________________ Last played Game Steam ------------------------- loadHTML($html); libxml_clear_errors(); // Clear HTML parsing errors // Initialize variables $gameFound = false; $achievementSection = null; // Find all the div elements $elements = $dom->getElementsByTagName('div'); // Loop through the div elements and find the game and achievement sections foreach ($elements as $element) { $classAttribute = $element->getAttribute('class'); // Check for the recent game element if (!$gameFound && strpos($classAttribute, 'recent_game') !== false) { // Get the game info $gameInfo = $element->getElementsByTagName('div')->item(0); $gameCapsule = $gameInfo->getElementsByTagName('img')->item(0)->getAttribute('src'); $gameTitle = $gameInfo->getElementsByTagName('a')->item(0)->nodeValue; $totalPlaytime = $gameInfo->getElementsByTagName('div')->item(1)->nodeValue; $lastPlayed = $gameInfo->getElementsByTagName('div')->item(2)->nodeValue; // Get the achievement info $achievementInfo = $element->getElementsByTagName('div')->item(1); $achievementSummary = $achievementInfo->getElementsByTagName('span')->item(0)->nodeValue; $achievementProgress = $achievementInfo->getElementsByTagName('div')->item(0)->getAttribute('style'); // Extract the relevant information $achievementCount = explode(' ', $achievementSummary)[1]; $achievementTotal = explode('/', $achievementCount)[1]; $achievementProgress = str_replace('width: ', '', str_replace('%', '', $achievementProgress)); // Display the game information with the background image echo "
"; $gameFound = true; // Mark the game as found } // Check for the achievement section if (strpos($classAttribute, 'game_info_achievements_only_ctn') !== false) { $achievementSection = $element; } } // If the achievement section is found, extract and display the achievement information if ($achievementSection) { $achievementSummary = $achievementSection->getElementsByTagName('span')->item(0)->textContent; $achievementProgressBar = $achievementSection->getElementsByTagName('div')->item(1); $achievementProgressStyle = $achievementProgressBar->getAttribute('style'); // Parse the achievement information $achievementCount = trim(explode('/', $achievementSummary)[0]); $achievementTotal = trim(explode('/', $achievementSummary)[1]); $achievementProgress = str_replace('width: ', '', str_replace('%', '', $achievementProgressStyle)); // Display the achievement information echo "
"; echo "

$gameTitle

"; echo "

Total Playtime: $totalPlaytime

"; //echo "

Last Played: $lastPlayed

"; echo "

Achievements: $achievementCount out of $achievementTotal ($achievementProgress%)

"; echo "
"; echo "
"; //echo "
"; echo "
"; //echo "Achievements: $achievementCount out of $achievementTotal ($achievementProgress%)"; } // If no recent game is found, display a message if (!$gameFound) { echo "No recent games found."; } ?> ____________________ Famitsu Top 30 Chart parser ------------------------------- Game Sales Data

Game Sales Data

array( 'method' => 'GET', 'header' => implode("\r\n", $headers) ) )); $html = file_get_contents($url, false, $context); if ($html === false) { echo "Error: Unable to fetch the website content."; return; } $dom = new DOMDocument(); @$dom->loadHTML($html); $xpath = new DOMXPath($dom); $elements = $xpath->query('//div[@class="card card-game-sale-rank card-game-sale-rank--col-12 card-game-sale-rank--col-sm-12 card-game-sale-rank--col-md-12 card-game-sale-rank--col-lg-8"]'); $gameData = []; $labels = []; $data = []; $platforms = []; $position = 1; foreach ($elements as $element) { $platform_elements = $xpath->query('.//span[contains(@class, "icon-console")]', $element); $platform = ""; foreach ($platform_elements as $platform_element) { $platform_class = $platform_element->getAttribute('class'); if (preg_match('/icon-console--bg-(\w+)/', $platform_class, $matches)) { $platform = $matches[1]; if (!in_array($platform, $platforms)) { $platforms[] = $platform; } break; } } $title = $xpath->query('.//div[@class="card-game-sale-rank__title"]', $element)->item(0)->textContent; $this_week = $xpath->query('.//p[@class="card-game-sale-rank__sales-num-past card-game-sale-rank__sales-num"]', $element)->item(0)->textContent; $cumulative = $xpath->query('.//p[@class="card-game-sale-rank__sales-num-total card-game-sale-rank__sales-num"]', $element)->item(0)->textContent; $price = $xpath->query('.//span[@class="card-game-sale-rank__sales-meter-num"]', $element)->item(0)->textContent; $image_url = $xpath->query('.//div[@class="media-image media-image--game-platform media-image--' . $platform . ' media-image--square"]', $element)->item(0)->getAttribute('style'); $image_url = preg_replace('/^background-image: url\("?([^"]+)"?\);\s*$/', '$1', $image_url); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $gameData[] = [ 'Position' => $position, 'Platform' => $platform, 'Title' => $title, 'ThisWeek' => (int) str_replace(',', '', $this_week), 'Cumulative' => (int) str_replace(',', '', $cumulative), 'SellThrough' => $price, 'Image' => $image_url ]; $labels[] = $title; $data[] = (int) str_replace(',', '', $this_week); $position++; } $platformOptions = ""; foreach ($platforms as $platform) { $platformOptions .= ""; } ?>
Position Platform Title This Week Cumulative Sell-through Image
" . $position . "" . $platform . "" . $title . "" . $this_week . "" . $cumulative . "" . $price . "" . $title . "
_____________________ PersonalInteraction collector ------------------------------ ==chart.html== Chart.js Example

Chart.js Example

===send.php=== $selectedName, 'number1' => $numberField1, 'number2' => $numberField2, 'info' => $infoField ); // Convert the data array to JSON $json = json_encode($data); // Check if the file exists $filename = $selectedName . '_data.json'; if (file_exists($filename)) { // If the file exists, read the existing data $existingData = file_get_contents($filename); $existingData = json_decode($existingData, true); // Prepend the new data to the existing data array_unshift($existingData, $data); // Convert the updated data back to JSON and write it to the file $updatedData = json_encode($existingData); file_put_contents($filename, $updatedData); } else { // If the file doesn't exist, create a new file with the data file_put_contents($filename, "[$json]"); } // Store the first number and the info field in the local storage echo ""; // Optionally, you can display a success message or redirect the user to another page echo "Data saved to " . $filename; } // Check if the first number and info field are stored in the local storage $storedNumber1 = isset($_POST['number1']) ? $_POST['number1'] : (isset($_COOKIE['number1']) ? $_COOKIE['number1'] : ''); $storedInfo = isset($_POST['info']) ? $_POST['info'] : (isset($_COOKIE['info']) ? $_COOKIE['info'] : ''); ?>

Name Selection

">







_______ Fetch newest Nintendo Direct dekudeals url --------------------------- _______________ (PHP) Basic notes app with wysiwyg capability ----------------------------------- ===load.php===

HTML Files in Current Directory

Create File

Create File

">
==save.php== ===edit.php== Edit HTML File

Edit HTML File

'; } else { echo '

File not found: ' . $file_path . '

'; } } else { echo '

No file selected to edit.

'; } ?> Canvas Guestbook ---------------------- Guestbook Canvas
====save_text.php=== $five_minutes_ago) { echo "The text data file has been modified in the last 5 minutes. Exiting script."; exit; } if (file_exists('text_data.json')) { $data = json_decode(file_get_contents('text_data.json'), true); } $data[] = array( 'text' => $text, 'x' => $x, 'y' => $y ); file_put_contents('text_data.json', json_encode($data, JSON_PRETTY_PRINT)); echo "Text saved successfully!"; ?> ___________ RSS parser (+ js yt render) [Fu RSS2JSON!] --------------------- ===php=== ====YT test rss parse=(supports querystring fir chid)== YouTube RSS Feed

YouTube RSS Feed

BlueskyTL Render --------------------------- test
loadXML($feed); $items = $doc->getElementsByTagName('item'); foreach ($items as $item) { $link = $item->getElementsByTagName('link')->item(0); $linkUrl = $link->textContent; $lastSlashPos = strrpos($linkUrl, '/'); $postId = substr($linkUrl, $lastSlashPos + 1); $guid = $item->getElementsByTagName('guid')->item(0); if ($guid->getAttribute('isPermaLink') === 'false') { $guidValue = $guid->textContent; $startPos = strpos($guidValue, 'plc:') + 4; $endPos = strpos($guidValue, '/app.bsky'); $guidPart = substr($guidValue, $startPos, $endPos - $startPos); $didPrefix = 'did:plc:'; } echo "
"; echo ""; } ?> ________________ Fetch 5 links and metadata for pixiv account -----------------------------------------
\n"; $numLinks++; // Increment the link counter if ($numLinks >= 4) { return $pixivLinks; // Return the links to be processed } } else { foreach ($artworks as $artId => $art) { $artLink = "https://www.pixiv.net/artworks/{$artId}"; $pixivLinks[] = $artLink; echo "
\n"; $numLinks++; // Increment the link counter if ($numLinks >= 4) { return $pixivLinks; // Return the links to be processed } } } } else { echo "No artworks found for the given user."; } return []; // Return an empty array if no links were found } function getPageTitle($html) { $titleStart = stripos($html, ''); $titleEnd = stripos($html, ''); if ($titleStart !== false && $titleEnd !== false) { $titleLength = $titleEnd - $titleStart - 7; return substr($html, $titleStart + 7, $titleLength); } return ''; } function processPixivLinks($pixivLinks) { echo "
"; foreach ($pixivLinks as $index => $link) { $html = file_get_contents($link); $title = getPageTitle($html); $bookmarkStart = strpos($html, '"bookmarkCount":'); if ($bookmarkStart !== false) { $bookmarkEnd = strpos($html, ',', $bookmarkStart); if ($bookmarkEnd !== false) { $bookmarkCount = substr($html, $bookmarkStart + 16, $bookmarkEnd - $bookmarkStart - 16); } } $likeStart = strpos($html, '"likeCount":'); if ($likeStart !== false) { $likeEnd = strpos($html, ',', $likeStart); if ($likeEnd !== false) { $likeCount = substr($html, $likeStart + 12, $likeEnd - $likeStart - 12); } } $commentStart = strpos($html, '"commentCount":'); if ($commentStart !== false) { $commentEnd = strpos($html, ',', $commentStart); if ($commentEnd !== false) { $commentCount = substr($html, $commentStart + 15, $commentEnd - $commentStart - 15); } } $counts = "Bookmark Count: {$bookmarkCount}, Like Count: {$likeCount}, Comment Count: {$commentCount}"; echo "
{$title} »
{$counts}
\n"; } echo ""; } $userId = isset($_GET['userId']) ? $_GET['userId'] : '75406576'; $random = isset($_GET['random']); $pixivLinks = getPixivUserArt($userId, $random); processPixivLinks($pixivLinks); ?> PD9waHAKZnVuY3Rpb24gZ2V0UGl4aXZVc2VyQXJ0KCR1c2VySWQsICRyYW5kb20pIHsKJGFwaVVybCA9ICJodHRwczovL3d3dy5waXhpdi5uZXQvYWpheC91c2VyL3skdXNlcklkfS9wcm9maWxlL2FsbD91c2VpZD17JHVzZXJJZH0iOwokY2ggPSBjdXJsX2luaXQoKTsKY3VybF9zZXRvcHQoJGNoLCBDVVJMT1BUX1VSTCwgJGFwaVVybCk7CmN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9SRVRVUk5UUkFOU0ZFUiwgdHJ1ZSk7CmN1cmxfc2V0b3B0KCRjaCwgQ1VSTE9QVF9IRUFERVIsIGZhbHNlKTsKY3VybF9zZXRvcHQoJGNoLCBDVVJMT1BUX1NTTF9WRVJJRllQRUVSLCBmYWxzZSk7CiRyZXNwb25zZSA9IGN1cmxfZXhlYygkY2gpOwpjdXJsX2Nsb3NlKCRjaCk7CiRkYXRhID0ganNvbl9kZWNvZGUoJHJlc3BvbnNlLCB0cnVlKTsKaWYgKGlzc2V0KCRkYXRhWydib2R5J11bJ2lsbHVzdHMnXSkpIHsKJGFydHdvcmtzID0gJGRhdGFbJ2JvZHknXVsnaWxsdXN0cyddOwokbnVtTGlua3MgPSAwOyAvLyBWYXJpYWJsZSB0byBrZWVwIHRyYWNrIG9mIHRoZSBudW1iZXIgb2YgbGlua3MKJHBpeGl2TGlua3MgPSBbXTsKaWYgKCRyYW5kb20pIHsKLy8gR2V0IGEgcmFuZG9tIGFydHdvcmsKJHJhbmRvbUFydElkID0gYXJyYXlfcmFuZCgkYXJ0d29ya3MpOwokcmFuZG9tQXJ0ID0gJGFydHdvcmtzWyRyYW5kb21BcnRJZF07CiRhcnRMaW5rID0gImh0dHBzOi8vd3d3LnBpeGl2Lm5ldC9hcnR3b3Jrcy97JHJhbmRvbUFydElkfSI7CiRwaXhpdkxpbmtzW10gPSAkYXJ0TGluazsKZWNobyAiPGEgdGFyZ2V0PV9ibGFuayBocmVmPVwieyRhcnRMaW5rfVwiPnskYXJ0TGlua308L2E+PGJyPlxuIjsKJG51bUxpbmtzKys7IC8vIEluY3JlbWVudCB0aGUgbGluayBjb3VudGVyCmlmICgkbnVtTGlua3MgPj0gNCkgewpyZXR1cm4gJHBpeGl2TGlua3M7IC8vIFJldHVybiB0aGUgbGlua3MgdG8gYmUgcHJvY2Vzc2VkCn0KfSBlbHNlIHsKZm9yZWFjaCAoJGFydHdvcmtzIGFzICRhcnRJZCA9PiAkYXJ0KSB7CiRhcnRMaW5rID0gImh0dHBzOi8vd3d3LnBpeGl2Lm5ldC9hcnR3b3Jrcy97JGFydElkfSI7CiRwaXhpdkxpbmtzW10gPSAkYXJ0TGluazsKZWNobyAiPGEgdGFyZ2V0PV9ibGFuayBocmVmPVwieyRhcnRMaW5rfVwiPnskYXJ0TGlua308L2E+IDxhIHRhcmdldD1fYmxhbmsgaHJlZj1cImh0dHBzOi8vYWxjZWEtd2lzdGVyaWEuZGUvUEhQLzBkZW1vLzIwMjQtMDMtMTQtUGl4aXZUb29scy8yMDIzLTAzLTE0LXBpeGl2LXNpbmdsZS1pbWctZmV0Y2gvcGl4di1zaW5nbGUtaW1nLWZldGNoLnBocD9waXhpdnVybD17JGFydExpbmt9XCIgaWQ9ZGxkPsK7PC9hPjxkaXYgY2xhc3M9XCJjb3VudHNcIj48L2Rpdj5cbiI7CiRudW1MaW5rcysrOyAvLyBJbmNyZW1lbnQgdGhlIGxpbmsgY291bnRlcgppZiAoJG51bUxpbmtzID49IDQpIHsKcmV0dXJuICRwaXhpdkxpbmtzOyAvLyBSZXR1cm4gdGhlIGxpbmtzIHRvIGJlIHByb2Nlc3NlZAp9Cn0KfQp9IGVsc2UgewplY2hvICJObyBhcnR3b3JrcyBmb3VuZCBmb3IgdGhlIGdpdmVuIHVzZXIuIjsKfQpyZXR1cm4gW107IC8vIFJldHVybiBhbiBlbXB0eSBhcnJheSBpZiBubyBsaW5rcyB3ZXJlIGZvdW5kCn0KCmZ1bmN0aW9uIHByb2Nlc3NQaXhpdkxpbmtzKCRwaXhpdkxpbmtzKSB7CmVjaG8gIjxicj4iOwpmb3JlYWNoICgkcGl4aXZMaW5rcyBhcyAkaW5kZXggPT4gJGxpbmspIHsKJGh0bWwgPSBmaWxlX2dldF9jb250ZW50cygkbGluayk7CiRib29rbWFya1N0YXJ0ID0gc3RycG9zKCRodG1sLCAnImJvb2ttYXJrQ291bnQiOicpOwppZiAoJGJvb2ttYXJrU3RhcnQgIT09IGZhbHNlKSB7CiRib29rbWFya0VuZCA9IHN0cnBvcygkaHRtbCwgJywnLCAkYm9va21hcmtTdGFydCk7CmlmICgkYm9va21hcmtFbmQgIT09IGZhbHNlKSB7CiRib29rbWFya0NvdW50ID0gc3Vic3RyKCRodG1sLCAkYm9va21hcmtTdGFydCArIDE2LCAkYm9va21hcmtFbmQgLSAkYm9va21hcmtTdGFydCAtIDE2KTsKfQp9CiRsaWtlU3RhcnQgPSBzdHJwb3MoJGh0bWwsICcibGlrZUNvdW50IjonKTsKaWYgKCRsaWtlU3RhcnQgIT09IGZhbHNlKSB7CiRsaWtlRW5kID0gc3RycG9zKCRodG1sLCAnLCcsICRsaWtlU3RhcnQpOwppZiAoJGxpa2VFbmQgIT09IGZhbHNlKSB7CiRsaWtlQ291bnQgPSBzdWJzdHIoJGh0bWwsICRsaWtlU3RhcnQgKyAxMiwgJGxpa2VFbmQgLSAkbGlrZVN0YXJ0IC0gMTIpOwp9Cn0KJGNvbW1lbnRTdGFydCA9IHN0cnBvcygkaHRtbCwgJyJjb21tZW50Q291bnQiOicpOwppZiAoJGNvbW1lbnRTdGFydCAhPT0gZmFsc2UpIHsKJGNvbW1lbnRFbmQgPSBzdHJwb3MoJGh0bWwsICcsJywgJGNvbW1lbnRTdGFydCk7CmlmICgkY29tbWVudEVuZCAhPT0gZmFsc2UpIHsKJGNvbW1lbnRDb3VudCA9IHN1YnN0cigkaHRtbCwgJGNvbW1lbnRTdGFydCArIDE1LCAkY29tbWVudEVuZCAtICRjb21tZW50U3RhcnQgLSAxNSk7Cn0KfQokY291bnRzID0gIkJvb2ttYXJrIENvdW50OiB7JGJvb2ttYXJrQ291bnR9LCBMaWtlIENvdW50OiB7JGxpa2VDb3VudH0sIENvbW1lbnQgQ291bnQ6IHskY29tbWVudENvdW50fSI7CmVjaG8gIjxkaXY+PGEgdGFyZ2V0PSdfYmxhbmsnIGhyZWY9J3skbGlua30nPnskbGlua308L2E+IDxhIHRhcmdldD0nX2JsYW5rJyBocmVmPSdodHRwczovL2FsY2VhLXdpc3RlcmlhLmRlL1BIUC8wZGVtby8yMDI0LTAzLTE0LVBpeGl2VG9vbHMvMjAyMy0wMy0xNC1waXhpdi1zaW5nbGUtaW1nLWZldGNoL3BpeHYtc2luZ2xlLWltZy1mZXRjaC5waHA/cGl4aXZ1cmw9eyRsaW5rfScgaWQ9J2RsZCc+wrs8L2E+PGRpdiBjbGFzcz0nY291bnRzJz57JGNvdW50c308L2Rpdj48L2Rpdj5cbiI7Cn0KZWNobyAiPHNjcmlwdD5kb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnbGlua0NvdW50JykuaW5uZXJIVE1MID0gJ051bWJlciBvZiBhcnR3b3JrczogIiAuIGNvdW50KCRwaXhpdkxpbmtzKSAuICInOzwvc2NyaXB0PiI7Cn0KJHVzZXJJZCA9IGlzc2V0KCRfR0VUWyd1c2VySWQnXSkgPyAkX0dFVFsndXNlcklkJ10gOiAnNzU0MDY1NzYnOwokcmFuZG9tID0gaXNzZXQoJF9HRVRbJ3JhbmRvbSddKTsKJHBpeGl2TGlua3MgPSBnZXRQaXhpdlVzZXJBcnQoJHVzZXJJZCwgJHJhbmRvbSk7CnByb2Nlc3NQaXhpdkxpbmtzKCRwaXhpdkxpbmtzKTsKPz4KCg== ________________ Apex Legends Pickrate: --------------------
all Gold Diamond
loadHTMLFile($url); $xpath = new DOMXPath($dom); $elements = $xpath->query('//div[contains(@class, "legends-banner__content")]'); if ($elements->length > 0) { foreach ($elements as $element) { $content = $dom->saveHTML($element); echo $content; } } else { echo "Elements not found."; } } ?> _____________________ Bluesky User RSS Feed Extractor -------------------------------------------------- loadHTML($html); libxml_use_internal_errors(false); // Enable error reporting $xpath = new DOMXPath($dom); $query = '//link[@rel="alternate" and @type="application/rss+xml"]'; $links = $xpath->query($query); foreach ($links as $link) { $href = $link->getAttribute('href'); echo "RSS Link: $href"; } } ?>
_________________________ Manually generate dekudeals json ----------------------------------- ===info.html===










=========fetchinfo.php=== (.*?)<\/span>/"; preg_match($namePattern, $html, $nameMatches); // Find the MSRP value using regular expressions $msrpPattern = '/MSRP:<\/strong>\s*([^<]+)/'; preg_match($msrpPattern, $html, $msrpMatches); // Find the Download size value using regular expressions $downloadSizePattern = '/Download size:<\/strong>\s*([^<]+)/'; preg_match($downloadSizePattern, $html, $downloadSizeMatches); // Find the og:image content using regular expressions $imagePattern = '//'; preg_match($imagePattern, $html, $imageMatches); // Extract the name, MSRP value, Download size, and og:image content from the matches $name = !empty($nameMatches[1]) ? $nameMatches[1] : "Name not found"; $msrpValue = !empty($msrpMatches[1]) ? trim($msrpMatches[1]) : "MSRP value not found"; $downloadSize = !empty($downloadSizeMatches[1]) ? trim($downloadSizeMatches[1]) : "Download size not found"; $imageUrl = !empty($imageMatches[1]) ? $imageMatches[1] : "og:image content not found"; // Display the name, MSRP value, Download size, and og:image content echo "Name: " . $name . "
"; echo "MSRP: " . $msrpValue . "
"; echo "Download size: " . $downloadSize . "
"; echo $imageUrl; // Generate the query string $queryString = http_build_query([ 'name' => $name, 'pricePaid' => $msrpValue, 'gameSize' => $downloadSize, 'url' => $url, 'image' => $imageUrl ]); // Generate the URL with the query string $targetUrl = "info.html?" . $queryString; ?> Find Yugioh Card / Card Search ----------------------
'); if ($existsNode !== false) { // Search result exists, display it $linkNode = strpos($response, '', $linkNode); $linkStart = $linkEnd + 1; $linkEndTag = strpos($response, '', $linkStart); $link = substr($response, $linkStart, $linkEndTag - $linkStart); // Prepend the URL $prefixedLink = 'https://yugioh.fandom.com/wiki/' . $link; $prefixedLink = preg_replace('/ /', '_', $prefixedLink); echo '' . $prefixedLink . ''; echo ''; } else { echo "Search result link not found."; } } else { // Search result does not exist, search for links within the response $pattern = '/]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>/siU'; if (preg_match_all($pattern, $response, $matches)) { // Extract and display the links foreach ($matches[2] as $link) { // Filter links by the first three letters of the search term if (strpos($link, substr($searchTerm, 0, 3)) !== false) { echo '' . $link . ''; echo ''; echo '
'; } } } else { echo "No links found."; } } } ?> ________________ Ygo ydk deck 2 img dldr ------------------------------------- ====fetchdeck.html=== Deck Folder Creation

Deck Folder Creation

==== queryydk.php ====
"; // Copy the image to the deck/$deckname folder $imageName = "$number.jpg"; $destinationPath = "deck/$deckname/$imageName"; file_put_contents($destinationPath, $imageData); } else { $output .= "$number
"; } } elseif (strpos($line, '!side') !== false) { $output .= "
SIDEDECK
"; } elseif (strpos($line, '#extra') !== false) { $output .= "
EXTRADECK
"; } } if (!empty($deckname)) { $output = "
$output
"; } } else { $output = "Failed to retrieve content from the provided URL."; } } elseif (!empty($_FILES['file']['tmp_name'])) { $file = $_FILES['file']['tmp_name']; $content = file_get_contents($file); $lines = explode("\n", $content); foreach ($lines as $line) { if (is_numeric($line)) { $number = preg_replace('/[^0-9]/', '', $line); if (!empty($deckname)) { $imageLink = "https://images.ygoprodeck.com/images/cards_small/$number.jpg"; $imageData = file_get_contents($imageLink); $base64Data = base64_encode($imageData); $imageType = mime_content_type($imageLink); $encodedImage = 'data:' . $imageType . ';base64,' . $base64Data; $output .= "
"; // Copy the image to the deck/$deckname folder $imageName = "$number.jpg"; $destinationPath = "deck/$deckname/$imageName"; file_put_contents($destinationPath, $imageData); } else { $output .= "$number"; } } elseif (strpos($line, '!side') !== false) { $output .= ""; } elseif (strpos($line, '#extra') !== false) { $output .= ""; } } if (!empty($deckname)) { $output = "
$output
"; } } echo $output; ?> __________________________________ Fetch 10 pixiv images (from html linklist) ------------------------------------------ loadHTML($html); if (!$loaded) { echo 'Failed to parse the HTML content.'; exit;} $xpath = new DOMXPath($dom); $artworkLinks = $xpath->query('//a[@target="_blank"]'); $filteredArtworkLinks = []; foreach ($artworkLinks as $link) { $linkUrl = $link->getAttribute('href'); if (!strpos($link->textContent, '»') && strpos($linkUrl, 'pixivurl') === false) { $filteredArtworkLinks[] = $linkUrl;}} if (empty($filteredArtworkLinks)) { echo 'No valid artwork links found.'; exit;} $thumbnailUrls = []; $options = [ 'http' => [ 'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0\r\n" . "Referer: https://accounts.pixiv.net\r\n", ],]; $context = stream_context_create($options); for ($i = 0; $i < 10; $i++) { $randomIndex = array_rand($filteredArtworkLinks); $randomLink = $filteredArtworkLinks[$randomIndex]; $url = $randomLink; $html = file_get_contents($url, false, $context); if ($html === false) { echo 'Failed to fetch the HTML content for the artwork: '.$url.'
'; continue;} $pattern = '/"thumb":"(.*?)"/'; preg_match($pattern, $html, $matches); if (!isset($matches[1])) { echo 'Failed to extract the thumbnail URL for the artwork: '.$url.'
'; continue;} $thumbnailUrl = json_decode('"'.$matches[1].'"'); // Decode the URL-encoded JSON string $imageData = file_get_contents($thumbnailUrl, false, $context); if ($imageData !== false) { $base64 = base64_encode($imageData); $imageSrc = 'data:image/jpeg;base64,' . $base64; echo 'Image '; } else { echo 'Failed to retrieve the image: '.$thumbnailUrl.'
'; }} ?> ___________________________ Nicovideo Metadata Extractor: ----------------------------- [ 'method' => 'GET', 'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3\r\n" ] ]; $context = stream_context_create($options); $html = file_get_contents($url, false, $context); $pattern = '/
_____________________________ MMD / Model url list writer ---------------------------

PHP List Writer

$name, 'url' => $url, 'date' => $date, 'format' => $format, 'password' => $password, 'description' => $description ); // Read existing entries from the JSON file $filename = 'modeldata.json'; $entries = array(); if (file_exists($filename)) { $json_data = file_get_contents($filename); $entries = json_decode($json_data, true); } // Prepend the new entry to the array array_unshift($entries, $data); // Encode the updated data as JSON $json = json_encode($entries); // Save the JSON data to the file file_put_contents($filename, $json); echo 'Data saved successfully!'; } ?>












Current Entries:

Name URL Date Format Password Description
___________________________ Find pixiv link metadata ------------------------- https://www.pixiv.net/artworks/116930325
https://www.pixiv.net/artworks/116877725
https://www.pixiv.net/artworks/116850925
$link) { $html = file_get_contents($link); $bookmarkStart = strpos($html, '"bookmarkCount":'); if ($bookmarkStart !== false) { $bookmarkEnd = strpos($html, ',', $bookmarkStart); if ($bookmarkEnd !== false) { $bookmarkCount = substr($html, $bookmarkStart + 16, $bookmarkEnd - $bookmarkStart - 16); } } $likeStart = strpos($html, '"likeCount":'); if ($likeStart !== false) { $likeEnd = strpos($html, ',', $likeStart); if ($likeEnd !== false) { $likeCount = substr($html, $likeStart + 12, $likeEnd - $likeStart - 12); } } $commentStart = strpos($html, '"commentCount":'); if ($commentStart !== false) { $commentEnd = strpos($html, ',', $commentStart); if ($commentEnd !== false) { $commentCount = substr($html, $commentStart + 15, $commentEnd - $commentStart - 15); } } echo ""; } } ?> _______________- MultiURL Pixiv_Downloader --------------------------


[ 'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0\r\n" . "Referer: https://accounts.pixiv.net\r\n", ], ]; $context = stream_context_create($options); $html = file_get_contents($url, false, $context); $pattern = '/image" href="(.*?)"/'; //find downscaled master img (always in jpg format) //$pattern = '/"original":"(.*?)"/'; //find original image (usually only works when logged in) preg_match($pattern, $html, $matches); $imageUrl = $matches[1]; echo '

Image Link: ' . $imageUrl . '

'; $imageData = file_get_contents($imageUrl, false, $context); if ($imageData !== false) { $filename = basename($imageUrl); $datePattern = '/\/(\d{4}\/\d{2}\/\d{2})\//'; preg_match($datePattern, $imageUrl, $dateMatches); $datePart = $dateMatches[1]; $datePart = str_replace('/', '_', $datePart); $newFilename = pathinfo($filename, PATHINFO_FILENAME) . '_' . $datePart . '.' . pathinfo($filename, PATHINFO_EXTENSION); file_put_contents($newFilename, $imageData); echo 'Image saved as: ' . $newFilename . '
'; } else { echo 'Failed to retrieve the image from: ' . $url . '
'; } } } ?> _________________________ Fetch and display Pixiv image (via request header) -------------------------- Image Retrieval
[ 'header' => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0\r\n" . "Referer: https://accounts.pixiv.net\r\n", ], ]; $context = stream_context_create($options); $html = file_get_contents($url, false, $context); $pattern = '/image" href="(.*?)"/'; //find downscaled master img (always in jpg format) //$pattern = '/"original":"(.*?)"/'; //find original image (usually only works when logged in) preg_match($pattern, $html, $matches); $imageUrl = $matches[1]; echo '

Image Link: ' . $imageUrl . '

'; $imageData = file_get_contents($imageUrl, false, $context); if ($imageData !== false) { $base64 = base64_encode($imageData); $imageSrc = 'data:image/jpeg;base64,' . $base64; echo 'Image'; } else { echo 'Failed to retrieve the image.'; } } ?> __________________________ Extract Youtube channelid and channel playlist --------------------------------- loadHTMLFile($youtubeUrl); // Create a new DOMXPath instance $xpath = new DOMXPath($dom); // Search for the itemprop="identifier" attribute $channelId = ""; $channelIdNodes = $xpath->query('//meta[@itemprop="identifier"]/@content'); if ($channelIdNodes->length > 0) { $channelId = $channelIdNodes[0]->nodeValue; } $channelId = substr_replace($channelId, "UU", 0, 2); $embedUrl = "https://www.youtube.com/embed/videoseries?list=" . $channelId; } echo "Channel ID: " . $channelId; ?> Extract Channel ID
_________________ Pinterest image extractit ----------------------- Demo <?php // Set the initial value of the Pinterest page URL $url = ""; // Check if the query string parameter "pinurl" exists if (isset($_GET['pinurl'])) { // Retrieve the value of the "pinurl" parameter $url = $_GET['pinurl']; } if (isset($_POST['url'])) { // Pinterest page URL $url = $_POST['url']; } if (isset($_POST['url']) || isset($_GET['pinurl'])) { // Fetch the HTML content of the Pinterest page $html = file_get_contents($url); // Regular expression pattern to match the image URL with the specified attributes $pattern = '/fetchpriority="auto" loading="auto" src="(.*?)" elementtiming="closeupImage"/'; // Execute the regular expression and extract the image URL preg_match($pattern, $html, $matches); if (isset($matches[1])) { $imageURL = $matches[1]; // Create an HTML link with target blank and the extracted image URL $linkTag = '<a href="' . $imageURL . '" target="_blank">View Image</a>'; // Create an HTML img tag with the extracted image URL and 50% width $imageTag = '<img src="' . $imageURL . '" width="50%" />'; // Output the link and the image tag echo "Image URL with specified attributes: " . $linkTag . "<br>"; echo $imageTag; // You can now use $imageURL to display or process the image } else { echo "No image found with the specified attributes."; } } ?> <!DOCTYPE html> <html> <head> <title>Image URL Extraction</title> </head> <body> <form method="POST" action=""> <label for="url">Pinterest Page URL:</label><br> <input type="text" id="url" name="url" placeholder="Enter Pinterest page URL" value="<?php echo $url; ?>"> <button type="submit">Extract Image URL</button> </form> </body> </html> __________ Exclude files from zip based on txt -------------------------------------------------- ======listbigfiles.php=== <?php function scanDirectory($dir) { $files = []; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)); foreach ($iterator as $file) { if (!$file->isFile()) { continue; } $filePath = $file->getPathname(); $fileSize = $file->getSize(); $extension = pathinfo($filePath, PATHINFO_EXTENSION); if ($extension === 'png' || $extension === 'jpg') { $files[] = [ 'path' => $filePath, 'size' => $fileSize, ]; } else { if ($fileSize > 848576) { // 1 megabyte = 1048576 bytes $files[] = [ 'path' => $filePath, 'size' => $fileSize, ]; } } } return $files; } function displayFileList($files) { echo '<p>Files larger than 1 megabyte:</p>'; foreach ($files as $key => $file) { echo '<label>'; echo '<input type="checkbox" name="files[]" value="' . $key . '"'; $extension = pathinfo($file['path'], PATHINFO_EXTENSION); $path = $file['path']; if ($extension !== 'mp4' && $extension !== 'js' && $extension !== 'png' && $extension !== 'jpg' && $extension !== 'zip' && $extension !== 'brkn' && $extension !== 'css' && $extension !== 'mp3' && strpos($path, '2023-09-24-YTClone') === false && strpos($file['path'], 'error_log') === false) { echo ' checked'; } echo '>'; echo $file['path'] . ' (' . formatFileSize($file['size']) . ')'; echo '</label><br>'; } echo '<input type="submit" name="write_paths" value="Write Unchecked Paths">'; } function formatFileSize($size) { $units = ['B', 'KB', 'MB', 'GB']; $unitIndex = 0; while ($size >= 1024 && $unitIndex < count($units) - 1) { $size /= 1024; $unitIndex++; } return round($size, 2) . ' ' . $units[$unitIndex]; } function writeUncheckedPaths($files) { $uncheckedPaths = []; if (isset($_POST['files'])) { $checkedFiles = $_POST['files']; foreach ($files as $key => $file) { if (!in_array($key, $checkedFiles)) { $uncheckedPaths[] = $file['path']; } } } $filePath = __DIR__ . '/unchecked_paths.txt'; $content = implode("\n", $uncheckedPaths); file_put_contents($filePath, $content); echo "Unchecked paths have been written to unchecked_paths.txt"; } $dir = __DIR__; $files = scanDirectory($dir); if (isset($_POST['write_paths'])) { writeUncheckedPaths($files); } echo '<form method="POST">'; displayFileList($files); echo '</form>'; ?> ======zip.php====== <?php $url = 'unchecked_paths.txt'; $fileContent = file_get_contents($url); if ($fileContent !== false) { $lines = explode("\n", $fileContent); $filenames = array(); echo '<ul>'; foreach ($lines as $line) { $parts = explode('/', $line); $finalPart = end($parts); $filenames[] = $finalPart; echo '<li>' . htmlspecialchars($finalPart) . '</li>'; } echo '</ul>'; // Output the filenames array echo '<pre>'; print_r($filenames); echo '</pre>'; // Create a zip archive excluding the files in the filenames array $zipFile = 'php.zip'; $zip = new ZipArchive(); if ($zip->open($zipFile, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( __DIR__, RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirectoryIterator::FOLLOW_SYMLINKS ), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD // Use custom iterator to include hidden files ); foreach ($iterator as $file) { if ($file->isFile() && !in_array($file->getFilename(), $filenames)) { $filePath = $file->getPathname(); $relativePath = substr($filePath, strlen(__DIR__) + 1); $zip->addFile($filePath, $relativePath); } } $zip->close(); echo 'Zip archive created successfully.'; } else { echo 'Failed to create the zip archive.'; } } else { echo 'Failed to read the file.'; } ?> _________________________________________________ Event over time writer & renderer -------------------------------------------- =======Plot-html=== <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <style> #description { margin-top: 10px; padding: 10px; background-color: #f2f2f2; } </style> </head> <body> <canvas id="eventChart"></canvas> <div id="description"></div> <script> fetch('events.txt') .then(response => response.text()) .then(data => { const events = parseEventText(data); createChart(events); }) .catch(error => { console.error('Error reading event.txt:', error); }); function parseEventText(text) { const lines = text.split('\n'); const events = []; for (let line of lines) { const regex = /^(\d{4}-\d{2}-\d{2}) \(([-+]+)\) (.+)$/; const matches = line.match(regex); if (matches) { const date = matches[1]; const rating = matches[2]; const description = matches[3]; events.push({ date, rating, description }); } } return events; } function createChart(events) { events.sort((a, b) => new Date(a.date) - new Date(b.date)); const dates = events.map(event => event.date); const ratings = events.map(event => convertRatingToValue(event.rating)); const ctx = document.getElementById('eventChart').getContext('2d'); const eventChart = new Chart(ctx, { type: 'line', data: { labels: dates, datasets: [{ label: 'Event Ratings', data: ratings, borderColor: 'blue', fill: false }] }, options: { scales: { x: { reverse: false // Invert the X-axis }, y: { ticks: { beginAtZero: true, callback: value => valueToRating(value) } } }, plugins: { tooltip: { enabled: true, callbacks: { title: (tooltipItems) => { const index = tooltipItems[0].dataIndex; return events[index].date; }, label: (tooltipItems) => { const index = tooltipItems.dataIndex; return events[index].description; } } } }, onHover: (event, chartElements) => { if (chartElements.length > 0) { const index = chartElements[0].index; const description = events[index].description; document.getElementById('description').textContent = description; } }, onLeave: () => { document.getElementById('description').textContent = ''; } } }); } function convertRatingToValue(rating) { const minusCount = (rating.match(/-/g) || []).length; const plusCount = (rating.match(/\+/g) || []).length; const value = plusCount - minusCount; return value * 10; // Assuming each plus or minus sign corresponds to a value of 10 } function valueToRating(value) { const ratingValue = value / 10; // Assuming each plus or minus sign corresponds to a value of 10 let ratingString = ''; if (ratingValue < 0) { ratingString += '-'.repeat(Math.abs(ratingValue)); } else if (ratingValue > 0) { ratingString += '+'.repeat(ratingValue); } else { ratingString = '0'; } return ratingString; } </script> ====== write event.php==== <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get the input values $textEntry = $_POST['text_entry']; $rating = $_POST['rating']; $year = $_POST['year']; $month = $_POST['month']; $day = $_POST['day']; $sortIn = isset($_POST['sort_in']) && $_POST['sort_in'] === 'on'; $date = sprintf("%04d-%02d-%02d", $year, $month, $day); $data = $date . ' (' . $rating . ') ' . $textEntry . "\n"; if ($sortIn) { $data = "\n" . $data; } $contents = file_get_contents('events.txt'); if ($sortIn) { $lines = explode("\n", $contents); $entries = []; foreach ($lines as $line) { if (!empty($line)) { $entry = [ 'date' => substr($line, 0, 10), 'content' => $line ]; $entries[] = $entry; } } $newEntry = [ 'date' => $date, 'content' => $data ]; $entries[] = $newEntry; // Sort the entries based on the date usort($entries, function ($a, $b) { $dateA = DateTime::createFromFormat('Y-m-d', $a['date']); $dateB = DateTime::createFromFormat('Y-m-d', $b['date']); return $dateA <=> $dateB; }); $contents = ''; foreach ($entries as $entry) { $contents .= $entry['content']; } } else { $contents = $data . $contents; } file_put_contents('events.txt', $contents); header('Location: ' . $_SERVER['PHP_SELF']); exit; } else { $today = getdate(); $defaultYear = $today['year']; $defaultMonth = $today['mon']; $defaultDay = $today['mday']; } ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="year">Year:</label> <input type="number" id="year" name="year" value="<?php echo $defaultYear; ?>" required><br><br> <label for="month">Month:</label> <input type="number" id="month" name="month" value="<?php echo $defaultMonth; ?>" required><br><br> <label for="day">Day:</label> <input type="number" id="day" name="day" value="<?php echo $defaultDay; ?>" required><br><br> <label for="text_entry">Text Entry:</label> <input type="text" id="text_entry" name="text_entry" required><br><br> <label for="rating">Rating:</label> <select id="rating" name="rating"> <option value="-----">-----</option> <option value="----">----</option> <option value="---">---</option> <option value="--">--</option> <option value="-">-</option> <option value="0">0</option> <option value="+">+</option> <option value="++">++</option> <option value="+++">+++</option> <option value="++++">++++</option> <option value="+++++">+++++</option> </select><br><br> <label for="sort_in">Sort In:</label> <input type="checkbox" id="sort_in" name="sort_in"><br><br> <input type="submit" value="Submit"> </form> _______________________ GameList Hype Writer ----------------------------------- <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { //$gameName = str_pad($_POST['gamename'], 45, '_'); $gameName = $_POST['gamename']; $url = $_POST['url']; $moreInfo = $_POST['moreinfo']; $releaseDate = $_POST['releasedate']; $rating = $_POST['rating']; $system = $_POST['system']; $underscoreCount = max(0, 45 - strlen($gameName)); $padded = str_repeat('_', $underscoreCount); $rating = str_replace(',', '', $rating); $rating = str_replace('.', '', $rating); $rating = max(1, min(10, $rating)); $ratingImages = ""; for ($i = 1; $i <= 10; $i++) { $class = ($i <= $rating) ? "filled" : "greyed"; $style = ($i > $rating) ? "filter: grayscale(100%);" : ""; $ratingImages .= "<img class='$class' style='$style' src='https://alcea-wisteria.de/z_files/emoji/ablobdj.gif' alt='Rating' width='20px'>"; } $gameLink = "<a href='$url'>$gameName</a>"; $gameInfo = " <tr> <td>$releaseDate</td> <td>$gameLink</td> <td>$padded</td> <td>$moreInfo</td> <td>$ratingImages</td> <td>$system</td> </tr> "; $existingContent = file_get_contents("game.html"); $newContent = " <table> <tr> </tr> $gameInfo <tr><td colspan='5' style='border-bottom: 1px solid black;'></td></tr> $existingContent </table> "; file_put_contents("game.html", $newContent); } ?> <!DOCTYPE html> <html> <head> </head> <body> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="gamename">Game Name:</label> <input type="text" id="gamename" name="gamename" required><br> <label for="url">URL:</label> <input type="text" id="url" name="url" required><br> <label for="moreinfo">More Info:</label> <input type="text" id="moreinfo" name="moreinfo" required><br> <label for="releasedate">Release Date:</label> <input type="date" id="releasedate" name="releasedate" value="<?php echo date('Y-m-d'); ?>" required><br> <label for="rating">Rating:</label> <input type="number" id="rating" name="rating" min="1" max="10" required><br> <label for="system">System:</label> <select id="system" name="system" required> <option value="NSwitch">NSwitch</option> <option value="PS4">PS4</option> <option value="PC">PC</option> </select><br> <input type="submit" value="Submit"> </form> </body> </html> _____________________________________ Json block deletion interface_ ------------------------------------- <?php $jsonFilePath = 'data.json'; if (!file_exists($jsonFilePath)) { die('JSON file not found.'); }______ // Read the JSON file and decode its contents $jsonData = file_get_contents($jsonFilePath); $data = json_decode($jsonData, true); if (isset($_POST['deleteEntryId'])) { $deleteEntryId = $_POST['deleteEntryId']; foreach ($data as $key => $entry) { if ($entry['id'] == $deleteEntryId) { unset($data[$key]); break; } } $jsonData = json_encode(array_values($data), JSON_PRETTY_PRINT); file_put_contents($jsonFilePath, $jsonData); } echo '<ul>'; foreach ($data as $entry) { echo '<li>'; foreach ($entry as $key => $value) { if (!is_numeric($key) && $key !== 'plaintext') { echo $key . ': ' . $value . '<br>'; } } echo '<form method="post" style="display: inline-block;">'; echo '<input type="hidden" name="deleteEntryId" value="' . $entry['id'] . '">'; echo '<input type="submit" value="Delete">'; echo '</form>'; echo '<span>'; print_r($entry); echo '</span>'; echo '</li>'; } echo '</ul>'; ?> _____________________________________ Wishlist resell json writer n renderer -------------------------------------- <details><summary>Add Entry</summary> eBay <form action="ebay.php" method="GET"> <input type="text" name="url" placeholder="Enter URL"> <input type="submit" value="Submit"> </form> <hr> Other <form action="write.php" method="GET"> <label for="url">URL:</label> <input type="text" id="url" name="url" required><br><br> <label for="title">Title:</label> <input type="text" id="title" name="title" required><br><br> <label for="price">Price:</label> <input type="text" id="price" name="price" required><br><br> <input type="submit" value="Submit"> </form></details> <style> table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 8px; border-bottom: 1px solid #ddd; cursor: pointer; } th { background-color: #f2f2f2; color: #333; } </style> </head> <body> <button onclick="refetchData()">Refetch</button> <table id="buylistTable"> <thead> <tr> <th onclick="sortBy('title')">Title</th> <th onclick="sortBy('price')">Price</th> <th onclick="sortBy('marketplace')">Marketplace</th> <th onclick="sortBy('date')">Date</th> </tr> </thead> <tbody> </tbody> </table> <script> let sortDirection = { title: 'asc', price: 'asc', marketplace: 'asc', date: 'asc' }; function sortBy(column) { const table = document.querySelector('#buylistTable'); const tbody = table.querySelector('tbody'); const rows = Array.from(tbody.querySelectorAll('tr')); const columnIndex = Array.from(table.querySelectorAll('th')).indexOf(event.target); const sortColumn = column; const sortDirectionValue = sortDirection[column] === 'asc' ? 1 : -1; rows.sort((rowA, rowB) => { const cellA = rowA.querySelector(`td:nth-child(${columnIndex + 1})`).textContent.trim(); const cellB = rowB.querySelector(`td:nth-child(${columnIndex + 1})`).textContent.trim(); if (cellA < cellB) { return -1 * sortDirectionValue; } else if (cellA > cellB) { return 1 * sortDirectionValue; } else { return 0; } }); while (tbody.firstChild) { tbody.removeChild(tbody.firstChild); } rows.forEach(row => { tbody.appendChild(row); }); sortDirection[column] = sortDirectionValue === 1 ? 'desc' : 'asc'; } function refetchData() { const tableBody = document.querySelector('#buylistTable tbody'); while (tableBody.firstChild) { tableBody.firstChild.remove(); } fetchData(); } function fetchData() { fetch('buylist.json') .then(response => response.json()) .then(data => { const tableBody = document.querySelector('#buylistTable tbody'); data.forEach(item => { const row = document.createElement('tr'); const titleCell = document.createElement('td'); const priceCell = document.createElement('td'); const marketplaceCell = document.createElement('td'); const dateCell = document.createElement('td'); const titleLink = document.createElement('a'); titleLink.href = item.url; titleLink.target = '_blank'; titleLink.textContent = item.title; titleCell.appendChild(titleLink); priceCell.textContent = item.price; marketplaceCell.textContent = item.marketplace; dateCell.textContent = item.date; row.appendChild(titleCell); row.appendChild(priceCell); row.appendChild(marketplaceCell); row.appendChild(dateCell); tableBody.appendChild(row); }); }) .catch(error => console.error(error)); } fetchData(); </script> </body> </html> ========================ebay.php====================== <?php // Get the URL from the query string parameter $url = isset($_GET['url']) ? $_GET['url'] : ''; // Check if the URL is provided if (empty($url)) { echo 'URL parameter is missing.'; exit; } // Initialize cURL $curl = curl_init(); // Set cURL options curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36'); // Execute the cURL request $response = curl_exec($curl); // Check if the request was successful if ($response === false) { echo 'Error: ' . curl_error($curl); exit; } // Close the cURL session curl_close($curl); // Extract the page title $pageTitle = ''; if (preg_match('/<title>(.*?)<\/title>/', $response, $matches)) { $pageTitle = $matches[1]; } // Search for the specific string in the HTML content to extract the currency and price $searchString = ',"priceCurrency":"'; $pos = strpos($response, $searchString); // Extract the currency and price $currency = ''; $price = ''; if ($pos !== false) { $currencyStartPos = $pos + strlen($searchString); $currencyEndPos = strpos($response, '"', $currencyStartPos); $currency = substr($response, $currencyStartPos, $currencyEndPos - $currencyStartPos); $priceSearchString = ',"price":"'; $pricePos = strpos($response, $priceSearchString, $currencyEndPos); if ($pricePos !== false) { $priceStartPos = $pricePos + strlen($priceSearchString); $priceEndPos = strpos($response, '"', $priceStartPos); $price = substr($response, $priceStartPos, $priceEndPos - $priceStartPos); } } // Construct the URL for write.php and open it as a URL $writeUrl = 'write.php?ebayurl=' . urlencode($url) . '&title=' . urlencode($pageTitle) . '&price=' . urlencode($price . ' ' . $currency); // Open the URL header('Location: ' . $writeUrl); exit; ?> ===========write.php ============ <?php // Get the URL, price, title, and query strings from the query parameters $url = isset($_GET['url']) ? $_GET['url'] : ''; $price = $_GET['price']; $title = $_GET['title']; // Check if ebayurl is present if (isset($_GET['ebayurl']) && !isset($_GET['url'])) { $url = $_GET['ebayurl']; $marketplace = 'ebay'; } else { $marketplace = ''; } // Get the current date $date = date('Y-m-d'); // Load the existing buylist JSON file $buylistFile = 'buylist.json'; $currentBuylist = []; if (file_exists($buylistFile)) { $currentBuylist = json_decode(file_get_contents($buylistFile), true); } // Check if the entry with the same date and title already exists $isDuplicate = false; foreach ($currentBuylist as $item) { if ($item['date'] === $date && $item['title'] === $title) { $isDuplicate = true; break; } } // Add the new item to the buylist if it's not a duplicate if (!$isDuplicate) { // Create a new item for the buylist $newItem = [ 'url' => $url, 'price' => $price, 'title' => $title, 'marketplace' => $marketplace, 'date' => $date ]; // Prepend the new item to the buylist array_unshift($currentBuylist, $newItem); // Save the updated buylist back to the JSON file with pretty formatting file_put_contents($buylistFile, json_encode($currentBuylist, JSON_PRETTY_PRINT)); // Output a success message echo 'Item added to the <a target=_blank href=buylist.json>buylist</a>!'; } else { // Output a message indicating that the item is a duplicate echo 'Item is a duplicate and not added to the <a target=_blank href=buylist.json>buylist</a>.'; } ?> _____________________________________________ CSS & JS Reduction (minification etc) tools -------------------------------------------- ==CSS reduce.php== <a href="https://www.giftofspeed.com/css-compressor" target="_blank">Compress even more</a> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get the uploaded CSS file or the CSS code from textarea if (!empty($_FILES['css']['tmp_name'])) { $css = file_get_contents($_FILES['css']['tmp_name']); } elseif (!empty($_POST['css_code'])) { $css = $_POST['css_code']; } else { echo 'Please upload a CSS file or paste CSS code in the textarea.'; exit(); } // Replace "93.33333333%" with rounded whole numbers like "93" $css = preg_replace_callback('/(\d+\.\d+)%/', function ($matches) { return round($matches[1]); }, $css); // Simplify all selectors $css = preg_replace_callback('/[^\{\}]+\{/', function ($matches) { $selector = $matches[0]; $selector = preg_replace('/\s+/', ' ', $selector); $selector = preg_replace('/([>+~])\s+/', '$1', $selector); return $selector; }, $css); // Remove old and redundant vendor prefixes $css = preg_replace('/-(moz|ms|webkit|o)-/', '', $css); // Remove unused styles $unusedStyles = array( '.unused-class', '#unused-id', 'unused-selector' ); $css = str_replace($unusedStyles, '', $css); // Combine and consolidate selectors $css = preg_replace('/(selector1|selector2|selector3)\s*\{\s*property1: value;\s*property2: value;\s*\}/', '.combined-selector{property1: value;property2: value;}', $css); // Use shorthand properties $css = preg_replace('/margin-top: 10px;margin-bottom: 10px;margin-left: 10px;margin-right: 10px;/', 'margin: 10px;', $css); // Remove duplicate declarations $css = preg_replace('/property: value;\s*property: value;/', 'property: value;', $css); // Minimize colors $css = preg_replace_callback('/#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/', function ($matches) { $color = $matches[1]; if (strlen($color) === 6) { $color = substr($color, 0, 3); } return '#' . strtolower($color); }, $css); // Remove font-related styles if checkbox is checked if (isset($_POST['remove_font']) && $_POST['remove_font'] === 'on') { $css = preg_replace('/font-family:.*?;/i', '', $css); $css = preg_replace('/@font-face\s*{.*?}/si', '', $css); } // Minify the CSS by removing unnecessary whitespace and comments $css = preg_replace('/\/\*.*\*\//sU', '', $css); $css = preg_replace('/\s*([{}|:;,])\s*/', '$1', $css); if (isset($_POST['output_to_textbox']) && $_POST['output_to_textbox'] === 'on') { echo '<textarea rows="10" cols="50" readonly>' . htmlspecialchars($css) . '</textarea>'; echo '<br>'; echo '<button onclick="copyToClipboard()">Copy</button>'; echo '<script>function copyToClipboard() { var copyText = document.querySelector("textarea"); copyText.select(); copyText.setSelectionRange(0, 99999); document.execCommand("copy"); alert("Copied to clipboard!"); }</script>'; } else { // Save the modified CSS to the new file $currentTime = date('YmdHis'); $newFilename = $currentTime . (isset($_POST['remove_font']) && $_POST['remove_font'] === 'on' ? '_fontrm' : '') . '_new.css'; file_put_contents($newFilename, $css); echo 'CSS file has been modified. Download the modified file: <a href="' . $newFilename . '">Download</a>'; } } ?> <title>CSS Modifier</title> </head> <body> <form method="post" enctype="multipart/form-data"> <label for="css">CSS File:</label><br> <input type="file" id="css" name="css"><br><br> <labelfor="css_code">CSS Code:</label><br> <textarea id="css_code" name="css_code" rows="10" cols="50"></textarea><br><br> <input type="checkbox" id="remove_font" name="remove_font"> <label for="remove_font">Remove font-related styles</label><br><br> <input type="checkbox" id="output_to_textbox" name="output_to_textbox"> <label for="output_to_textbox">Output modified CSS to textbox</label><br><br> <input type="submit" value="Modify CSS"> </form> </body> </html> === JS minify == <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get the JavaScript code from the uploaded file or the textarea if (!empty($_FILES['js']['tmp_name'])) { $js = file_get_contents($_FILES['js']['tmp_name']); } elseif (!empty($_POST['js_code'])) { $js = $_POST['js_code']; } else { echo 'Please upload a JavaScript file or enter JavaScript code in the textarea.'; exit(); } // Minify the JavaScript code $minifiedJs = minifyJavaScript($js); // Output the minified JavaScript to a textbox if the checkbox is checked if (isset($_POST['output_to_textbox']) && $_POST['output_to_textbox'] === 'on') { echo '<textarea id="minified_js" rows="10" cols="50" readonly>' . htmlspecialchars($minifiedJs) . '</textarea><br>'; echo '<button onclick="copyToClipboard()">Copy</button>'; echo '<script>function copyToClipboard() { var copyText = document.getElementById("minified_js"); copyText.select(); copyText.setSelectionRange(0, 99999); document.execCommand("copy"); alert("Copied to clipboard!"); }</script>'; } else { // Save the minified JavaScript to a file with a timestamp in the filename $filename = date('YmdHis') . '_minified.js'; file_put_contents($filename, $minifiedJs); // Output the link to download the minified JavaScript file echo 'Minified JavaScript file has been created. Download the file: <a href="' . $filename . '">Download</a><br>'; } } function minifyJavaScript($js) { // Minify the JavaScript code (implement your own minification logic here) // For example, using a library like JSMin or UglifyJS // Dummy implementation: Remove all comments and unnecessary whitespace $js = preg_replace('/\/\/.*$/m', '', $js); // Remove single-line comments $js = preg_replace('/\/\*.*?\*\//s', '', $js); // Remove multi-line comments $js = preg_replace('/\s+/', ' ', $js); // Remove unnecessary whitespace return $js; } ?> <title>JavaScript Minifier</title> </head> <body> <form method="post" enctype="multipart/form-data"> <label for="js">JavaScript File:</label><br> <input type="file" id="js" name="js"><br><br> <label for="js_code">JavaScript Code:</label><br> <textarea id="js_code" name="js_code" rows="10" cols="50"></textarea><br><br> <input type="checkbox" id="output_to_textbox" name="output_to_textbox"> <label for="output_to_textbox">Output minified JavaScript to textbox</label><br><br> <input type="submit" value="Minify JavaScript"> </form> _______________________________________________________________ Fetch Dekudeals releases from url (+ price &size) ------------------------------------------ <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $targetURL = $_POST['url']; // Get the URL from the submitted form $html = file_get_contents($targetURL); $dom = new DOMDocument(); $dom->loadHTML($html); $linkElements = $dom->getElementsByTagName('a'); $data = []; foreach ($linkElements as $index => $linkElement) { if ($linkElement->getAttribute('class') === 'main-link') { $href = $linkElement->getAttribute('href'); $absoluteURL = makeAbsoluteURL($targetURL, $href); $text = $linkElement->nodeValue; $linkHTML = '<a href="' . $absoluteURL . '" target="_blank">' . $text . '</a>'; $detailsHTML = ''; $detailsElement = $linkElement->nextSibling; while ($detailsElement && $detailsElement->nodeName !== 'ul' && $detailsElement !== $linkElement) { $detailsHTML .= $dom->saveHTML($detailsElement); $detailsElement = $detailsElement->nextSibling; } $linkHTMLContent = file_get_contents($absoluteURL); $linkDOM = new DOMDocument(); $linkDOM->loadHTML($linkHTMLContent); $downloadSize = ''; $liElements = $linkDOM->getElementsByTagName('li'); foreach ($liElements as $liElement) { if ($liElement->getAttribute('class') === 'list-group-item') { $strongElement = $liElement->getElementsByTagName('strong')->item(0); if ($strongElement && $strongElement->nodeValue === 'Download size:') { $downloadSize = trim($liElement->textContent); break; } } } $data[] = [ 'Link' => $linkHTML, 'Details' => $detailsHTML, 'DownloadSize' => $downloadSize ]; } } foreach ($data as $item) { echo $item['Link'] . '<br>'; echo $item['Details'] . '<br>'; echo $item['DownloadSize'] . '<br><br>'; } } function makeAbsoluteURL($baseURL, $relativeURL) { $parsedBaseURL = parse_url($baseURL); $scheme = $parsedBaseURL['scheme']; $host = $parsedBaseURL['host']; $basePath = isset($parsedBaseURL['path']) ? $parsedBaseURL['path'] : ''; if (substr($relativeURL, 0, 2) === '//') { return $scheme . ':' . $relativeURL; } elseif (substr($relativeURL, 0, 1) === '/') { return $scheme . '://' . $host . $relativeURL; } else { return $scheme . '://' . $host . $basePath . '/' . $relativeURL; } } ?> <a href="#" data-url="https://www.dekudeals.com/highest-rated">Highly Rated</a> <a href="#" data-url="https://www.dekudeals.com/recently-released">Recently Released</a> <a href="#" data-url="https://www.dekudeals.com/recent-drops">Recent Price Drops</a> <a href="#" data-url="https://www.dekudeals.com/bang-for-your-buck">Bang for your Buck</a> <a href="#" data-url="https://www.dekudeals.com/upcoming-releases">Upcoming Releases</a> <form method="POST"> <input type="text" name="url" placeholder="Enter URL" required> <button type="submit">Submit</button> </form> <?php if (isset($data)) { foreach ($data as $item) { echo $item['Link'] . '<br>'; echo $item['Details'] . '<br>'; echo $item['DownloadSize'] . '<br><br>';}} ?> <script> //Fill textbox var inputElement = document.querySelector('input[name="url"]'); var linkElements = document.querySelectorAll('a[data-url]'); linkElements.forEach(function(linkElement) { linkElement.addEventListener('click', function(event) { event.preventDefault(); // Prevent the default link behavior var clickedUrl = linkElement.getAttribute('data-url'); inputElement.value = clickedUrl; });}); </script> _________________________________________ Save mastodon instance emoji to (instance) folder: --------------------------------------------- <?php function downloadCustomEmojis($instanceUrl) { $url = $instanceUrl . '/api/v1/custom_emojis'; $response = file_get_contents($url); $emojis = json_decode($response, true); // Create a folder for the instance $folderName = parse_url($instanceUrl, PHP_URL_HOST); $folderPath = __DIR__ . '/' . $folderName; if (!file_exists($folderPath)) { mkdir($folderPath, 0777, true); } foreach ($emojis as $emoji) { $emojiUrl = $emoji['url']; $emojiName = $emoji['shortcode']; $extension = pathinfo($emojiUrl, PATHINFO_EXTENSION); $filename = $emojiName . '.' . $extension; $filepath = $folderPath . '/' . $filename; // Download the emoji file file_put_contents($filepath, file_get_contents($emojiUrl)); echo "Downloaded emoji: $filename\n"; } echo "All emojis downloaded successfully!"; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $instanceUrl = $_POST['instance_url']; downloadCustomEmojis($instanceUrl); } ?> <body> <h1>Emoji Downloader</h1> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="instance_url">Instance URL:</label> <input type="text" name="instance_url" id="instance_url" required> <button type="submit">Download Emojis</button> </form> </body> </html> ____________________________________ Load php only on button press: --------------------------- <?php if (isset($_POST['button_pressed'])) { //function } ?> <form method="post"> <input type="submit" name="button_pressed" value="Press Me"> </form> ____________________________ Weight tracker: -------------------------- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> </head> <body> <div> <label for="userInput">User:</label> <input type="text" id="userInput" value="alcea"> <button id="submitButton">Submit</button> </div> <div> <label for="heightInput">Height (cm):</label> <input type="number" id="heightInput" value="183"> </div> <div> <label for="birthdateInput">Birthdate:</label> <input type="date" id="birthdateInput" value="1991-01-18"> </div> <div> <label for="genderInput">Biological Gender:</label> <select id="genderInput"> <option value="female" selected>Female</option> <option value="male">Male</option> </select> </div> <canvas id="weightChart"></canvas> <canvas id="bmiChart"></canvas> <script> // Reference to the submit button and user input fields var submitButton = document.getElementById('submitButton'); var userInput = document.getElementById('userInput'); var heightInput = document.getElementById('heightInput'); var birthdateInput = document.getElementById('birthdateInput'); var genderInput = document.getElementById('genderInput'); // Event listener for the submit button submitButton.addEventListener('click', function() { var user = userInput.value; var url = `https://alcea-wisteria.de/PHP//0demo/00-PHP-Test/${user}_weight.json`; // Fetch the JSON data fetch(url) .then(response => response.json()) .then(data => { // Extract date, weight, dressed, and time from the JSON data var dates = []; var weights = []; var dressed = []; var time = []; for (var i = 0; i < data.length; i++) { dates.push(data[i].date); weights.push(data[i].weight); dressed.push(data[i].dressed); time.push(data[i].time); } // Calculate BMI for each data point var height = Number(heightInput.value); var birthdate = new Date(birthdateInput.value); var gender = genderInput.value; var bmis = []; for (var i = 0; i < weights.length; i++) { var bmi = calculateBMI(weights[i], height); bmis.push(bmi); } // Create the weight chart using Chart.js var weightCtx = document.getElementById('weightChart').getContext('2d'); var weightChart = new Chart(weightCtx, { type: 'line', data: { labels: dates, datasets: [{ label: 'Weight', data: weights, borderColor: 'blue', fill: false }] }, options: { responsive: true, scales: { x: { display: true, title: { display: true, text: 'Date' }, reverse: true // Add this line to reverse the x-axis }, y: { display: true, title: { display: true, text: 'Weight' } } }, plugins: { tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || ''; if (label) { label += ': '; } label += context.parsed.y + ' kg'; var dataIndex = context.dataIndex; if (dressed[dataIndex] && time[dataIndex]) { label += ', Dressed: ' + dressed[dataIndex] + ', Time: ' + time[dataIndex]; } // Display BMI in the tooltip label += ', BMI: ' + bmis[dataIndex]; return label; } } } } } }); // Create the BMI chart using Chart.js var bmiCtx = document.getElementById('bmiChart').getContext('2d'); var bmiChart = new Chart(bmiCtx, { type: 'line', data: { labels: dates, datasets: [{ label: 'BMI', data: bmis, borderColor: 'red', fill: false }] }, options: { responsive: true, scales: { x: { display: true, title: { display: true, text: 'Date' }, reverse: true // Add this line to reverse the x-axis }, y: { display: true, title: { display: true, text: 'BMI' }, ticks: { min: 0, max: 30 } } }, plugins: { tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || ''; if (label) { label += ': '; } label += context.parsed.y + ' BMI'; // Determine the BMI range var bmi = context.parsed.y; var range = getBmiRange(bmi); label += ' (' + range + ')'; return label; } } } } } }); // Function to calculate BMI function calculateBMI(weight, height) { var heightInMeters = height / 100; return weight / (heightInMeters * heightInMeters); } // Function to determine the BMI range function getBmiRange(bmi) { if (bmi < 18.5) { return 'Underweight'; } else if (bmi >= 18.5 && bmi < 25) { return 'Normal weight'; } else if (bmi >= 25 && bmi < 30) { return 'Overweight'; } else { return 'Obese'; } } }) .catch(error => { console.error('Error:', error); }); }); </script> </body> <br><br> <plaintext> =======writeweight.php===== <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get user input $user = isset($_POST['user']) ? $_POST['user'] : ''; $weight = isset($_POST['weight']) ? $_POST['weight'] : ''; $dressed = isset($_POST['dressed']) ? $_POST['dressed'] : ''; $date = isset($_POST['date']) ? $_POST['date'] : ''; $time = isset($_POST['time']) ? $_POST['time'] : ''; // Remove ":" from the time value $time = str_replace(':', '', $time); // Remove decimal places from the weight value $weight = intval($weight); // Create an associative array with the user data $userData = array( 'user' => $user, 'weight' => $weight, 'dressed' => $dressed, 'date' => $date, 'time' => $time ); // Read the existing JSON data $filename = $user . '_weight.json'; $existingData = file_get_contents($filename); // Decode the JSON data into an associative array $existingArray = json_decode($existingData, true); // Check if the existing data is an array if (!is_array($existingArray)) { // Create a new array with the new submission $existingArray = array($userData); } else { // Prepend the new submission to the existing array array_unshift($existingArray, $userData); } // Convert the array back to JSON $jsonData = json_encode($existingArray); // Save the JSON data to the file file_put_contents($filename, $jsonData); echo 'Data saved successfully!'; } ?> <!DOCTYPE html> <html> <head> <title>User Weight Form</title> </head> <body> <form method="POST" action=""> <label for="user">User:</label> <input type="text" name="user" id="user" value="aoi" required><br><br> <label for="weight">Weight (kg):</label> <input type="text" name="weight" id="weight" required><br><br> <label for="dressed">Dressed:</label> <select name="dressed" id="dressed" required> <option value="dressed">Dressed</option> <option value="notdressed">Not Dressed</option> </select><br><br> <label for="date">Date:</label> <input type="text" name="date" id="date" value="<?php echo date('Y-m-d'); ?>" required><br><br> <label for="time">Time:</label> <input type="text" name="time" id="time" value="<?php echo date('H:i'); ?>" required><br><br> <input type="submit" value="Submit"> </form> </body> </html> _________________________ Fake Social Media Feed Writer ---------------------------------- ====post.php======= <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve the value from the textbox $value = $_POST["textbox"]; // Retrieve the user from the URL query string $user = $_GET["user"]; // Get the current date in Yyyymmdd format $date = date("Ymd"); // Create an array with the new value and date $newData = array($date => array("value" => $value)); // Extract hashtags from the post text $hashtags = array(); preg_match_all('/#(\w+)/', $value, $matches); if (!empty($matches[1])) { $hashtags = $matches[1]; } // Add the hashtags to the new data array if (!empty($hashtags)) { $newData[$date]["hashtags"] = implode(", ", $hashtags); } // Read the existing JSON data from the file $filename = "data_" . $user . ".json"; if (file_exists($filename)) { $existingData = json_decode(file_get_contents($filename), true); } else { $existingData = array(); } // Prepend the new data to the existing data array_unshift($existingData, $newData); // Save the updated data to the file file_put_contents($filename, json_encode($existingData, JSON_PRETTY_PRINT)); } ?> <!DOCTYPE html> <html> <head> <title>Save to JSON</title> </head> <body> <form method="post" action="<?php echo $_SERVER["PHP_SELF"] . "?user=" . $_GET["user"]; ?>"> <label for="textbox">Enter Value:</label> <br> <textarea id="textbox" name="textbox" rows="4" cols="50"></textarea> <br> <input type="submit" value="Save"> </form> </body> </html> <?php $user = $_GET['user']; $uniqueId = uniqid(); $iframeSrc = "data_{$user}.json?v={$uniqueId}"; echo '<iframe src="' . $iframeSrc . '" style="border:0px #ffffff none;" name="statusit" scrolling="no" frameborder="0" marginheight="0px" marginwidth="0px" height="250px" width="800" allowfullscreen></iframe>'; ?> =====render.html======== <hr> <div id="container"></div> <script> const urlParams = new URLSearchParams(window.location.search); const limit = urlParams.get("limit") || "15"; const baseurl = "https://alcea-wisteria.de/z_files/emoji"; function getQueryParam(param) { const urlParams = new URLSearchParams(window.location.search); return urlParams.get(param)} const user = getQueryParam('user'); if (user) { //const jsonFile = `/other/extra/scripts/fakesocialmedia/data_${user}.json`; const jsonFile = `/other/extra/scripts/fakesocialmedia/data_${user}.json?t=${Date.now()}`; fetch(jsonFile) .then(response => response.json()) .then(jsonData => { const container = document.getElementById('container'); jsonData.slice(0, limit).forEach(obj => { const date = Object.keys(obj)[0]; const innerObj = obj[date]; const value = innerObj.value; const hashtags = innerObj.hashtags; const postElement = document.createElement('div'); postElement.classList.add('post'); const dateElement = document.createElement('p'); dateElement.textContent = `Date: ${date}`; const valueElement = document.createElement('p'); valueElement.innerHTML = `<img src=https://alcea-wisteria.de/z_files/emoji/${user}.png width=100px><br>@<a target="_blank" href="/other/extra/scripts/fakesocialmedia/render_limited.html?user=${user}" style="color:pink">${user}</a>: ${replaceEmojis(value).replace(/(https?:\/\/[^\s]+)/g, (match) => { if (match.includes('pixiv.net')) { const pixivRegex = /https?:\/\/(?:www\.)?pixiv\.net\/(?:en\/)?artworks\/(\d+)/; const pixivMatch = match.match(pixivRegex); if (pixivMatch) { const artworkId = pixivMatch[1]; return `<div><img src="https://embed.pixiv.net/decorate.php?illust_id=${artworkId}&mode=sns-automator" width="50%"></div><br><a href="${match}" target="_blank">${match}</a>`; }} if (match.endsWith('.gif') || match.endsWith('.png') || match.endsWith('.webp') ||match.endsWith('.jpg') || match.endsWith('.jpeg')) { let imageWidth = "50%"; // Default width if (match.includes("emoji")) { imageWidth = "45px"; // Resize width to 45x45 cause these are emoji from the function to replace shorthandtext } const imageElement = `<img src="${match}" width="${imageWidth}" alt="${match}">`; if (match.includes(`${baseurl}`)) { return imageElement; } else { return `${imageElement}<br><a href="${match}" target="_blank">${match}</a>`;}} return `<a href="${match}" target="_blank">${match}</a>`; }).replace(/\n/g, '<br>')}`; const hashtagsElement = document.createElement('p'); hashtagsElement.textContent = `Hashtags: ${hashtags}`; postElement.appendChild(dateElement); postElement.appendChild(valueElement); postElement.appendChild(hashtagsElement); // Comment href const buttonElement = document.createElement('button'); buttonElement.classList.add('btn'); const buttonText = value.slice(0, 25) || 'btn'; // Use 'btn' if value is empty or less than 25 characters buttonElement.textContent = 'Comment'; // buttonElement.href = `/other/extra/scripts/fakesocialmedia/comment.php?text=${encodeURIComponent(buttonText)}`; // Commented out the href buttonElement.addEventListener('click', () => { // Add click event handler to button window.open(`/other/extra/scripts/fakesocialmedia/comment.php?text=${encodeURIComponent(buttonText)}`, '_blank'); }); postElement.appendChild(buttonElement); // Comment href2 const buttonElement2 = document.createElement('a'); buttonElement2.classList.add('btn2'); const buttonText2 = value.slice(0, 25) || 'btn'; // Use 'btn' if value is empty or less than 25 characters buttonElement2.textContent = '(load comments)'; buttonElement2.href = `/other/extra/scripts/fakesocialmedia/commentload.html?text=${encodeURIComponent(buttonText2)}`; buttonElement2.target = "_blank"; // Open the link in a new tab postElement.appendChild(buttonElement2); if (value.includes('youtube.com') && !value.includes('youtube.com/shorts')) { const videoEmbed = document.createElement('iframe'); videoEmbed.src = `https://super8.absturztau.be/embed/${getVideoId(value)}`;videoEmbed.width = '560';videoEmbed.height = '315';videoEmbed.frameborder = '0';videoEmbed.allowfullscreen = 'true';videoEmbed.setAttribute('allowfullscreen', '');postElement.appendChild(videoEmbed);} container.appendChild(postElement); const separatorElement = document.createElement('hr'); container.appendChild(separatorElement); }); }) } else { const element = document.createElement('div'); element.textContent = 'No user specified (?user=user)'; document.body.appendChild(element); } function getVideoId(url) { const videoIdMatch = url.match(/(?:\/embed\/|v=|v\/|vi\/|youtu\.be\/|\/v\/|\/e\/|\/u\/\w\/|\/embed\/|\/v=|\/e=|\/u\/\w\/|\/vi\/)([^#\&\?]*).*/); return videoIdMatch[1];} function replaceEmojis(text) { return text.replace(/:(\w+):/g, (match, emoji) => { return `${baseurl}/${emoji}.gif`; });} </script> ====emojikb.php==== <?php $url = "https://alcea-wisteria.de/z_files/emoji/"; $html = file_get_contents($url); preg_match_all('/<a href=[\'"](.*?\.gif)[\'"]/i', $html, $matches); $gifUrls = $matches[1]; $gridSize = 5; // Number of columns in the grid $count = 0; echo "<table>"; echo "<tr>"; foreach ($gifUrls as $gifUrl) { $filename = basename($gifUrl); echo '<td><a href="javascript:void(0);" onclick="insertEmoji(\'' . $filename . '\');"><img src="https://alcea-wisteria.de/z_files/emoji/' . $filename . '" width=30></a></td>'; $count++; if ($count % $gridSize == 0) { echo "</tr><tr>"; } } echo "</tr>"; echo "</table>"; ?> <script> function insertEmoji(emoji) { var textarea = document.getElementById('textarea'); textarea.value += ':' + emoji.split('.')[0] + ':'; } </script> (See: https://alcea-wisteria.de/PHP//0demo/2024-02-18-Fake-SocialMedia/emoji.php https://alcea-wisteria.de/PHP//0demo/2024-02-18-Fake-SocialMedia/post+emoji.php) ~~~Load only 15 results mod ~~ const urlParams = new URLSearchParams(window.location.search); const limit = urlParams.get("limit") || "15"; const baseurl = "https://alcea-wisteria.de/z_files/emoji"; function getQueryParam(param) { const urlParams = new URLSearchParams(window.location.search); return urlParams.get(param) } const user = getQueryParam('user'); if (user) { const jsonFile = `data_${user}.json`; fetch(jsonFile) .then(response => response.json()) .then(jsonData => { const container = document.getElementById('container'); jsonData.slice(0, limit).forEach(obj => { // Limiting to 15 entries const date = Object.keys(obj)[0]; const innerObj = obj[date]; const value = innerObj.value; const hashtags = innerObj.hashtags; const postElement = document.createElement('div'); postElement.classList.add('post'); (Src: https://codeberg.org/alceawisteria/Fake-Social-MediaWriter ) ===comment.php== <?php if (file_exists('comments.json')) { $existingData = json_decode(file_get_contents('comments.json'), true); } else { $existingData = array(); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $text = $_GET['text']; $value = $_POST['value']; array_unshift($existingData, array( 'text' => $text, 'value' => $value )); $jsonData = json_encode($existingData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); file_put_contents('comments.json', $jsonData); } ?> <h2>Add a Comment</h2> <form method="post"> <label for="text">Target:</label> <input type="text" id="text" name="text" value="<?php echo $_GET['text']; ?>"> <br> <label for="value">Value:</label> <textarea id="value" name="value" cols="25" rows="15"></textarea> <br> <button type="submit">Submit</button> </form> <!---<script> document.getElementById('textDisplay').textContent = '<?php echo $_GET['text']; ?>'; </script>--> ====commentload.html==== <h1>Source Post: <span id="sourcepost"></span></h1> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; } .container { max-width: 800px; margin: 0 auto; padding: 20px; } .post { background-color: white; border-radius: 5px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); padding: 20px; margin-bottom: 20px; } .date { color: #888; font-size: 14px; margin-bottom: 10px; } .content { font-size: 16px; margin-bottom: 10px; } .hashtags { font-size: 14px; color: #555; } .tag { margin-right: 5px; } </style> </head> <body> <div class="container"> <h1>Fake Social Media</h1> <div id="results"></div> </div> <script> document.addEventListener('DOMContentLoaded', () => { fetch('/other/extra/scripts/fakesocialmedia/data_alcea.json') .then(response => response.json()) .then(data => { const urlParams = new URLSearchParams(window.location.search); const queryText = urlParams.get('text'); const matches = data.slice(0, 15).filter(entry => { const date = Object.keys(entry)[0]; return entry[date].value.includes(queryText); }); const resultsContainer = document.getElementById('results'); if (resultsContainer) { matches.forEach(match => { const date = Object.keys(match)[0]; const postContent = match[date].value; const hashtags = match[date].hashtags.split(', '); const postElement = document.createElement('div'); postElement.classList.add('post'); const dateElement = document.createElement('p'); dateElement.classList.add('date'); dateElement.textContent = date; const contentElement = document.createElement('p'); contentElement.classList.add('content'); contentElement.textContent = postContent; const hashtagsElement = document.createElement('div'); hashtagsElement.classList.add('hashtags'); hashtags.forEach(tag => { const tagElement = document.createElement('span'); tagElement.classList.add('tag'); tagElement.textContent = `#${tag}`; hashtagsElement.appendChild(tagElement); }); postElement.appendChild(dateElement); postElement.appendChild(contentElement); postElement.appendChild(hashtagsElement); resultsContainer.appendChild(postElement); }); } else { console.error('Error: Results container not found.'); } }) .catch(error => { console.error('Error fetching data:', error); }); }); </script> <h2>Comments</h2> <div id="comments"></div> <script> function fetchAndDisplayComments() { const urlParams = new URLSearchParams(window.location.search); const text = urlParams.get('text'); const sourcepost = urlParams.get('sourcepost'); const jsonUrl = '/other/extra/scripts/fakesocialmedia/comments.json?v=' + Date.now(); fetch(jsonUrl) .then(response => response.json()) .then(data => { const matchingComments = data.filter(comment => comment.text.includes(text)); const sourcepostElement = document.getElementById('sourcepost'); const commentsDiv = document.getElementById('comments'); matchingComments.forEach(comment => { const commentElement = document.createElement('div'); commentElement.textContent = comment.value; commentsDiv.appendChild(commentElement); }); }) .catch(error => { console.error('Error fetching comments:', error); }); } window.onload = fetchAndDisplayComments; </script> </body> </html> ______________________ Fetch popular mastodon posts --------------------------------- <style> .container { display: flex; } .post-box { border: 1px solid #ccc; padding: 10px; margin-right: 10px; display: flex; align-items: center; width: 500px; height: 250px; } .post-avatar { width: 80px; height: 80px; margin-right: 10px; border-radius: 50%; object-fit: cover; } .post-content { font-size: 14px; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; max-height: 200px; max-width: 100%; white-space: normal; } .post-link { font-size: 12px; color: blue; } </style> <?php $instances = ['kopimi.space', 'pb.todon.de', 'urusai.social', 'mastodon.social']; $totalPostsPerInstance = 10; echo '<div class="container">'; foreach ($instances as $instance) { $apiUrl = 'https://' . $instance . '/api/v1/timelines/public'; $params = [ 'local' => true, 'only_media' => false, 'limit' => $totalPostsPerInstance, 'max_id' => null ]; $sortedPosts = []; while (count($sortedPosts) < $totalPostsPerInstance) { $queryString = http_build_query($params); $requestUrl = $apiUrl . '?' . $queryString; $response = file_get_contents($requestUrl); $posts = json_decode($response); if ($posts) { foreach ($posts as $post) { $content = $post->content; $favouritesCount = $post->favourites_count; $boostsCount = $post->reblogs_count; $url = $post->url; if (!$post->account->bot) { if ($favouritesCount >= 2 || $boostsCount >= 2) { $replyCount = $post->replies_count; $sortedPosts[] = [ 'content' => $content, 'favouritesCount' => $favouritesCount, 'boostsCount' => $boostsCount, 'replyCount' => $replyCount, 'url' => $url, 'avatar' => $post->account->avatar_static ]; } } if (count($sortedPosts) >= $totalPostsPerInstance) { break 2; } } } else { echo 'Error retrieving posts from ' . $instance . '.'; break; } $lastPost = end($posts); $params['max_id'] = $lastPost->id; } usort($sortedPosts, function ($a, $b) { $aCount = max($a['favouritesCount'], $a['boostsCount']); $bCount = max($b['favouritesCount'], $b['boostsCount']); return $bCount - $aCount; }); foreach ($sortedPosts as $post) { $content = $post['content']; $favouritesCount = $post['favouritesCount']; $boostsCount = $post['boostsCount']; $replyCount = $post['replyCount']; $postUrl = $post['url']; $avatarUrl = $post['avatar']; echo '<div class="post-box">'; echo '<img class="post-avatar" src="' . $avatarUrl . '" alt="User Avatar"><br>'; echo '<div>'; echo '<div class="post-content">' . $content . '</div>'; echo '<div class="counts">'; echo '<span>F: ' . $favouritesCount . '</span><br>'; echo '<span>B: ' . $boostsCount . '</span><br>'; echo '<span>R: ' . $replyCount . '</span><br>'; // Display the number of replies echo '</div>'; echo '<div class="post-link"><a target="_blank" href="' . $postUrl . '">View Post</a></div>'; echo '</div>'; echo '</div>'; } } echo '</div>'; ?> _________________________________ Add friends (saves to html) ---------------------------- <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Get the values from the text boxes $text0 = isset($_POST['text0']) ? $_POST['text0'] : ''; $text1 = isset($_POST['text1']) ? $_POST['text1'] : ''; $text2 = isset($_POST['text2']) ? $_POST['text2'] : ''; $text3 = isset($_POST['text3']) ? $_POST['text3'] : ''; $text4 = isset($_POST['text4']) ? $_POST['text4'] : ''; // Check if any of the text fields contain '<' or '>' if (strpos($text0, '<') !== false || strpos($text0, '>') !== false || strpos($text1, '<') !== false || strpos($text1, '>') !== false || strpos($text2, '<') !== false || strpos($text2, '>') !== false || strpos($text3, '<') !== false || strpos($text3, '>') !== false || strpos($text4, '<') !== false || strpos($text4, '>') !== false) { echo "Invalid input in one or more text fields. Please remove '<' or '>' characters."; } else { $html = $text0 . ' - <a target="_blank" href="' . $text1 . '"><img src="' . $text2 . '" style="width:45px;"></a><span class="smart-hover" title="' . $text3 . '"><u>' . $text4 . '</u></span><style>.smart-hover:hover::after{content:attr(title);}</style><br>' . PHP_EOL; $friendHtmlFile = 'friends.html'; $existingContent = file_get_contents($friendHtmlFile); $newContent = $html . $existingContent; file_put_contents($friendHtmlFile, $newContent); echo "HTML code has been prepended with $text4's entry!"; } } $currentDate = date("Y-m-d"); ?> <html> <head> <title>Friends from the future</title> </head> <body> <form method="POST" action=""> <input type="text" name="text0" placeholder="date" value="<?php echo $currentDate; ?>"><br> <input type="text" name="text1" placeholder="url"><br> <input type="text" name="text2" placeholder="pfp img url"><br> <input type="text" name="text3" placeholder="description"><br> <input type="text" name="text4" placeholder="name"><br> <input type="submit" value="Submit"> </form> </body> </html> <a href="/favs.html" style=color:red>Lookin good today !</a><br><br> <!--<iframe src="/other/extra/personal/friends/friends.html" style="border:0px #ffffff none;" name="statusit" scrolling="no" frameborder="0" marginheight="0px" marginwidth="0px" height=100% width="800" allowfullscreen></iframe>--> <iframe src="<?php echo '/other/extra/personal/friends/friends.html?v=' . uniqid(); ?>" style="border:0px #ffffff none;" name="statusit" scrolling="no" frameborder="0" marginheight="0px" marginwidth="0px" height=100% width="800" allowfullscreen></iframe> <!--AppendVer-- PD9waHAKaWYgKCRfU0VSVkVSWydSRVFVRVNUX01FVEhPRCddID09PSAnUE9TVCcpIHsKICAgIC8vIEdldCB0aGUgdmFsdWVzIGZyb20gdGhlIHRleHQgYm94ZXMKICAgICR0ZXh0MSA9IGlzc2V0KCRfUE9TVFsndGV4dDEnXSkgPyAkX1BPU1RbJ3RleHQxJ10gOiAnJzsKICAgICR0ZXh0MiA9IGlzc2V0KCRfUE9TVFsndGV4dDInXSkgPyAkX1BPU1RbJ3RleHQyJ10gOiAnJzsKICAgICR0ZXh0MyA9IGlzc2V0KCRfUE9TVFsndGV4dDMnXSkgPyAkX1BPU1RbJ3RleHQzJ10gOiAnJzsKICAgICR0ZXh0NCA9IGlzc2V0KCRfUE9TVFsndGV4dDQnXSkgPyAkX1BPU1RbJ3RleHQ0J10gOiAnJzsKICAgICRodG1sID0gJzxhIHRhcmdldD0iX2JsYW5rIiBocmVmPSInIC4gJHRleHQxIC4gJyI+PGltZyBzcmM9IicgLiAkdGV4dDIgLiAnIiBzdHlsZT0id2lkdGg6NDVweDsiPjwvaW1nPjwvYT48c3BhbiBjbGFzcz0ic21hcnQtaG92ZXIiIHRpdGxlPSInIC4gJHRleHQzIC4gJyI+ICA8dT4nIC4gJHRleHQ0IC4gJzwvdT48L3NwYW4+PHN0eWxlPi5zbWFydC1ob3Zlcjpob3Zlcjo6YWZ0ZXJ7Y29udGVudDphdHRyKHRpdGxlKTt9PC9zdHlsZT48YnI+JzsKICAgICRmcmllbmRIdG1sRmlsZSA9ICdmcmllbmRzLmh0bWwnOwogICAgZmlsZV9wdXRfY29udGVudHMoJGZyaWVuZEh0bWxGaWxlLCAkaHRtbCwgRklMRV9BUFBFTkQpOwogICAgLy8gT3V0cHV0IGEgc3VjY2VzcyBtZXNzYWdlCiAgICBlY2hvICJIVE1MIGNvZGUgaGFzIGJlZW4gYXBwZW5kZWQgdG8geW91ciBmcmllbmQncyBIVE1MIGZpbGUhIjsKfQo/Pgo8aHRtbD4KPGhlYWQ+CiAgICA8dGl0bGU+U3VibWl0IEZvcm08L3RpdGxlPgo8L2hlYWQ+Cjxib2R5PgogICAgPGZvcm0gbWV0aG9kPSJQT1NUIiBhY3Rpb249IiI+CiAgICAgICAgPGlucHV0IHR5cGU9InRleHQiIG5hbWU9InRleHQxIiBwbGFjZWhvbGRlcj0idXJsIj48YnI+CiAgICAgICAgPGlucHV0IHR5cGU9InRleHQiIG5hbWU9InRleHQyIiBwbGFjZWhvbGRlcj0icGZwIGltZyB1cmwiPjxicj4KICAgICAgICA8aW5wdXQgdHlwZT0idGV4dCIgbmFtZT0idGV4dDMiIHBsYWNlaG9sZGVyPSJkZXNjcmlwdGlvbiI+PGJyPgogICAgICAgIDxpbnB1dCB0eXBlPSJ0ZXh0IiBuYW1lPSJ0ZXh0NCIgcGxhY2Vob2xkZXI9Im5hbWUiPjxicj4KICAgICAgICA8aW5wdXQgdHlwZT0ic3VibWl0IiB2YWx1ZT0iU3VibWl0Ij4KICAgIDwvZm9ybT4KPC9ib2R5Pgo8L2h0bWw+Cg== --> ____________________________ TextEditor ----------- <?php $currentDir = __DIR__; // Get the current directory if ($_SERVER['REQUEST_METHOD'] === 'POST') { $selectedFile = $_POST['selectedFile']; $content = $_POST['content']; $filename = basename($selectedFile); if (!empty($selectedFile) && !empty($content)) { file_put_contents($filename, $content); // Save the modified content back to the file echo "File saved successfully!"; } } $files = array_diff(scandir($currentDir), array('.', '..')); // Get the list of files excluding "." and ".." echo "<form method='POST'>"; echo "<select name='selectedFile'>"; foreach ($files as $file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'txt') { echo "<option value='$file'>$file</option>"; } } echo "</select>"; echo "<input type='submit' value='Load File'>"; echo "</form>"; if (isset($_POST['selectedFile'])) { $selectedFile = $_POST['selectedFile']; $filename = basename($selectedFile); if (file_exists($filename)) { $content = file_get_contents($filename); $escapedContent = htmlspecialchars($content); echo "<br>"; echo "<form method='POST'>"; echo "<textarea name='content' rows='120' cols='120'>$escapedContent</textarea><br>"; echo "<input type='hidden' name='selectedFile' value='$selectedFile'>"; echo "<input type='submit' value='Save'>"; echo "</form>"; } } ?> ______________ PHP version htaccess version chck + changer (subfolders one dir up) --------------------------- <?php $parentDirectory = dirname(__DIR__); // Get the parent directory $folders = scandir($parentDirectory); // Get all folders within the parent directory echo '<table>'; echo '<tr><th>Folder</th><th>.htaccess</th><th>PHP Version</th></tr>'; foreach ($folders as $folder) { if ($folder === '.' || $folder === '..' || !is_dir($parentDirectory . '/' . $folder)) { continue; // Skip current and parent directory and non-folders } $folderPath = $parentDirectory . '/' . $folder; // Get the full path of the folder $htaccessPath = $folderPath . '/.htaccess'; $htaccessExists = file_exists($htaccessPath); $phpVersion = ''; if ($htaccessExists) { $htaccessContents = file_get_contents($htaccessPath); preg_match('/AddHandler\s+application\/x-httpd-php(\d+)\s+\.php/', $htaccessContents, $matches); if (isset($matches[1])) { $phpVersion = $matches[1]; } } // Fallback to default PHP version if line not found if (empty($phpVersion)) { $phpVersion = phpversion(); } $folderUrl = 'http://' . $_SERVER['HTTP_HOST'] . dirname(dirname($_SERVER['REQUEST_URI'])) . '/' . basename($folderPath); echo '<tr>'; echo '<td><a target="_blank" href="' . htmlspecialchars($folderUrl) . '" target="_blank">' . htmlspecialchars($folder) . '</a></td>'; echo '<td>' . ($htaccessExists ? '<span style="color: green;">Exists</span>' : '<span style="color: gray;">[no .htaccess found]</span>') . '</td>'; echo '<td><a target="_blank" href="change.php?folder=' . urlencode($folder) . '">' . ($phpVersion ? $phpVersion : '[unknown]') . '</a></td>'; echo '</tr>'; } echo '</table>'; ?> ======change.php==== <?php $folder = isset($_GET['folder']) ? $_GET['folder'] : ''; $currentDir = __DIR__; $baseDir = dirname($currentDir); $combinedPath = $baseDir . '/' . $folder; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $phpVersion = $_POST['php_version']; $phpVersion2 = substr_replace($phpVersion, "", -1); $handlerLine = "AddHandler application/x-httpd-php{$phpVersion} .php .php{$phpVersion2}"; $htaccessFile = $combinedPath . '/.htaccess'; $htaccessContent = file_get_contents($htaccessFile); if (strpos($htaccessContent, $handlerLine) === false) { // Append the handler line to the .htaccess file file_put_contents($htaccessFile, PHP_EOL . $handlerLine, FILE_APPEND); $message = "PHP version $phpVersion has been added to the .htaccess file in the folder: $combinedPath"; } else { $message = "PHP version $phpVersion already exists in the .htaccess file in the folder: $combinedPath"; } } ?> <?php if (isset($message)) : ?> <p><?php echo $message; ?></p> <?php endif; ?> <form action="" method="POST"> <label for="php_version">Select PHP Version:</label> <select name="php_version" id="php_version"> <option value="56">PHP 5.6</option> <option value="70">PHP 7.0</option> <option value="71">PHP 7.1</option> <option value="72">PHP 7.2</option> <option value="73">PHP 7.3</option> <option value="74">PHP 7.4</option> <option value="80">PHP 8.0</option> <option value="81">PHP 8.1</option> </select> <br><br> <label for="folder">Select Folder:</label> <input type="text" name="folder" id="folder" placeholder="Enter folder path" value="<?php echo htmlspecialchars($folder); ?>"> <br><br> <input type="submit" value="Submit"> </form> </body> </html> ____________________________________ Filesize in Folder checker (+ dld) ------------------------------------ <?php function getFolderSize($folderPath) { $totalSize = 0; $files = glob(rtrim($folderPath, '/') . '/*'); foreach ($files as $file) { if (is_file($file)) { $totalSize += filesize($file); } if (is_dir($file)) { $totalSize += getFolderSize($file); } } return $totalSize; } $currentDir = __DIR__; if (isset($_POST['submit'])) { $selectedFolders = $_POST['folders']; $fileLists = []; foreach ($selectedFolders as $folder) { $folderPath = $currentDir . '/' . $folder; //$files = glob($folderPath . '/*.txt'); $files = glob($folderPath . '/*'); $fileNames = array_map('basename', $files); $fileLists[$folder] = $fileNames; } echo '<table>'; echo '<tr>'; echo '<th>File Name</th>'; // Display folder names as table headers foreach ($selectedFolders as $folder) { echo '<th>' . $folder . '</th>'; } echo '</tr>'; $allFiles = array_reduce($fileLists, 'array_merge', []); $uniqueFiles = array_unique($allFiles); foreach ($uniqueFiles as $fileName) { echo '<tr>'; echo '<td>' . $fileName . '</td>'; $firstFolder = $selectedFolders[0]; $firstFolderPath = $currentDir . '/' . $firstFolder; $firstFilePath = $firstFolderPath . '/' . $fileName; $firstFileSize = file_exists($firstFilePath) ? filesize($firstFilePath) : 0; foreach ($selectedFolders as $folder) { $folderPath = $currentDir . '/' . $folder; $filePath = $folderPath . '/' . $fileName; if (file_exists($filePath)) { $fileSize = filesize($filePath); echo '<td>'; if ($fileSize === $firstFileSize) { echo '<a target="_blank" href="" style=color:green>[OK]</a>'; } elseif ($fileSize > $firstFileSize) { echo '<a target="_blank" href="" style=color:darkgreen>[OK - GREATER]</a>'; } else { echo '<a target="_blank" href="" style=color:red>[NO - LESSER]</a>'; } echo ' ' . $fileSize . ' bytes</td>'; } else { echo '<td>-</td>'; // Display "-" for missing files } } echo '</tr>'; } echo '</table>'; } // Get the folders in the current directory $folders = array_filter(glob('*'), 'is_dir'); echo '<form method="post">'; foreach ($folders as $index => $folder) { $checked = ($index === 0) ? 'checked' : ''; echo '<input type="checkbox" name="folders[]" value="' . $folder . '" ' . $checked . '>' . $folder . '<br>'; $folderPath = $currentDir . '/' . $folder; $folderSize = getFolderSize($folderPath); echo '<input type="hidden" name="folder_sizes[' . $folder . ']" value="' . $folderSize . '">'; } echo '<input type="submit" name="submit" value="Submit">'; echo '</form>'; ?> <a target="_blank" href="download.php" style=color:transparent>DLD</a> =====download.php=== <?php $html = file_get_contents('https://url'); $pattern = '/<tr>(.*?)<\/tr>/s'; preg_match_all($pattern, $html, $matches); $urls = array(); foreach ($matches[1] as $match) { preg_match('/<a href="(.*?)">/', $match, $urlMatch); if (isset($urlMatch[1])) { $url = $urlMatch[1]; if (pathinfo($url, PATHINFO_EXTENSION) === "txt") { $urls[] = 'https://alceawis.de' . $url; } } } $destinationFolder = date("Y-m-d"); if (!is_dir($destinationFolder)) { mkdir($destinationFolder); } $downloadedFiles = array(); foreach ($urls as $url) { $fileName = basename($url); $destinationPath = $destinationFolder . '/' . $fileName; file_put_contents($destinationPath, file_get_contents($url)); $downloadedFiles[] = $destinationPath; } echo '<ul>'; foreach ($downloadedFiles as $filePath) { echo '<li><a href="' . $filePath . '">' . basename($filePath) . '</a></li>'; } echo '</ul>'; echo 'Download completed.'; ?> _______________________ Youtube / YT channel latest video via API to autoscroll html: --------------------------------------------- https://alcea-wisteria.de/PHP//0demo/2023-06-17-YT-Tools/API-RSS-Save/save-feed.php?channelid=UCrltGih11A_Nayz6hG5XtIw&apikey=insertapikeyhere4&save <?php $API_KEY = $_GET['apikey'] ?? ''; // Extract the apiKey from the query string if (empty($API_KEY)) { echo 'No apiKey provided'; exit; } $channelId = $_GET['channelid'] ?? ''; // Extract the channelId from the query string if (empty($channelId)) { echo 'No channelId provided'; exit; } $MAX_RESULTS = 15; $url = "https://www.googleapis.com/youtube/v3/search?key={$API_KEY}&channelId={$channelId}&part=snippet,id&order=date&maxResults={$MAX_RESULTS}"; $response = file_get_contents($url); if ($response === false) { echo 'Error fetching videos'; exit; } $data = json_decode($response, true); if (!isset($data['items'])) { echo 'No videos found'; exit; } $pageOutput = ''; foreach ($data['items'] as $item) { $videoId = $item['id']['videoId']; $title = $item['snippet']['title']; $link = "https://www.youtube.com/watch?v={$videoId}"; $pageOutput .= "<a href='{$link}' target='_blank'>{$title}</a><br><br>"; } if (isset($_GET['save'])) { // Read the contents of autoscroll.html $autoscrollContent = file_get_contents('autoscroll.html'); // Replace "INJECT" with the current page output $modifiedContent = str_replace('INJECT', $pageOutput, $autoscrollContent); // Save the modified content to a new file $filename = "rss-scrolling-source-{$channelId}.html"; file_put_contents($filename, $modifiedContent); echo "Modified content saved to {$filename}"; } else { // Output the page content echo $pageOutput; } ?> __________________ Fetch shoutcast trackinfo via querystring: ---------------------------------- <?php function getStreamMetadata() { if (isset($_GET['streamurl'])) { $streamUrl = $_GET['streamurl']; $needle = 'StreamTitle='; $ua = 'Dailymate Radio/1.0'; $opts = ['http' => ['method' => 'GET', 'header' => 'Icy-MetaData: 1', 'user_agent' => $ua] ]; $context = stream_context_create($opts); $icyMetaIntFound = false; $icyInterval = -1; $offset = 0; if(($headers = get_headers($streamUrl, 0, $context))) { foreach($headers as $h) { if(!(strpos(strtolower($h), 'icy-metaint:') === false)) { $icyMetaIntFound = true; $icyInterval = explode(':', $h)[1]; break; } } } if(!$icyMetaIntFound) { echo "icy-metaint header not exists!"; return; } if($stream = fopen($streamUrl, 'r', false, $context)) { while($buffer = stream_get_contents($stream, $icyInterval, $offset)) { if(strpos($buffer, $needle) !== false) { fclose($stream); $title = explode($needle, $buffer)[1]; return substr($title, 1, strpos($title, ';') - 2); } $offset += $icyInterval; } } } else { // The 'streamurl' parameter is not set } } echo getStreamMetadata(); ?> _______________________ Wikipedia tabel parser (with column data copoy function): ------------------------------------------------- <a target="_blank" href="?tablecolumn=Firm&tablecontent=Nintendo" style=color:blue>txmpl</a><br><br> <?php header('Content-Type: text/html; charset=utf-8'); $url = 'https://en.m.wikipedia.org/wiki/List_of_best-selling_game_consoles'; $html = file_get_contents($url); $table_regex = '/<table[^>]*class="wikitable sortable"[^>]*>(.*?)<\/table>/s'; if (preg_match($table_regex, $html, $matches)) { $table_html = $matches[0]; $column = $_GET['tablecolumn'] ?? ''; $content = $_GET['tablecontent'] ?? ''; if (!empty($column) && !empty($content)) { $filtered_table_html = filterTable($table_html, $column, $content); if ($filtered_table_html) { echo $filtered_table_html; } else { echo 'No matching rows found.'; } } else { echo $table_html; } addCopyButtons(); } else { echo 'Table not found.'; } function filterTable($tableHtml, $column, $content) { $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML(mb_convert_encoding($tableHtml, 'HTML-ENTITIES', 'UTF-8')); libxml_clear_errors(); $xpath = new DOMXPath($dom); $rows = $xpath->query('//table/tbody/tr'); $columnIndex = -1; $headerRow = $rows->item(0); $headerCells = $headerRow->getElementsByTagName('th'); foreach ($headerCells as $index => $cell) { if (trim($cell->nodeValue) === $column) { $columnIndex = $index; break; } } $filteredRows = []; foreach ($rows as $row) { $cells = $row->getElementsByTagName('td'); $cellContent = $cells->item($columnIndex)->nodeValue; if (stripos($cellContent, $content) !== false) { $filteredRows[] = $row; } } // Build the filtered table HTML $filteredTableHtml = '<table class="wikitable sortable">'; $filteredTableHtml .= $headerRow->ownerDocument->saveHTML($headerRow); foreach ($filteredRows as $row) { $filteredTableHtml .= $row->ownerDocument->saveHTML($row); } $filteredTableHtml .= '</table>'; return count($filteredRows) > 0 ? $filteredTableHtml : false; } function addCopyButtons() { $dom = new DOMDocument(); libxml_use_internal_errors(true); global $table_html; $dom->loadHTML($table_html); libxml_clear_errors(); $xpath = new DOMXPath($dom); $headerRow = $xpath->query('//table/tbody/tr[1]')->item(0); $headerCells = $headerRow->getElementsByTagName('th'); echo '<div>'; foreach ($headerCells as $index => $cell) { $columnName = trim($cell->nodeValue); echo '<button onclick="copyColumnData(' . $index . ')">Copy ' . $columnName . '</button>'; } echo '</div>'; } ?> <script> // Function to copy the column data to the clipboard function copyColumnData(columnIndex) { var table = document.querySelector('.wikitable'); var columnData = ''; var rows = table.getElementsByTagName('tr'); for (var i = 0; i < rows.length; i++) { var row = rows[i]; var cells = row.getElementsByTagName('td'); var cell = cells[columnIndex]; if (cell) { columnData += cell.innerText.trim() + '\n'; } } navigator.clipboard.writeText(columnData); //alert('Column data copied to clipboard.'); } </script> ______________________________ Add <br> tags to nonconf html files in folder: -------------------------------------------- <?php $currentFolder = './'; // Update this to the path of the current folder // Check if a file was uploaded if (isset($_FILES['htmlFile']) && $_FILES['htmlFile']['error'] === UPLOAD_ERR_OK) { $uploadedFile = $_FILES['htmlFile']['tmp_name']; $fileName = $_FILES['htmlFile']['name']; $fileSize = $_FILES['htmlFile']['size']; // Check if the file size is within the allowed limit (1MB) $maxFileSize = 1024 * 1024; // 1MB in bytes if ($fileSize <= $maxFileSize) { // Move the uploaded file to the current folder $destination = $currentFolder . $fileName; move_uploaded_file($uploadedFile, $destination); echo "File uploaded successfully: $fileName<br>"; } else { echo "File size exceeds the maximum allowed limit (1MB)<br>"; } } $files = glob($currentFolder . '*.html'); // Get all HTML files in the current folder // Sort the files by modified time (newest first) usort($files, function ($a, $b) { return filemtime($b) - filemtime($a); }); // Get the three newest HTML files $newestFiles = array_slice($files, 0, 3); // Display the file list echo '<h3>Latest HTML Files:</h3>'; echo '<ul>'; foreach ($newestFiles as $file) { echo '<li><a href="?file=' . urlencode($file) . '">' . basename($file) . '</a></li>'; } echo '</ul>'; // Check if a file is clicked and add <br> tags to it if (isset($_GET['file'])) { $clickedFile = $_GET['file']; if (in_array($clickedFile, $newestFiles)) { $content = file_get_contents($clickedFile); // Read the file content // Check if the file does not contain a <br> tag if (strpos($content, '<br>') === false) { $modifiedContent = str_replace("\n", "<br>\n", $content); // Add <br> tag to each line file_put_contents($clickedFile, $modifiedContent); // Write the modified content back to the file echo "Added <br> tags to $clickedFile<br>"; } else { echo "The file $clickedFile already contains <br> tags<br>"; } } else { echo "Invalid file clicked<br>"; } } ?> <!-- HTML form for file upload --> <h3>Upload HTML File:</h3> <form method="POST" enctype="multipart/form-data"> <input type="file" name="htmlFile" accept=".html" required> <input type="hidden" name="MAX_FILE_SIZE" value="1048576"> <!-- 1MB in bytes --> <button type="submit">Upload</button> </form> ___________________________ Visualize past programming efforts (php): ----------------------------------------- <?php $url = "https://alcea-wisteria.de/PHP/0demo/"; $html = file_get_contents($url); //$pattern = '/<tr>(.*?)<\/tr>/s'; //timestamp based $pattern = '/<td data-sort="([^"]*)"/'; //filename based preg_match_all($pattern, $html, $matches); $dates = array(); foreach ($matches[0] as $match) { preg_match('/\d{4}-\d{2}-\d{2}/', $match, $date); if (!empty($date)) { $dates[] = $date[0]; } } // Count the occurrences of each month-year combination $counts = array(); foreach ($dates as $date) { $monthYear = substr($date, 0, 7); // Extract the yyyy-mm part if (isset($counts[$monthYear])) { $counts[$monthYear]++; } else { $counts[$monthYear] = 1; } } // Fill in months with no entries and set their count to 0 $startDate = min(array_keys($counts)); $endDate = date('Y-m'); // Get the current month-year $currentDate = $startDate; while ($currentDate != $endDate) { if (!isset($counts[$currentDate])) { $counts[$currentDate] = 0; } $currentDate = date('Y-m', strtotime($currentDate . ' +1 month')); } // Sort the month-year combinations by year and then month ksort($counts); // Prepare the data for the chart $labels = array_keys($counts); $data = array_values($counts); ?> <!DOCTYPE html> <html> <head> <title>Date Chart</title> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> </head> <body> <canvas id="myChart"></canvas> <script> // Create the chart var ctx = document.getElementById('myChart').getContext('2d'); var myChart = new Chart(ctx, { type: 'line', data: { labels: <?php echo json_encode($labels); ?>, datasets: [{ label: 'Date Counts', data: <?php echo json_encode($data); ?>, backgroundColor: 'rgba(75, 192, 192, 0.2)', borderColor: 'rgba(75, 192, 192, 1)', borderWidth: 1 }] }, options: { scales: { y: { beginAtZero: true, stepSize: 1 } } } }); </script> </body> ________________________ Simple (UrlValueBased) Comment System: --------------------------------- <===========NormalSubmitVersion=============> <div id="comments"></div> <br> <form action="" method="POST" id="commentForm"> <input type="text" name="name" placeholder="Your Name"><br> <textarea name="comment" rows="4" cols="50"></textarea> <input type="hidden" name="jsonFilename" value="" id="jsonFilenameInput"> <input type="submit" value="Submit"><br> </form> <script> window.addEventListener("DOMContentLoaded", function() { // fetch('comments.txt') // .then(response => response.text()) // .then(data => { // urlbase = data.trim(); // Assign the value to urlbase // }) var urlbase = "https://alcea-wisteria.de/PHP/0demo/2024-02-05-UrlValueBasedCommentSystem/"; var url = window.location.href; var jsonFilename = url.replace(/[^A-Za-z0-9]/g, "") + ".json"; var jsonUrl = urlbase + jsonFilename; document.getElementById("jsonFilenameInput").value = jsonFilename; document.getElementById("commentForm").action = urlbase + "submit_comment.php"; fetch(jsonUrl) .then(response => response.json()) .then(data => { if (Array.isArray(data)) { data.reverse(); data.forEach(entry => { var comment = entry.comment; var name = entry.name; renderComment(name, comment); }); } else { console.log("No comments found for the current URL."); } }) .catch(error => { console.log("Error fetching JSON file:", error); }); }); function renderComment(name, comment) { var commentsElement = document.getElementById("comments"); var commentElement = document.createElement("div"); commentElement.innerHTML = "<strong>" + name + "</strong>: " + comment; commentsElement.appendChild(commentElement); } </script> <=======UrlSubmitVersion=======> PGRpdiBpZD0iY29tbWVudHMiPjwvZGl2Pgo8aHI+Cjxmb3JtIGFjdGlvbj0iIiBtZXRob2Q9IlBPU1QiIGlkPSJjb21tZW50Rm9ybSI+CiAgICA8aW5wdXQgdHlwZT0idGV4dCIgbmFtZT0ibmFtZSIgcGxhY2Vob2xkZXI9IlN0YXRpb24gTmFtZSI+PGJyPgogICAgIDx0ZXh0YXJlYSBuYW1lPSJjb21tZW50IiByb3dzPSIxIiBjb2xzPSI1MCIgcGxhY2Vob2xkZXI9InN0cmVhbSBodHRwczovLyB1cmwiPjwvdGV4dGFyZWE+CiAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0ianNvbkZpbGVuYW1lIiB2YWx1ZT0iIiBpZD0ianNvbkZpbGVuYW1lSW5wdXQiPgogIDxpbnB1dCB0eXBlPSJzdWJtaXQiIHZhbHVlPSJTdWJtaXQiIG9uY2xpY2s9InJldHVybiBzdWJtaXRfY29tbWVudCgpIj48YnI+CjwvZm9ybT4KPHNjcmlwdD4KICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiRE9NQ29udGVudExvYWRlZCIsIGZ1bmN0aW9uKCkgewogICAgdmFyIHVybGJhc2UgPSAiaHR0cHM6Ly9hbGNlYS13aXN0ZXJpYS5kZS9QSFAvMGRlbW8vMjAyNC0wMi0wNS1VcmxWYWx1ZUJhc2VkQ29tbWVudFN5c3RlbS8iOwogICAgdmFyIHVybCA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmOwogICAgdmFyIGpzb25GaWxlbmFtZSA9IHVybC5yZXBsYWNlKC9bXkEtWmEtejAtOV0vZywgIiIpICsgIi5qc29uIjsKICAgIHZhciBqc29uVXJsID0gdXJsYmFzZSArIGpzb25GaWxlbmFtZTsKICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJqc29uRmlsZW5hbWVJbnB1dCIpLnZhbHVlID0ganNvbkZpbGVuYW1lOwogICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImNvbW1lbnRGb3JtIikuYWN0aW9uID0gdXJsYmFzZSArICJzdWJtaXRfY29tbWVudC5waHAiOwogICAgZmV0Y2goanNvblVybCkKICAgICAgLnRoZW4ocmVzcG9uc2UgPT4gcmVzcG9uc2UuanNvbigpKQogICAgICAudGhlbihkYXRhID0+IHsKICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShkYXRhKSkgewogICAgICAgICAgZGF0YS5yZXZlcnNlKCk7CiAgICAgICAgICBkYXRhLmZvckVhY2goZW50cnkgPT4gewogICAgICAgICAgICB2YXIgY29tbWVudCA9IGVudHJ5LmNvbW1lbnQ7CiAgICAgICAgICAgIHZhciBuYW1lID0gZW50cnkubmFtZTsKICAgICAgICAgICAgcmVuZGVyQ29tbWVudChuYW1lLCBjb21tZW50KTsKICAgICAgICAgIH0pOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBjb25zb2xlLmxvZygiTm8gY29tbWVudHMgZm91bmQgZm9yIHRoZSBjdXJyZW50IFVSTC4iKTsKICAgICAgICB9CiAgICAgIH0pCiAgICAgIC5jYXRjaChlcnJvciA9PiB7CiAgICAgICAgY29uc29sZS5sb2coIkVycm9yIGZldGNoaW5nIEpTT04gZmlsZToiLCBlcnJvcik7CiAgICAgIH0pOwogIH0pOwogIGZ1bmN0aW9uIHJlbmRlckNvbW1lbnQobmFtZSwgY29tbWVudCkgewogICAgdmFyIGNvbW1lbnRzRWxlbWVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjb21tZW50cyIpOwogICAgdmFyIGNvbW1lbnRFbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICBjb21tZW50RWxlbWVudC5pbm5lckhUTUwgPSAiPHN0cm9uZz4iICsgbmFtZSArICI8L3N0cm9uZz46ICIgKyBjb21tZW50OwogICAgY29tbWVudHNFbGVtZW50LmFwcGVuZENoaWxkKGNvbW1lbnRFbGVtZW50KTsKICB9CiAgZnVuY3Rpb24gc3VibWl0X2NvbW1lbnQoKSB7CiAgdmFyIG5hbWVJbnB1dCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ2lucHV0W25hbWU9Im5hbWUiXScpOwogIHZhciBuYW1lVmFsdWUgPSBuYW1lSW5wdXQudmFsdWU7CgogIHZhciBjb21tZW50SW5wdXQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCd0ZXh0YXJlYVtuYW1lPSJjb21tZW50Il0nKTsKICB2YXIgY29tbWVudFZhbHVlID0gY29tbWVudElucHV0LnZhbHVlOwoKICAvLyBDaGVjayBpZiB0aGUgbmFtZSBmaWVsZCBjb250YWlucyAiPCIgYW5kIHRoZSBjb21tZW50IGZpZWxkIGluY2x1ZGVzICJodHRwIgogIGlmIChuYW1lVmFsdWUuaW5jbHVkZXMoJzwnKSB8fCAhY29tbWVudFZhbHVlLmluY2x1ZGVzKCdodHRwJykpIHsKICAgIGFsZXJ0KCdJbnZhbGlkIGlucHV0OiBQbGVhc2UgbWFrZSBzdXJlIHRoZSBOYW1lIGZpZWxkIGRvZXMgbm90IGNvbnRhaW4gIjwiIGFuZCB0aGUgQ29tbWVudCBmaWVsZCBpbmNsdWRlcyAiaHR0cCIuJyk7CiAgICByZXR1cm4gZmFsc2U7IC8vIFByZXZlbnQgZm9ybSBzdWJtaXNzaW9uCiAgfQoKICAvLyBJZiBhbGwgdmFsaWRhdGlvbnMgcGFzcywgcHJvY2VlZCB3aXRoIHRoZSBleGlzdGluZyBsb2dpYwogIGNvbW1lbnRJbnB1dC52YWx1ZSA9ICc8YSBocmVmPSIjIiBvbmNsaWNrPSJkb2N1bWVudC5nZXRFbGVtZW50QnlJZChcJ3VybElucHV0XCcpLnZhbHVlID0gXCcnICsgY29tbWVudFZhbHVlICsgJ1wnOyByZXR1cm4gZmFsc2U7Ij4nICsgY29tbWVudFZhbHVlICsgJzwvYT4nOwogIHJldHVybiB0cnVlOyAvLyBBbGxvdyBmb3JtIHN1Ym1pc3Npb24KfQo8L3NjcmlwdD4K ====submit_comment.php=== <?php if ($_SERVER["REQUEST_METHOD"] === "POST") { $url = $_SERVER["HTTP_REFERER"]; // Get the current URL $filename = preg_replace("/[^A-Za-z0-9]/", "", $url); // Remove non-alphanumeric characters from the URL $name = $_POST["name"]; // Get the submitted name $comment = $_POST["comment"]; // Get the submitted comment $jsonFilename = $_POST["jsonFilename"]; // Get the submitted jsonFilename // Read the existing JSON data from the file $existingData = file_get_contents($jsonFilename); $existingJson = json_decode($existingData, true); if (!$existingJson) { // If the JSON file doesn't exist or is not valid JSON, create an empty array $existingJson = []; } // Create a new data entry with the submitted name and comment $newData = array( "name" => $name, "comment" => $comment ); // Append the new data to the existing JSON data $existingJson[] = $newData; // Encode the merged data as JSON $json = json_encode($existingJson); // Write the updated JSON back to the file file_put_contents($jsonFilename, $json); echo "<a href=javascript:history.back()>[View Comment]</a>"; } ?> ====.htaccess====== Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE" Header set Access-Control-Allow-Headers "Content-Type, Authorization" ____________________ Simple PHP Gallery: --------------------------------- ======index.php===== <?php $galleriesPath = "./galleries"; $galleries = array_filter(glob($galleriesPath . '/*'), 'is_dir'); echo '<div style="display: grid; grid-template-columns: repeat(5, 1fr); grid-gap: 10px;">'; foreach ($galleries as $gallery) { $images = glob($gallery . '/*.{jpg,jpeg,png,gif}', GLOB_BRACE); $newestImage = end($images); $galleryName = basename($gallery); $displayUrl = 'display.php?gallery=' . urlencode($galleryName); echo '<a href="' . $displayUrl . '" style="text-decoration: none; color: inherit;">'; echo '<div style="text-align: center;">'; $isNSFW = stripos($galleryName, 'nsfw') !== false; // Apply blur if the image is NSFW $imageStyle = $isNSFW ? 'filter: blur(10px);' : ''; echo '<img src="' . $newestImage . '" alt="' . $galleryName . '" width="250" height="250" style="margin-bottom: 5px;' . $imageStyle . '">'; echo '<div>' . $galleryName . '</div>'; echo '</div>'; echo '</a>'; } echo '</div>'; ?> ===display.php==== <a href="<?php echo dirname($_SERVER['REQUEST_URI']); ?>"><img src="https://www.downloadclipart.net/large/19185-back-button-design.png" style="width:40px;" /></a> <?php // Retrieve the gallery name from the query string $galleryName = $_GET['gallery']; $galleryPath = './galleries/' . $galleryName; $images = glob($galleryPath . '/*.{jpg,jpeg,png,gif}', GLOB_BRACE); // Custom sort function to sort images by basename usort($images, function($a, $b) { $basenameA = pathinfo($a, PATHINFO_FILENAME); $basenameB = pathinfo($b, PATHINFO_FILENAME); return strcmp($basenameB, $basenameA); }); $numColumns = 5; $numImages = count($images); $numRows = ceil($numImages / $numColumns); echo '<div style="display: grid; grid-template-columns: repeat(' . $numColumns . ', 1fr); grid-gap: 10px;">'; foreach ($images as $key => $image) { echo '<div style="display: flex; flex-direction: column; align-items: center;">'; echo '<img src="' . $image . '" alt="' . basename($image) . '" style="width: 250px; height: 250px; object-fit: cover; cursor: pointer;" onclick="openPopup(' . $key . ');" loading="lazy">'; echo '<div style="text-align: center;">' . basename($image) . '</div>'; echo '</div>'; } echo '</div>'; ?> <!-- CSS Popup --> <style> .popup { display: none; position: fixed; z-index: 9999; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.9); } .popup-image { display: block; max-width: 90%; max-height: 80%; margin: 50px auto; } .popup-close { position: absolute; top: 10px; right: 10px; color: #000; cursor: pointer; font-size: 24px; } .popup-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 100%; display: flex; justify-content: space-between; align-items: center; color: #000; font-size: 30px; } .popup-prev, .popup-next { padding: 20px; cursor: pointer; } </style> <!-- JavaScript --> <script> var currentImageIndex = 0; var images = <?php echo json_encode($images); ?>; function openPopup(index) { currentImageIndex = index; var popup = document.getElementById('popup'); var popupImage = document.getElementById('popup-image'); popupImage.src = images[currentImageIndex]; popup.style.display = 'block'; } function closePopup() { var popup = document.getElementById('popup'); popup.style.display = 'none'; } function showPrevImage() { currentImageIndex = (currentImageIndex - 1 + images.length) % images.length; var popupImage = document.getElementById('popup-image'); popupImage.src = images[currentImageIndex]; } function showNextImage() { currentImageIndex = (currentImageIndex + 1) % images.length; var popupImage = document.getElementById('popup-image'); popupImage.src = images[currentImageIndex]; } </script> <!-- HTML Popup --> <div id="popup" class="popup"> <span class="popup-close" onclick="closePopup()">&times;</span> <div class="popup-nav"> <span class="popup-prev" onclick="showPrevImage()">&#10094;</span> <span class="popup-next" onclick="showNextImage()">&#10095;</span> </div> <img id="popup-image" class="popup-image" src="" alt=""> </div> =====upload.php=== <div class="image-preview" id="imagePreview"></div> <style> .gallery-picker { display: flex; justify-content: center; align-items: center; height: 300px; } .image-preview { display: flex; justify-content: center; align-items: center; height: 400px; width: 1000px; border: 1px solid #ccc; margin-top: 20px; } .image-preview img { max-width: 100%; max-height: 100%; } </style> </head> <body> <div class="gallery-picker"> <form action="upload.php" method="post" enctype="multipart/form-data"> <select name="gallery"> <?php $galleriesPath = 'galleries/'; $folders = array_filter(glob($galleriesPath . '*'), 'is_dir'); foreach ($folders as $folder) { $folderName = basename($folder); echo "<option value='$folderName'>$folderName</option>"; } ?> </select> <input type="file" name="image" accept="image/*" onchange="previewImage(event)"> <input type="submit" value="Upload"> </form> </div> <script> function previewImage(event) { var reader = new FileReader(); reader.onload = function() { var imgElement = document.createElement('img'); imgElement.src = reader.result; document.getElementById('imagePreview').innerHTML = ''; document.getElementById('imagePreview').appendChild(imgElement); } reader.readAsDataURL(event.target.files[0]); } </script> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $gallery = $_POST['gallery']; $targetDirectory = $galleriesPath . $gallery . '/'; $targetFile = $targetDirectory . basename($_FILES['image']['name']); $uploadSuccess = move_uploaded_file($_FILES['image']['tmp_name'], $targetFile); if ($uploadSuccess) { echo "<p>Image uploaded successfully.</p>"; } else { echo "<p>Failed to upload image.</p>"; } } ?> </body> _________________ Display htaccess: ----------------------------- <?php $htaccessPath = '.htaccess'; exists if (file_exists($htaccessPath)) { $htaccessContent = file_get_contents($htaccessPath); echo "<pre>{$htaccessContent}</pre>"; } else { echo "The .htaccess file does not exist."; } ?> __________________________ Last played gamewriter --------------------------- example link: https://alcea-wisteria.de/PHP/0demo/2024-01-14-Lastplayed/lastplayed.php?gamename=title<br><br> <?php $currentContent = file_get_contents('current.html'); $targetContent = file_get_contents('oldentries.html'); $updatedContent = $currentContent . $targetContent; $linkpattern = '/<a\b[^>]*>(.*?)<\/a>/'; //remove link $replacement = ''; $updatedContent = preg_replace($linkpattern, $replacement, $updatedContent); file_put_contents('oldentries.html', $updatedContent); ?> <?php if(isset($_GET['gamename'])) { $gamename = $_GET['gamename']; $currentDateTime = date('Y-m-d H:i:s'); $htmlContent = '<u>LastPlayed:</u> ' . $gamename . ' - (' . $currentDateTime . ') <a target="_blank" href="oldentries.html" style="color:gray">(old)</a><br>'; file_put_contents('current.html', $htmlContent); //echo "Successfully updated current.html with the game name: $gamename and current date and time."; // Output the iframe with cache busting echo "<iframe src='current.html?" . time() . "' style='width: 100%; border: none;'></iframe>"; } else { echo "<iframe src='current.html?" . time() . "' style='width: 100%; border: none;'></iframe>"; } ?> _________________ Fetch Fediverse Usercount: ------------------------------------------- <?php $url = 'https://api.fedidb.org/v1/stats'; $response = file_get_contents($url); if ($response !== false) {     $data = json_decode($response, true);     if ($data !== null) {         // Access the data and render         $totalUsers = $data['total_users'];         $activeUsers = $data['monthly_active_users'];         $totalPosts = $data['total_statuses_str'];         echo "Total Users: $totalUsers<br>";         echo "Active Users: $activeUsers<br>";         echo "Total Posts: $totalPosts<br>";     } else {         echo "Error: Failed to decode JSON response.";     } } else {     echo "Error: Failed to fetch data from the API endpoint."; } ?> ____________________________ Render textfile in style /(Parse and display *.txt as hyperlink html: (Delimiter: "https://") -------------------------------------- <?php $file = fopen('xnotes.txt', 'r'); if ($file) { while (($line = fgets($file)) !== false) { $line = trim($line); $parts = explode('https://', $line, 2); $title = $parts[0]; $url = 'https://' . $parts[1]; echo "<a href=\"$url\" target=\"_blank\">$title</a><br>"; } fclose($file); } else { echo 'Failed to open the file.'; } ?> ---Example txt-- YGO VRAINS: https://alcea-wisteria.de/PHP/xnotes/view.php?s-1705150073-e73eae915bceecad0f0413c3e6b713b0 Windows OS: https://alcea-wisteria.de/PHP/xnotes/view.php?s-1705150108-854bffd31ca032a51c3e06536ddbe493 __________________ Xnotes (evernote / nimbusnotes clone): ----------------------------------------------------------- https://github.com/Xtrendence/X-Notes => https://codeload.github.com/Xtrendence/X-Notes/zip/refs/heads/master ______________________________________ PHP Gamedatabase (with html renderer): ------------------------------------------- =================gamedb.php======== <!DOCTYPE html> <html> <head> <title>Sortable Table</title> <style> table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 8px; } th { cursor: pointer; } input[type="text"] { width: 100%; padding: 5px; margin-bottom: 10px; } </style> </head> <body> <?php // Function to write table data to a file function writeDataToFile($data, $filename) { $file = fopen($filename, 'w'); fwrite($file, json_encode($data)); fclose($file); } // Function to read table data from a file function readDataFromFile($filename) { if (file_exists($filename)) { $data = file_get_contents($filename); return json_decode($data, true); } return []; } // Database file name $dbFile = 'gamedb.json'; // Check if a new entry is submitted if (isset($_POST['submit'])) { $newEntry = [ 'Gamename' => $_POST['gamename'], 'System' => $_POST['system'], 'Vendor' => $_POST['vendor'], 'Comment' => $_POST['comment'], 'Rating' => $_POST['rating'], 'Description' => $_POST['description'], 'link' => $_POST['link'] ]; // Read existing data from file $games = readDataFromFile($dbFile); // Add the new entry $games[] = $newEntry; // Write the updated data to file writeDataToFile($games, $dbFile); } else { // Read data from file $games = readDataFromFile($dbFile); } ?> <table> <tr> <th onclick="sortTable(0)">Gamename</th> <th onclick="sortTable(1)">System</th> <th onclick="sortTable(2)">Vendor</th> <th onclick="sortTable(3)">Comment</th> <th onclick="sortTable(4)">Rating</th> <th onclick="sortTable(5)">Description</th> <th onclick="sortTable(6)">Link</th> </tr> <?php foreach ($games as $game): ?> <tr> <td><?php echo $game['Gamename']; ?></td> <td><?php echo $game['System']; ?></td> <td><?php echo $game['Vendor']; ?></td> <td><?php echo $game['Comment']; ?></td> <td><?php echo $game['Rating']; ?></td> <td><?php echo $game['Description']; ?></td> <td><?php echo $game['link']; ?></td> </tr> <?php endforeach; ?> </table> <form method="post" action=""> <input type="text" name="gamename" placeholder="Gamename" required> <input type="text" name="system" placeholder="System" required> <input type="text" name="vendor" placeholder="Vendor" required> <input type="text" name="comment" placeholder="Comment" required> <input type="text" name="rating" placeholder="Rating" required> <input type="text" name="description" placeholder="Description" required> <input type="text" name="link" placeholder="Link" required> <input type="submit" name="submit" value="Add Entry"> </form> <script> // Function to sort the table function sortTable(columnIndex) { var table, rows, switching, i, x, y, shouldSwitch; table = document.getElementsByTagName("table")[0]; switching = true; while (switching) { switching = false; rows = table.rows; for (i = 1; i < (rows.length - 1); i++) { shouldSwitch = false; x = rows[i].getElementsByTagName("td")[columnIndex]; y = rows[i + 1].getElementsByTagName("td")[columnIndex]; if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { shouldSwitch = true; break; } } if (shouldSwitch) { rows[i].parentNode.insertBefore(rows[i + 1], rows[i]); switching = true; } } } // Add event listeners to table headers for sorting var headers = document.getElementsByTagName("th"); for (var i = 0; i < headers.length; i++) { headers[i].addEventListener("click", function () { var columnIndex = Array.from(this.parentNode.children).indexOf(this); sortTable(columnIndex); }); } </script> </body> </html> ======html json renderer==== <style> table { border-collapse: collapse; width: 100%; } th, td { padding: 8px; text-align: left; border-bottom: 1px solid #ddd; } th { background-color: #f2f2f2; cursor: pointer; } th::after { content: ""; display: inline-block; margin-left: 5px; } .asc::after { content: "^"; } .desc::after { content: "v"; } </style> </head> <body> <table id="gameTable"> <thead> <tr> <th onclick="sortTable(0)">Game Name</th> <th onclick="sortTable(1)">System</th> <th onclick="sortTable(2)">Vendor</th> <th onclick="sortTable(3)">Comment</th> <th onclick="sortTable(4)">Rating</th> <th onclick="sortTable(5)">Description</th> <th onclick="sortTable(6)">Link</th> </tr> </thead> <tbody id="gameTableBody"></tbody> </table> <script> let sortingOrder = {}; // Function to fetch the JSON data and populate the table function fetchGameData() { fetch('gamedb.json') .then(response => response.json()) .then(data => { const gameTableBody = document.getElementById('gameTableBody'); gameTableBody.innerHTML = ''; data.forEach(game => { const row = document.createElement('tr'); row.innerHTML = ` <td>${game.Gamename}</td> <td>${game.System}</td> <td>${game.Vendor}</td> <td>${game.Comment}</td> <td>${game.Rating}</td> <td>${game.Description}</td> <td><a href="${game.link}">Link</a></td> `; gameTableBody.appendChild(row); }); }) .catch(error => { console.error('Error:', error); }); } // Function to sort the table based on the selected column function sortTable(columnIndex) { const table = document.getElementById('gameTable'); const rows = Array.from(table.rows).slice(1); // Exclude the table header row const asc = sortingOrder[columnIndex] === 'asc'; rows.sort((a, b) => { const cellA = a.cells[columnIndex].textContent.toLowerCase(); const cellB = b.cells[columnIndex].textContent.toLowerCase(); return asc ? cellA.localeCompare(cellB) : cellB.localeCompare(cellA); }); table.tBodies[0].append(...rows); // Update sortingOrder for the current column sortingOrder = {}; sortingOrder[columnIndex] = asc ? 'desc' : 'asc'; // Update CSS classes for sorting indicators const ths = table.tHead.rows[0].cells; ths.forEach(th => th.classList.remove('asc', 'desc')); ths[columnIndex].classList.add(sortingOrder[columnIndex]); } // Fetch the game data when the page loads fetchGameData(); </script> </body> </html> ___________________________ Check Files & Folders against txt (integrity check): ----------------------------------------- <details><a target="_blank" href="z_listgen.php" style=color:blue>Refresh list</a></details><br><br> <?php $reportPath = './z_list.txt'; $reportContent = file_get_contents($reportPath); $currentDir = getcwd(); $reportFiles = explode("\n", $reportContent); $fileCount = 0; $folderCount = 0; $okCount = 0; $missingCount = 0; $files = []; $folders = []; foreach ($reportFiles as $filename) { if (empty($filename)) { continue; } if (is_dir($filename)) { $folderCount++; $folders[] = $filename; continue; } if ($filename === 'error_log' || $filename === 'alceawis.de.zip') { continue; } if (file_exists($filename)) { $fileCount++; $okCount++; $files[] = '<span style="color: green;">[ok]</span> <a href="' . $filename . '" target="_blank">' . $filename . '</a>'; } else { $missingCount++; $files[] = '<span style="color: red;">[missing]</span> ' . $filename; } } foreach (scandir($currentDir) as $filename) { if ($filename[0] === '.' || is_dir($filename) || $filename === 'z_listcheck.php' ) { continue; } if ($filename === 'error_log' || $filename === 'alceawis.de.zip') { continue; } if (!in_array($filename, $reportFiles)) { $fileCount++; $missingCount++; $files[] = '<span style="color: red;">[missing]</span> ' . $filename; } } foreach ($folders as $folder) { echo '<span style="color: green;">[ok]</span> <a href="' . $folder . '" target="_blank">' . $folder . '</a><br>'; } foreach ($files as $file) { echo $file . '<br>'; } echo '<p>Total Files: ' . $fileCount . ' Total Folders: ' . $folderCount . '</p>'; echo '<hr>'; echo '<p>Number [ok]: ' . $okCount; if ($okCount === $fileCount) { echo ' (all)'; } echo '</p>'; echo '<p>Number of missing: ' . $missingCount . '</p>'; ?> ====z_listgen.php=== <?php // Get the current directory $directory = __DIR__; // Open the file for writing $file = fopen('z_list.txt', 'w'); // Get all files and directories in the current directory $items = scandir($directory); // Iterate through each item foreach ($items as $item) { // Exclude current and parent directory entries if ($item !== '.' && $item !== '..') { // Check if the item is a directory if (is_dir($directory . DIRECTORY_SEPARATOR . $item)) { // Write directory name to the file fwrite($file, $item . PHP_EOL); } else { // Write file name to the file fwrite($file, $item . PHP_EOL); } } } // Close the file fclose($file); echo 'File list generated and saved to z_list.txt.'; ?> __________________________ Find AnimexxUser+ (Artcount) --------------------------- <a target="_blank" href="?artistname=Nudelchen" style=color:lightgray>custom</a><br> <?php $url = 'https://www.animexx.de/fanart/zeichner/A/'; if (isset($_GET['artistname'])) { $artistname = $_GET['artistname']; $firstLetter = strtoupper(substr($artistname, 0, 1)); $url = str_replace('/zeichner/A/', '/zeichner/' . $firstLetter . '/', $url); } else { $artistname = 'Alcea'; } $html = file_get_contents($url); $pattern = '/<b><a href="\/fanart\/zeichner\/\d+\/">' . $artistname . '<\/a><\/b> \(\d+\)/'; preg_match_all($pattern, $html, $matches); if (!empty($matches[0])) { $artistLines = $matches[0]; $parsedUrl = parse_url($url); $domain = $parsedUrl['scheme'] . '://' . $parsedUrl['host']; foreach ($artistLines as $line) { // Prepend the domain to the href attribute within the $line $line = str_replace('href="/', 'href="' . $domain . '/', $line); $line = str_replace('<a ', '<a target="_blank" ', $line); echo $line . "<br>"; } } else { echo "No matching lines found for '{$artistname}'."; } ?> _________________ Fetch all pixiv user artwork links: ---------------------- <a target="_blank" href="?userId=18233080" style="color:blue">custom</a> <a target="_blank" href="?random" style="color:blue">(Random)</a><br> <div id="linkCount"></div><br> <?php function getPixivUserArt($userId, $random) { $apiUrl = "https://www.pixiv.net/ajax/user/{$userId}/profile/all?useid={$userId}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); if (isset($data['body']['illusts'])) { $artworks = $data['body']['illusts']; $numLinks = 0; // Variable to keep track of the number of links if ($random) { // Get a random artwork $randomArtId = array_rand($artworks); $randomArt = $artworks[$randomArtId]; $artLink = "https://www.pixiv.net/artworks/{$randomArtId}"; echo "Link: <a target=_blank href=\"{$artLink}\">{$artLink}</a><br>\n"; $numLinks++; // Increment the link counter } else { foreach ($artworks as $artId => $art) { $artLink = "https://www.pixiv.net/artworks/{$artId}"; echo "Link: <a target=_blank href=\"{$artLink}\">{$artLink}</a><br>\n"; $numLinks++; // Increment the link counter } } // Display the number of links found within the div echo "<script>document.getElementById('linkCount').innerHTML = 'Number of artworks: $numLinks';</script>"; } else { echo "No artworks found for the given user."; } } // Usage example $userId = isset($_GET['userId']) ? $_GET['userId'] : '75406576'; $random = isset($_GET['random']); getPixivUserArt($userId, $random); ?> ____________________________ Generate Linklist from folderpath ----------------------------------------------------- <?php $defaultDirectory = 'other/music/midi/piano/'; $directory = isset($_GET['path']) ? $_GET['path'] : $defaultDirectory; // Sanitize the directory path $directory = rtrim($directory, '/') . '/'; // Scan the directory for MIDI files $files = glob($directory . '*.mid'); // Create a linked list of target blank links $linkList = '<ul>'; foreach ($files as $file) { $filename = basename($file); $linkList .= '<li><a href="' . $file . '" target="_blank">' . $filename . '</a></li>'; } $linkList .= '</ul>'; // Output the linked list and the form echo '<form method="get" action="">'; echo 'Folder: <input type="text" name="path" value="' . $directory . '">'; echo '<input type="submit" value="Generate List">'; echo '</form>'; echo $linkList; ?> __________________________________ Enable Cors for folder (via .htaccess): ------------------------------------------------------------- # Add these three lines to CORSify your server for everyone. Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE" Header set Access-Control-Allow-Headers "Content-Type, Authorization" (source: https://gist.github.com/nixta/0b98d7975562bc31c4c9 ) __________________________________ Pkehex qrcode image team box render: ----------------------------------------------------------- <style> .grid { display: grid; grid-template-columns: repeat(10, 1fr); //grid-column-gap: -50px; grid-row-gap: 20px; /* Spaces between grid elements on the y-axis */ } .grid .image { width: 45px; height: 45px; background-size: 800% 800%; background-repeat: no-repeat; background-position: center -137px; cursor: pointer; transition: transform 0.2s; position: relative; margin-right: -5px; } .grid .image:hover { transform: scale(2); z-index: 2; //always hover above } .pokemon-name { position: absolute; bottom: -20px; left: 0; width: 100%; text-align: center; font-size: 12px; } #iframe-container { position: fixed; bottom: 10px; right: 10px; width: 300px; height: 200px; background-color: #f2f2f2; } #image-preview { width: 100%; height: 100%; object-fit: contain; } </style> </head> <body> <div class="grid"> <?php $folder = 'pkmn'; $files = glob($folder . '/*.jpg'); foreach ($files as $file) { $filename = basename($file); $pokemonName = substr($filename, 0, strpos($filename, '_')); echo '<div class="image" style="background-image: url(\'' . $file . '\');" onclick="displayImage(\'' . $file . '\')">'; echo '<div class="pokemon-name">' . $pokemonName . '</div>'; echo '</div>'; } ?> </div> <div id="iframe-container"> <a href="#" onclick="window.open(document.getElementById('image-preview').src, '_blank').focus(); return false;"><img id="image-preview" src="" alt="Preview"></a> </div> <script> function displayImage(imageUrl) { var imagePreview = document.getElementById('image-preview'); imagePreview.src = imageUrl; } </script> ____________________________________ Animexx Art parse: --------------------------------- <a target="_blank" href="?creator=1049853/" style=color:lightorange>custom</a><br><br> <!---<a target="_blank" href="https://www.animexx.de/fanart/zeichner/1248943/" style=color:blue>Cea</a>--> <a href="findlinksnimgsnquerystring.php" style=color:blue>[[0]]</a> <a href="?creator=1248943?seite=1" style=color:blue>[1]</a> <a href="?creator=1248943?seite=2" style=color:blue>[2]</a> <a href="?creator=1248943?seite=3" style=color:blue>[3]</a> <br><br> <?php error_reporting(0); // Disable error reporting if (@isset($_GET['seite']) && @isset($_GET['creator'])) { $seite = $_GET['seite']; $creator = $_GET['creator']; $url = ''; } elseif (@isset($_GET['seite'])) { $seite = $_GET['seite']; $url = 'https://www.animexx.de/fanart/zeichner/1248943/?seite=' . $seite; } elseif (@isset($_GET['creator'])) { $creator = $_GET['creator']; $url = 'https://www.animexx.de/fanart/zeichner/' . $creator . '/'; } else { $url = 'https://www.animexx.de/fanart/zeichner/1248943/'; } $baseurl = preg_replace('/\?.*/', '', $url); $newurl = str_replace("?seite=", "/?seite=", $url); echo "<a href='$newurl' target='_blank'>$newurl</a>"; //echo "<a href='$url' target='_blank'>$baseurl/?seite=' . $seite'</a>"; $html = @file_get_contents($url); $doc = new DOMDocument(); @$doc->loadHTML($html); $xpath = new DOMXPath($doc); $fathumbTags = $xpath->query('//td[@class="fathumb"]'); $fatitelTags = $xpath->query('//td[@class="fatitel"]'); $faextinfoTags = $xpath->query('//td[@class="faextinfo"]'); foreach ($fathumbTags as $index => $fathumbTag) { $href = @$fathumbTag->getElementsByTagName('a')->item(0)->getAttribute('href'); $imgSrc = @$fathumbTag->getElementsByTagName('img')->item(0)->getAttribute('src'); echo "<a href='$imgSrc$href' target='_blank'></a>"; $fatitelTag = @$fatitelTags->item($index); $title = @$fatitelTag->getElementsByTagName('b')->item(0)->textContent; echo "<br><a href='$baseurl/$href' target='_blank'><b>$title</b></a>"; $linkedHtml = @file_get_contents("$url$href"); $linkedDoc = new DOMDocument(); @$linkedDoc->loadHTML($linkedHtml); $linkedImgTag = @$linkedDoc->getElementsByTagName('img')->item(0); $linkedImgSrc = @$linkedImgTag->getAttribute('src'); echo "<br><img src='$linkedImgSrc' alt='Linked Image' style='width: 200px; height: auto;'>"; $faextinfoTag = @$faextinfoTags->item($index); $faextinfo = @$faextinfoTag->textContent; $faextinfo = preg_replace('/(\d)(?![\d.])/', '<br>$1', $faextinfo); $faextinfo = preg_replace("/(Note)/", "<br>$1", $faextinfo); echo "<br>$faextinfo"; echo "<br><br>"; } ?> -----TRASH---31\12\2023---- <!--- PD9waHAKJGRlZmF1bHRVcmwgPSAnaHR0cHM6Ly93d3cuYW5pbWV4eC5kZS9mYW5hcnQvemVpY2huZXIvMTI0ODk0My8nOwppZiAoaXNzZXQoJF9HRVRbJ2NyZWF0b3InXSkpIHsKICAgICRjcmVhdG9yID0gJF9HRVRbJ2NyZWF0b3InXTsKICAgICR1cmwgPSAkY3JlYXRvcjsKfSBlbHNlIHsKICAgICR1cmwgPSAkZGVmYXVsdFVybDsKfQokaHRtbCA9IGZpbGVfZ2V0X2NvbnRlbnRzKCR1cmwpOwokcGF0dGVybiA9ICcvPHRkIGNsYXNzPSJmYXRodW1iIiByb3dzcGFuPSIyIj48YVxzK2hyZWY9IihbXiJdKykiXHMrdGFyZ2V0PSIoW14iXSspIltePl0qPi8nOwpwcmVnX21hdGNoX2FsbCgkcGF0dGVybiwgJGh0bWwsICRtYXRjaGVzLCBQUkVHX1NFVF9PUkRFUik7Ci8vIENyZWF0ZSBhIERPTVhQYXRoIG9iamVjdAokZG9tID0gbmV3IERPTURvY3VtZW50KCk7CiRkb20tPmxvYWRIVE1MKCRodG1sKTsKJHhwYXRoID0gbmV3IERPTVhQYXRoKCRkb20pOwokcXVlcnkgPSAnLy90ZFtAY2xhc3M9ImZhZXh0aW5mbyJdJzsKJHRkRWxlbWVudHMgPSAkeHBhdGgtPnF1ZXJ5KCRxdWVyeSk7Ci8vIEl0ZXJhdGUgb3ZlciB0aGUgPHRkPiBlbGVtZW50cyBhbmQgZGlzcGxheSB0aGVpciBjb250ZW50CiR0ZENvbnRlbnRBcnJheSA9IFtdOwpmb3JlYWNoICgkdGRFbGVtZW50cyBhcyAkdGRFbGVtZW50KSB7CiAgICAkdGRDb250ZW50ID0gJHRkRWxlbWVudC0+b3duZXJEb2N1bWVudC0+c2F2ZUhUTUwoJHRkRWxlbWVudCk7CiAgICAkdGRDb250ZW50QXJyYXlbXSA9ICR0ZENvbnRlbnQ7Cn0KZm9yZWFjaCAoJG1hdGNoZXMgYXMgJGluZGV4ID0+ICRtYXRjaCkgewogICAgJGxpbmsgPSAkbWF0Y2hbMV07CiAgICAkdGFyZ2V0ID0gJG1hdGNoWzJdOwogICAgJHZhbGlkTGluayA9ICR1cmwgLiBsdHJpbSgkbGluaywgJy8nKTsKICAgICRsaW5rSHRtbCA9IGZpbGVfZ2V0X2NvbnRlbnRzKCR2YWxpZExpbmspOwogICAgJGltZ1BhdHRlcm4gPSAnLzxpbWdccytzcmM9IihbXiJdKykiXHMraWQ9ImZhbmFydF9pbWdfZ3Jvc3MiXHMrYWx0PSIoW14iXSspIltePl0qPi8nOwogICAgcHJlZ19tYXRjaCgkaW1nUGF0dGVybiwgJGxpbmtIdG1sLCAkaW1nTWF0Y2gpOwogICAgaWYgKGlzc2V0KCRpbWdNYXRjaFsxXSkgJiYgaXNzZXQoJGltZ01hdGNoWzJdKSkgewogICAgICAgICRpbWdTcmMgPSAkaW1nTWF0Y2hbMV07CiAgICAgICAgJGltZ0FsdCA9ICRpbWdNYXRjaFsyXTsKICAgICAgICBlY2hvICc8YnI+PGJyPjxhIGhyZWY9IicgLiAkdmFsaWRMaW5rIC4gJyIgdGFyZ2V0PSInIC4gJHRhcmdldCAuICciPicgLiAkdmFsaWRMaW5rIC4gJzwvYT48YnI+JzsKICAgICAgICBlY2hvICc8aW1nIHNyYz0iJyAuICRpbWdTcmMgLiAnIiBhbHQ9IicgLiAkaW1nQWx0IC4gJyIgd2lkdGg9NTAlPjxicj4nOwogICAgfQogICAgLy8gQ2hlY2sgaWYgdGhlcmUgaXMgYSBjb3JyZXNwb25kaW5nIGZhZXh0aW5mbyBlbnRyeQogICAgaWYgKGlzc2V0KCR0ZENvbnRlbnRBcnJheVskaW5kZXhdKSkgewogICAgICAgIGVjaG8gJHRkQ29udGVudEFycmF5WyRpbmRleF07CiAgICB9Cn0KPz4KCjx+fn5+fn5+fn5+fn53aXRob3V0IGZhZXRleHQgfn5+fn5+fn5+fn4+Cgo8YcKgdGFyZ2V0PSJfYmxhbmsiwqBocmVmPSI/Y3JlYXRvcj1odHRwczovL3d3dy5hbmltZXh4LmRlL2ZhbmFydC96ZWljaG5lci8xMDQ5ODUzLyLCoHN0eWxlPWNvbG9yOmxpZ2h0b3JhbmdlPmN1c3RvbTwvYT48YnI+PGJyPgo8P3BocAokZGVmYXVsdFVybMKgPcKgJ2h0dHBzOi8vd3d3LmFuaW1leHguZGUvZmFuYXJ0L3plaWNobmVyLzEyNDg5NDMvJzsKaWbCoChpc3NldCgkX0dFVFsnY3JlYXRvciddKSnCoHsKwqDCoMKgwqAkY3JlYXRvcsKgPcKgJF9HRVRbJ2NyZWF0b3InXTsKwqDCoMKgwqAkdXJswqA9wqAkY3JlYXRvcjsKfcKgZWxzZcKgewrCoMKgwqDCoCR1cmzCoD3CoCRkZWZhdWx0VXJsOwp9CiRodG1swqA9wqBmaWxlX2dldF9jb250ZW50cygkdXJsKTsKJHBhdHRlcm7CoD3CoCcvPHRkwqBjbGFzcz0iZmF0aHVtYiLCoHJvd3NwYW49IjIiPjxhXHMraHJlZj0iKFteIl0rKSJccyt0YXJnZXQ9IihbXiJdKykiW14+XSo+Lyc7CnByZWdfbWF0Y2hfYWxsKCRwYXR0ZXJuLMKgJGh0bWwswqAkbWF0Y2hlcyzCoFBSRUdfU0VUX09SREVSKTsKZm9yZWFjaMKgKCRtYXRjaGVzwqBhc8KgJG1hdGNoKcKgewrCoMKgwqDCoCRsaW5rwqA9wqAkbWF0Y2hbMV07CsKgwqDCoMKgJHRhcmdldMKgPcKgJG1hdGNoWzJdOwrCoMKgwqDCoCR2YWxpZExpbmvCoD3CoCR1cmzCoC7CoGx0cmltKCRsaW5rLMKgJy8nKTsKwqDCoMKgwqAkbGlua0h0bWzCoD3CoGZpbGVfZ2V0X2NvbnRlbnRzKCR2YWxpZExpbmspOwrCoMKgwqDCoCRpbWdQYXR0ZXJuwqA9wqAnLzxpbWdccytzcmM9IihbXiJdKykiXHMraWQ9ImZhbmFydF9pbWdfZ3Jvc3MiXHMrYWx0PSIoW14iXSspIltePl0qPi8nOwrCoMKgwqDCoHByZWdfbWF0Y2goJGltZ1BhdHRlcm4swqAkbGlua0h0bWwswqAkaW1nTWF0Y2gpOwrCoMKgwqDCoGlmwqAoaXNzZXQoJGltZ01hdGNoWzFdKcKgJibCoGlzc2V0KCRpbWdNYXRjaFsyXSkpwqB7CsKgwqDCoMKgwqDCoMKgwqAkaW1nU3JjwqA9wqAkaW1nTWF0Y2hbMV07CsKgwqDCoMKgwqDCoMKgwqAkaW1nQWx0wqA9wqAkaW1nTWF0Y2hbMl07CsKgwqDCoMKgwqDCoMKgwqBlY2hvwqAnPGHCoGhyZWY9IifCoC7CoCR2YWxpZExpbmvCoC7CoCciwqB0YXJnZXQ9IifCoC7CoCR0YXJnZXTCoC7CoCciPifCoC7CoCR2YWxpZExpbmvCoC7CoCc8L2E+PGJyPic7CsKgwqDCoMKgwqDCoMKgwqBlY2hvwqAnPGltZ8Kgc3JjPSInwqAuwqAkaW1nU3JjwqAuwqAnIsKgYWx0PSInwqAuwqAkaW1nQWx0wqAuwqAnIsKgd2lkdGg9NTAlPjxicj4nOwrCoMKgwqDCoH0KfQo/Pgo= --> ______________________ Mastodon extract preview_cards: ---------------------------------------------------- <?php $url = 'https://mastodon.social/api/v1/accounts/109977878421486714/statuses'; $parsedUrl = parse_url($url); $domain = $parsedUrl['scheme'] . '://' . $parsedUrl['host']; // Fetch data from the URL $response = file_get_contents($url); if ($response === false) { echo 'Error: Unable to fetch data.'; exit; } $previewCards = extractPreviewCardLinks($response); $html = generateImageTags($previewCards, $domain); echo 'Domain: ' . $domain . '<br>'; echo 'Preview Card Images:<br>'; echo $html; function extractPreviewCardLinks($responseText) { //$pattern = '/\/system\/cache\/preview_cards\/images\/\d+\/\d+\/\d+\/original\/[a-f0-9]+\.(?:jpg|jpeg|png|gif)/i'; //normal masstodon $pattern = '/\/cache\/preview_cards\/images\/\d{3}\/\d{3}\/\d{3}\/original\/[a-f0-9]+\.(?:jpg|jpeg|png|gif)/i'; //glitchfork suchas urusai.social preg_match_all($pattern, $responseText, $matches); return $matches[0] ?? []; } function generateImageTags($imageUrls, $domain) { $html = ''; foreach ($imageUrls as $imageUrl) { $domain = " https://files.mastodon.social"; $html .= '<img src="' .$domain . $imageUrl . '" alt="Preview Card Image"><br>'; } return $html; } ?> ________________________________ Deviantart latest images parse: ------------------------------------------------- <?php ob_start(); $ch = curl_init(); $username = $_GET['username']; // Get the username from the query string $url = 'https://www.deviantart.com/' . $username . '/gallery'; // Use the username in the URL $userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); $response = curl_exec($ch); curl_close($ch); $regex = '/window\.__INITIAL_STATE__ = (.*);$/m'; preg_match($regex, $response, $matches); $json = $matches[1]; $json = str_replace('JSON.parse("', '', $json); $json = substr($json, 0, -2); $json = str_replace('\"', '"', $json); $data = json_decode($json, true); if (isset($data['comments']['threaded']['results'])) { $comments = $data['comments']['threaded']['results']; foreach ($comments as $comment) { $commentId = $comment['commentId']; $commentBody = $comment['body']; echo "Comment ID: $commentId\n"; echo "Comment Body: $commentBody\n"; echo "===============\n"; } } echo "<pre>"; echo "Data:\n"; print_r($data); echo "</pre>"; file_put_contents('dauserinfo_' . $username . '.html', ob_get_contents()); ?> ========displayinfo.php=========== <?php // Get the username from the URL query string $username = $_GET['username']; $url = 'dauserinfo_' . $username . '.html'; // Retrieve the content from the URL $content = file_get_contents($url); $lines = explode("\n", $content); $matchingLines = []; $keywords = ['[url]', '[comments]', '[favourites]', '[views]', '[publishedTime]']; foreach ($lines as $line) { foreach ($keywords as $keyword) { if (strpos($line, $keyword) !== false) { if ($keyword === '[url]' && strpos($line, $username) === false) { //if ($keyword === '[url]' && strpos($line, 'art') === false) { break; } $matchingLines[$line] = true; break; } } } // Display the matching lines foreach ($matchingLines as $line => $value) { echo $line . '<br>'; } ?> _______________________________________ Show newest file in dir + modify date ------------------------------------------------ <?php $files = glob('*'); // Get all files in the current directory $newestFile = null; $newestTime = 0; foreach ($files as $file) { if (is_file($file)) { // Check if the item is a file $fileExtension = pathinfo($file, PATHINFO_EXTENSION); $fileName = pathinfo($file, PATHINFO_FILENAME); if ($fileExtension === 'zip' || $fileExtension === 'php' || strpos($fileName, 'error_log') !== false) { continue; } $fileTime = filemtime($file); // Get the last modified timestamp of the file if ($fileTime > $newestTime) { $newestTime = $fileTime; $newestFile = $file; } } } if ($newestFile !== null) { $lastModified = date("Y-m-d", $newestTime); // Format the last modified timestamp as yyyy-mm-dd $link = htmlspecialchars($newestFile); // Sanitize the filename for use in the hyperlink echo "<a href='$link' target='_blank'>$link</a> - Last modified: $lastModified"; } ?> _____________________________ Fetch Steam Library (and allow json dld): ------------------------------------------ <a target="_blank" href="?steam_id=76561198119673186&api_key=apikey">Custom</a> (<a target="_blank" href="https://steamcommunity.com/login/home/?goto=%2Fdev%2Fapikey" style="color:grey">Get ApiKey</a>) <!DOCTYPE html> <html> <head> <title>Steam Library Viewer</title> <style> table { border-collapse: collapse; } table, th, td { border: 1px solid #ccc; padding: 8px; } </style> </head> <body> <table id="steamLibrary"> <thead> <tr> <th>Game Name</th> <th>Playtime (minutes)</th> <th>Purchase Date</th> <th>Price (Current)</th> <th>Last Played</th> </tr> </thead> <tbody> <?php // Replace 'YOUR_API_KEY' with your actual Steam API key $apiKey = isset($_GET['api_key']) ? $_GET['api_key'] : 'F96D40C8F7FA9C51B204D4707E0A094B'; $steamId = isset($_GET['steam_id']) ? $_GET['steam_id'] : '76561198119673186'; // Construct the API URL to fetch the user's Steam library data $libraryApiUrl = "https://api.steampowered.com/IPlayerService/GetOwnedGames/v1/?key={$apiKey}&steamid={$steamId}&include_appinfo=1&include_played_free_games=1"; // Fetch the user's Steam library data $libraryResponse = file_get_contents($libraryApiUrl); $libraryData = json_decode($libraryResponse, true); if ($libraryData && isset($libraryData['response']['games'])) { $games = $libraryData['response']['games']; if (!empty($games)) { // Sort the games array alphabetically by game name usort($games, function($a, $b) { return strcmp($a['name'], $b['name']); }); foreach ($games as $game) { $appId = $game['appid']; $appName = $game['name']; $playtimeMinutes = $game['playtime_forever']; $purchaseDate = isset($game['purchase_date']) ? date('Y-m-d', $game['purchase_date']) : 'Unknown'; $rtimeLastPlayed = isset($game['rtime_last_played']) ? date('Y-m-d', $game['rtime_last_played']) : 'Unknown'; // Construct the API URL to fetch the purchase information for the game $purchaseApiUrl = "https://store.steampowered.com/api/appdetails?appids={$appId}"; // Fetch the purchase information for the game $purchaseResponse = file_get_contents($purchaseApiUrl); $purchaseData = json_decode($purchaseResponse, true); if ($purchaseData && isset($purchaseData[$appId]['data']['price_overview'])) { $priceOverview = $purchaseData[$appId]['data']['price_overview']; $price = number_format($priceOverview['final'] / 100, 2) . ' €'; // Convert price to Euros } else { $price = 'Unknown'; } echo '<tr>'; echo "<td>{$appName}</td>"; echo "<td>{$playtimeMinutes}</td>"; echo "<td>{$purchaseDate}</td>"; echo "<td>{$price}</td>"; echo "<td>{$rtimeLastPlayed}</td>"; echo '</tr>'; } } else { echo '<tr><td colspan="5">No games found in the Steam library.</td></tr>'; } } else { echo '<tr><td colspan="5">Error retrieving Steam library.</td></tr>'; } ?> </tbody> </table> <form action="download.php" method="post"> <input type="hidden" name="libraryData" value="<?php echo htmlspecialchars(json_encode($libraryData)); ?>"> <button type="submit">Download as JSON</button> </form> </body> </html> ====download.php=== <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['libraryData'])) { $libraryData = $_POST['libraryData']; // Set the appropriate headers for file download header('Content-Type: application/json'); header('Content-Disposition: attachment; filename="steam_library.json"'); // Output the library data as a JSON file echo $libraryData; exit; } } // Redirect back to the previous page if the library data is not available header('Location: ' . $_SERVER['HTTP_REFERER']); ?> __________________________________ Open mastodon url in home instance: ------------------------------------------------ <a href="?search=https://sunny.garden/@Iva852/109293246960188756&pbUrl=https://pb.todon.de&apikey=apikey">test</a><br> <?php // Check if the API key is submitted if (isset($_POST['apikey'])) { $apiKey = $_POST['apikey']; $pbUrl = $_POST['pbUrl']; $search = $_POST['url']; $url = $pbUrl . '/api/v2/search/?q=' . urlencode($search) . '&limit=1&resolve=true'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $apiKey ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } curl_close($ch); $data = json_decode($response, true); if (isset($data['statuses'][0]['id'])) { $id = $data['statuses'][0]['id']; $urlParts = parse_url($search); $pathParts = explode('/', trim($urlParts['path'], '/')); $username = $pathParts[0]; $domain = $urlParts['host']; $newUrl = $pbUrl . '/' . $username . '@' . $domain . '/' . $id; echo 'New URL: <a id="newUrlLink" href="' . $newUrl . '">' . $newUrl . '</a>'; echo '<script>document.getElementById("newUrlLink").click();</script>'; } else { echo 'Please enter a URL'; echo '<br>cURL Result: ' . $response; echo '<br>' . $url; echo '<br><a target="_blank" href="https://codepen.io/ryedai1/full/WNYZBya">Lookup</a>'; } } ?> <!-- HTML form to input the API key, $pbUrl, and URL --> <form method="POST" action=""> <label for="apikey">API Key:</label> <input type="text" id="apikey" name="apikey" required> <br> <label for="pbUrl">pbUrl:</label> <input type="text" id="pbUrl" name="pbUrl" required> <br> <label for="url">URL:</label> <input type="text" id="url" name="url" pattern="https://.*" required> <input type="submit" value="Submit"> </form> <script> window.onload = function () { const urlParams = new URLSearchParams(window.location.search); const search = urlParams.get("search"); const pbUrl = urlParams.get("pbUrl"); const apiKey = urlParams.get("apikey"); if (search && pbUrl && apiKey) { document.getElementById("apikey").value = apiKey; document.getElementById("pbUrl").value = pbUrl; if (search.includes("http")) {document.getElementById("url").value = search;} // Check if query parameter 'submitted' is present if (!urlParams.has("submitted")) { // Add 'submitted' query parameter to prevent resubmission urlParams.set("submitted", "true"); const newUrl = window.location.pathname + "?" + urlParams.toString(); window.history.replaceState(null, null, newUrl); document.forms[0].submit(); } } const observer = new MutationObserver(function (mutationsList) { for (let mutation of mutationsList) { if ( mutation.type === "childList" && mutation.addedNodes.length > 0 ) { const newUrlElements = document.querySelectorAll( 'body :not(script):not(style):not(link):not(meta):not(base):not(title):contains("New URL:")' ); for (let element of newUrlElements) { const linkElement = element.nextElementSibling; if (linkElement.tagName === "A") { linkElement.addEventListener("click", function (event) { event.preventDefault(); window.open(linkElement.href, "_blank"); }); } } } } }); observer.observe(document.body, { childList: true, subtree: true }); }; </script> <!----FillFromClipboard---> <button class="button" onclick="fillTextbox()">Fill Textbox</button> <script> function fillTextbox() { navigator.clipboard.readText().then(function(clipboardText) { document.getElementById("url").value = clipboardText; var submitButton = document.querySelector('input[type="submit"], button[type="submit"]'); submitButton?.click(); }).catch(function(error) { console.error('Failed to read clipboard contents: ', error); }); } </script><br> __________________________ Zip current dir ---------------------- <?php $zip = new ZipArchive(); $zipFileName = 'alceawis.de.zip'; $intermediateFolderName = pathinfo($zipFileName, PATHINFO_FILENAME); if ($zip->open($zipFileName, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('.', RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY ); foreach ($files as $name => $file) { if (!$file->isDir()) { $filePath = $file->getRealPath(); $relativePath = $intermediateFolderName . '/' . substr($filePath, strlen(__DIR__) + 1); $zip->addFile($filePath, $relativePath); } } $zip->close(); $downloadLink = '<a href="' . $zipFileName . '">Click here to download the zip file</a>'; echo 'Files zipped successfully. ' . $downloadLink; } else { echo 'Failed to create zip file.'; } ?> <!---delete--> <?php $file = 'alceawis.de.zip'; if (isset($_GET['delete'])) { if (file_exists($file)) { unlink($file); echo "File deleted successfully."; } else { echo "File not found."; } } ?> <a href="?delete=true">Click here to delete zip</a> ______________________________ Delete folder if link is clicked: -------------------------------------- <?php if (isset($_GET['delete']) && is_dir('website') && shell_exec('rm -rf website')) echo 'Folder deleted.'; ?><a href="?delete">Del code</a> _________________________ Fetch and render *.zip url (use zipstream php for extractless render): --------------------------------------- <?php $files = glob("*.zip"); // Get all zip files in the current folder if (!empty($files)) { $zipFile = $files[0]; // Assuming you want to delete the first zip file found unlink($zipFile); // echo "The zip file '$zipFile' has been deleted."; } else { //echo "No zip files found in the current folder."; } ?> <!------Star-Zip-Fetch---> <form method="post" action=""> <label for="zipUrl">Enter ZIP URL:</label> <input type="text" name="zipUrl" id="zipUrl" value="http://ry3yr.github.io/alceawis.de.zip" required> <br> <!---<label for="downloadPath">Download Path:</label>---> <!--<input type="text" name="downloadPath" id="downloadPath" placeholder="Enter download path (optional)">--> <br> <input type="submit" name="download" value="Download and Render"> </form> <?php if (isset($_POST['download'])) { $url = $_POST['zipUrl']; $filename = basename($url); // Check if the download path textbox is filled if (!empty($_POST['downloadPath'])) { $downloadPath = $_POST['downloadPath']; $filename = $downloadPath . '/' . $filename; } else { $filename = './' . $filename; // Set a default path if download path is not specified } // Validate the URL if (filter_var($url, FILTER_VALIDATE_URL)) { try { // Use cURL to download the file $ch = curl_init($url); $fp = fopen($filename, 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects curl_setopt($ch, CURLOPT_MAXREDIRS, 5); // Maximum number of redirects to follow curl_exec($ch); // Check if the download was successful $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode == 200) { $message = "File downloaded successfully."; } else { $message = "Failed to download the file. HTTP code: " . $httpCode; } curl_close($ch); fclose($fp); } catch (Exception $e) { $message = "An error occurred during the download: " . $e->getMessage(); } // Check for cURL errors if (curl_errno($ch)) { $message = "cURL error: " . curl_error($ch); } } else { $message = "Invalid URL."; } } ?> <p><?php echo $message ?? ''; ?></p> </body> </html> <!---Start--Extract--> <?php $zipFiles = glob("*.zip"); // Get all ZIP files in the current directory if (!empty($zipFiles)) { $extractPath = "website"; // Destination folder // Make sure the extraction path exists if (!is_dir($extractPath)) { mkdir($extractPath, 0777, true); } foreach ($zipFiles as $zipFile) { $zip = new ZipArchive; if ($zip->open($zipFile) === TRUE) { // Extract the files directly into the destination folder $zip->extractTo($extractPath); $zip->close(); //echo "ZIP file '$zipFile' extracted successfully.<br>"; } else { echo "Failed to open the ZIP file '$zipFile'.<br>"; } } } else { echo "No ZIP files found in the current directory."; } ?> <?php $websiteFolder = "website"; // Replace with the name of the "website" folder // Check if the "website" folder exists if (is_dir($websiteFolder)) { // Get the first subfolder inside the "website" folder $subfolders = glob($websiteFolder . '/*', GLOB_ONLYDIR); if (!empty($subfolders)) { $firstSubfolder = $subfolders[0]; // Find the "index.html" file inside the subfolder $indexFile = $firstSubfolder . '/index.html'; if (file_exists($indexFile)) { // Open the "index.html" file as a URL in a new tab or window //echo '<script>window.open("' . $indexFile . '", "_blank");</script>'; } else { echo 'The "index.html" file was not found.'; } } else { echo 'No subfolders found inside the "website" folder.'; } } else { echo 'The "website" folder does not exist.'; } ?> <!---last-site--> <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $websiteFolder = 'website'; // Retrieve the subfolders within the website folder $subfolders = array_diff(scandir($websiteFolder), array('..', '.')); // Get the first subfolder $firstSubfolder = reset($subfolders); $indexUrl = $websiteFolder . '/' . $firstSubfolder . '/index.html'; echo '<a href="' . $indexUrl . '" target="_blank">Open ' . $indexUrl . '</a>'; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <button type="submit">Get First Subfolder</button> </form> _________________________ YGO Wikia setlistfetch: ----------------------------------- <a href="setlistfetch.php">image ver</a><br><br> <?php error_reporting(0); ?> <div class="pre-spoiler"><input name="Deutsch" type="button" onClick="if (this.parentNode.getElementsByTagName('div')[0].style.display != 'none') { this.parentNode.getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Releases'; } else { this.parentNode.getElementsByTagName('div')[0].style.display = 'block'; this.value = 'Releases';}" value="Releases" style="background:; border:none; color:;"><div class="spoiler" style="display: none;" > <!---SetList--> <?php $url = 'https://yugioh.fandom.com/wiki/Yu-Gi-Oh!_Wiki'; $html = file_get_contents($url); $start = strpos($html, 'h3><span class="mw-headline" id="TCG"><i>TCG</i></span></h3>'); $end = strpos($html, '<span class="mw-headline" id="Anime"', $start); $length = $end - $start; $result = substr($html, $start, $length); $baseUrl = parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST); $fixedResult = str_replace('href="/', 'href="'.$baseUrl.'/', $result); $fixedResult = str_replace('<a', '<a target="_blank"', $fixedResult); // Add target="_blank" echo $fixedResult; ?> </div><br> <script> async function pasteFromClipboard() { try { if (navigator.clipboard) { const text = await navigator.clipboard.readText(); document.getElementById('url').value = text; document.getElementById('submitButton').click(); } else { alert('Clipboard API is not supported in this browser.'); } } catch (err) { console.error('Failed to read clipboard contents: ', err); } } </script> <unique> <button onclick="savePageAsHTML()">Save Page as HTML</button> <script> function savePageAsHTML() { var placeholder = document.querySelector('unique'); placeholder.parentNode.removeChild(placeholder); var html = document.documentElement.outerHTML; var filename = 'setlist.html'; var element = document.createElement('a'); element.setAttribute('href', 'data:text/html;charset=utf-8,' + encodeURIComponent(html)); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); document.body.appendChild(placeholder); } </script> </unique> <?php // Default URL of the page to scrape $defaultUrl = 'https://yugioh.fandom.com/wiki/Set_Card_Lists:Labyrinth_of_Nightmare_(TCG-EN)'; // Check if a URL is submitted via POST $url = isset($_POST['url']) ? $_POST['url'] : $defaultUrl; // Fetch the HTML content $htmlContent = file_get_contents($url); // Load the HTML content using DOMDocument $dom = new DOMDocument; libxml_use_internal_errors(true); $dom->loadHTML($htmlContent); libxml_clear_errors(); // Create a new XPath object $xpath = new DOMXPath($dom); // Query for the table rows $rows = $xpath->query('//table[@class="fandom-table sortable card-list"]//tr'); // Initialize an empty array to hold the table data $tableData = []; // Loop through the rows and extract the data foreach ($rows as $row) { $cols = $row->getElementsByTagName('td'); $rowData = []; foreach ($cols as $index => $col) { // Check if the column contains a link (for the name column) if ($index == 1 && $col->getElementsByTagName('a')->length > 0) { $link = $col->getElementsByTagName('a')->item(0); $href = $link->getAttribute('href'); $text = $link->textContent; $rowData[] = '<a href="https://yugioh.fandom.com' . htmlspecialchars($href) . '" target="_blank">' . htmlspecialchars($text) . '</a>'; // Add the detail link for the iframe $rowData[] = '<button onclick="toggleIframe(this, \'https://yugioh.fandom.com' . htmlspecialchars($href) . '\')">Details</button>'; //$rowData[] = '<button onclick="toggleIframe(this, \'https://alcea-wisteria.de/PHP/0demo/2023-10-08-Fetch-yugioh-wikia-set-list/fetch_single_card.php?card=https://yugioh.fandom.com' . htmlspecialchars($href) . '\')">Details</button>'; } else { $rowData[] = trim($col->textContent); } } if (!empty($rowData)) { $tableData[] = $rowData; } } // Display the form and table data echo ' <form method="post"> <label for="url">Enter URL:</label> <input type="text" id="url" name="url" value="' . htmlspecialchars($url) . '"> <input type="submit" id="submitButton" value="Submit"> <button type="button" onclick="pasteFromClipboard()">Paste and Submit</button> </form>'; echo '<table border="1" id="cardTable">'; echo '<tr><th>Card number</th><th>Name</th><th>Rarity</th><th>Category</th><th>Detail</th></tr>'; foreach ($tableData as $rowData) { echo '<tr>'; foreach ($rowData as $cellData) { echo '<td>' . $cellData . '</td>'; } echo '</tr>'; } echo '</table>'; // Add the JavaScript for toggling the iframe echo ' <script> function toggleIframe(button, url) { // Remove any existing iframes var iframes = document.querySelectorAll("iframe.detailIframe"); iframes.forEach(function(iframe) { iframe.remove(); }); // Create a new iframe var iframe = document.createElement("iframe"); iframe.src = url; iframe.className = "detailIframe"; iframe.style.width = "100%"; iframe.style.height = "400px"; // Insert the iframe below the current row var row = button.parentElement.parentElement; var newRow = document.createElement("tr"); var newCell = document.createElement("td"); newCell.colSpan = 5; newCell.appendChild(iframe); newRow.appendChild(newCell); row.parentNode.insertBefore(newRow, row.nextSibling); } </script> '; ?> <!--broken--2024/07-21-- <div class="pre-spoiler"><input name="Deutsch" type="button" onClick="if (this.parentNode.getElementsByTagName('div')[0].style.display != 'none') { this.parentNode.getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Releases'; } else { this.parentNode.getElementsByTagName('div')[0].style.display = 'block'; this.value = 'Releases';}" value="Releases" style="background:; border:none; color:;"><div class="spoiler" style="display: none;" > <?php $url = 'https://yugioh.fandom.com/wiki/Yu-Gi-Oh!_Wiki'; $html = file_get_contents($url); $start = strpos($html, 'h3><span class="mw-headline" id="TCG"><i>TCG</i></span></h3>'); $end = strpos($html, '<span class="mw-headline" id="Anime"', $start); $length = $end - $start; $result = substr($html, $start, $length); $baseUrl = parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST); $fixedResult = str_replace('href="/', 'href="'.$baseUrl.'/', $result); $fixedResult = str_replace('<a', '<a target="_blank"', $fixedResult); // Add target="_blank" echo $fixedResult; ?> </div><br> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="url">Enter the URL:</label> <input type="text" name="url" id="url" required> <input type="submit" value="Retrieve"> </form> <unique> <button onclick="savePageAsHTML()">Save Page as HTML</button> <script> function savePageAsHTML() { var placeholder = document.querySelector('unique'); placeholder.parentNode.removeChild(placeholder); var html = document.documentElement.outerHTML; var filename = 'setlist.html'; var element = document.createElement('a'); element.setAttribute('href', 'data:text/html;charset=utf-8,' + encodeURIComponent(html)); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); document.body.appendChild(placeholder); } </script> </unique> <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $url = $_POST['url']; $doc = new DOMDocument(); $doc->loadHTMLFile($url); $xpath = new DOMXPath($doc); $table = $xpath->query('//table[@id="Top_table"]')->item(0); if ($table) { $parsedUrl = parse_url($url); $baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host']; $tableRows = []; $rows = $table->getElementsByTagName('tr'); foreach ($rows as $row) { $cells = $row->getElementsByTagName('td'); if ($cells->length >= 3) { $nameCell = $cells->item(1); $nameLink = $nameCell->getElementsByTagName('a')->item(0); $name = ''; $nameUrl = ''; if ($nameLink) { $name = trim($nameLink->textContent); $nameRelativeUrl = $nameLink->getAttribute('href'); $nameUrl = $baseUrl . $nameRelativeUrl; } $categoryCell = $cells->item(3); $category = ''; if ($categoryCell) { $category = trim($categoryCell->textContent); } $tableRows[] = [ 'name' => $name, 'category' => $category, 'nameUrl' => $nameUrl ]; } } echo '<div class="table-body">'; foreach ($tableRows as $row) { echo '<div class="table-row" data-sort-value="' . $row['name'] . '" data-sort-category="' . $row['category'] . '">'; echo 'Name: <a href="' . $row['nameUrl'] . '" target="_blank">' . $row['name'] . '</a> | Category: ' . $row['category']; // Perform cURL request to retrieve content from $nameUrl $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $row['nameUrl']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'); $response = curl_exec($curl); if ($response === false) { die('Error: ' . curl_error($curl)); } curl_close($curl); $startPos = strpos($response, '<table class="cardtable cardtable-link">'); $endPos = strpos($response, '</tbody></table><table class="navbox hlist">'); if ($startPos !== false) { $content = substr($response, $startPos, $endPos - $startPos); } else { $fallbackStartPos = strpos($response, '<table class="cardtable">'); $fallbackEndPos = strpos($response, '</table>', $fallbackStartPos); if ($fallbackStartPos !== false && $fallbackEndPos !== false) { $content = substr($response, $fallbackStartPos, $fallbackEndPos - $fallbackStartPos + 8); } } if (!empty($content)) { $uniqueDivId = 'div_' . uniqid(); // Generate unique ID for each div echo '<details><div id="' . $uniqueDivId . '"></div></details>'; $doc = new DOMDocument(); $doc->encoding = 'UTF-8'; // Set the character encoding $doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')); // Convert the content to UTF-8 // Update links in anchor tags $anchorTags = $doc->getElementsByTagName('a'); foreach ($anchorTags as $anchorTag) { $href = $anchorTag->getAttribute('href'); if (!empty($href) && !filter_var($href, FILTER_VALIDATE_URL)) { $href = $baseUrl . $href; // Construct absolute URL for the link $anchorTag->setAttribute('href', $href); $anchorTag->setAttribute('target', '_blank'); // Add "target=_blank" attribute } } // Update links in image tags $imageTags = $doc->getElementsByTagName('img'); foreach ($imageTags as $imageTag) { $imageUrl = $imageTag->getAttribute('src'); $imageData = file_get_contents($imageUrl); if ($imageData !== false) { $base64Image = base64_encode($imageData); $imageTag->setAttribute('src', 'data:image/png;base64,' . $base64Image); } } $content = $doc->saveHTML(); //echo $modifiedContent; echo '<script type="text/javascript">'; echo 'document.getElementById("' . $uniqueDivId . '").innerHTML = ' . json_encode($content) . ';'; echo '</script>'; } else { echo "Content not found."; } echo '</div>'; } echo '</div>'; //echo '<button id="sort_by_name_button">Sort by Name</button>'; //echo '<button id="sort_by_category_button">Sort by Category</button>'; } else { echo "Table not found."; } } ?> ____________________________________ URL Page Source Display: --------------------------------------- <?php if(isset($_POST['submit'])) { // Get the URL from the textbox $url = $_POST['url']; // Fetch the source code of the URL $sourceCode = file_get_contents($url); } ?> <!DOCTYPE html> <html> <head> <title>URL Source Code Viewer</title> </head> <body> <form method="POST"> <label for="url">Enter URL:</label> <input type="text" name="url" id="url" required> <br> <input type="submit" name="submit" value="Submit"> </form> <?php if(isset($_POST['submit'])): ?> <div style="margin-top: 20px;"> <h2>Source Code:</h2> <div><textarea cols="80" rows="10"><?php echo $sourceCode; ?></textarea></div> </div> <?php endif; ?> </body> </html> ____________________________________ Duplicate Subdir File Finder (& deleter) ----------------------------------------------------------- <?php function scanDirectories($dir) { $fileList = []; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied" errors ); foreach ($iterator as $path => $fileInfo) { if ($fileInfo->isFile()) { $size = $fileInfo->getSize(); $fileList[$size][] = $path; } } return $fileList; } function deleteFile($filePath) { if (is_file($filePath)) { unlink($filePath); echo "Deleted: " . $filePath . "\n"; } } function deleteDuplicateFiles($dir) { $currentDir = getcwd(); // Get the current working directory chdir($dir); // Change the current working directory to the specified directory $fileList = scanDirectories('.'); // Scan the subdirectories from the current directory $filesToDelete = []; foreach ($fileList as $size => $files) { if (count($files) > 1) { $fileCount = count($files); for ($i = 1; $i < $fileCount; $i++) { $filePath = $files[$i]; if (is_file($filePath)) { $filesToDelete[] = $filePath; } } } } if (count($filesToDelete) > 0) { echo "Found duplicate files:<br>"; foreach ($filesToDelete as $filePath) { echo '<a href="?delete=' . urlencode($filePath) . '">' . $filePath . '</a><br>'; } if (isset($_GET['delete'])) { $fileToDelete = urldecode($_GET['delete']); deleteFile($fileToDelete); } } else { echo "No duplicate files found.\n"; } chdir($currentDir); // Change the working directory back to the original directory } // Usage example $directory = getcwd(); // Set the starting path to the current directory deleteDuplicateFiles($directory); ?> _________________________________ Inbrowser PDF Render (JS + php) -------------------------------------- <!DOCTYPE html> <html> <head> <title>PDF Viewer</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.js"></script> </head> <body> <label for="pdf-upload">Upload PDF:</label> <input type="file" id="pdf-upload" accept="application/pdf"/> <label for="pdf-url">PDF URL:</label> <input type="text" id="pdf-url" placeholder="Enter PDF URL"/> <button id="load-pdf">Load PDF</button> <button id="zoom-in" style="background:transparent; border:transparent;display: none;">Zoom In</button> <div id="zoom-percent" style="background:transparent; border:transparent;display: none;">60</div> <button id="zoom-out" style="background:transparent; border:transparent;display: none;">Zoom Out</button> <button id="zoom-reset" style="background:transparent; border:transparent;display: none;">Reset Zoom</button> <div id="pages"></div> <script> pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.worker.js'; document.querySelector("#pdf-upload").addEventListener("change", function(e){ document.querySelector("#pages").innerHTML = ""; zoomReset(); var file = e.target.files[0] if(file.type != "application/pdf"){ alert(file.name + " is not a pdf file.") return } var fileReader = new FileReader(); fileReader.onload = function() { var typedarray = new Uint8Array(this.result); pdfjsLib.getDocument(typedarray).promise.then(function(pdf) { // you can now use *pdf* here console.log("the pdf has", pdf.numPages, "page(s)."); for (var i = 0; i < pdf.numPages; i++) { (function(pageNum){ pdf.getPage(i+1).then(function(page) { // you can now use *page* here var viewport = page.getViewport(2.0); var pageNumDiv = document.createElement("div"); pageNumDiv.className = "pageNumber"; pageNumDiv.innerHTML = "Page " + pageNum; var canvas = document.createElement("canvas"); canvas.className = "page"; canvas.title = "Page " + pageNum; document.querySelector("#pages").appendChild(pageNumDiv); document.querySelector("#pages").appendChild(canvas); canvas.height = viewport.height; canvas.width = viewport.width; page.render({ canvasContext: canvas.getContext('2d'), viewport: viewport }).promise.then(function(){ console.log('Page rendered'); }); page.getTextContent().then(function(text){ console.log(text); }); }); })(i+1); } }); }; fileReader.readAsArrayBuffer(file); }); document.querySelector("#load-pdf").addEventListener("click", function(){ document.querySelector("#pages").innerHTML = ""; zoomReset(); var url = document.querySelector("#pdf-url").value.trim(); if (!url) { alert("Please enter a PDF URL."); return; } if (!url.endsWith(".pdf")) { alert("Please enter a valid PDF URL."); return; } fetch('fetch_pdf.php?url=' + encodeURIComponent(url)).then(function(response) { if (!response.ok) { throw new Error(response.statusText); } return response.arrayBuffer(); }).then(function(buffer) { pdfjsLib.getDocument(buffer).promise.then(function(pdf) { // you can now use *pdf* here console.log("the pdf has", pdf.numPages, "page(s)."); for (var i = 0; i < pdf.numPages; i++) { (function(pageNum){ pdf.getPage(i+1).then(function(page) { // you can now use *page* here var viewport = page.getViewport(2.0); var pageNumDiv = document.createElement("div"); pageNumDiv.className = "pageNumber"; pageNumDiv.innerHTML = "Page " + pageNum; var canvas = document.createElement("canvas"); canvas.className = "page"; canvas.title = "Page " + pageNum; document.querySelector("#pages").appendChild(pageNumDiv); document.querySelector("#pages").appendChild(canvas); canvas.height = viewport.height; canvas.width = viewport.width; page.render({ canvasContext: canvas.getContext('2d'), viewport: viewport }).promise.then(function(){ console.log('Page rendered'); }); page.getTextContent().then(function(text){ console.log(text); }); }); })(i+1); } }); }).catch(function(error) { console.error('Error occurred while fetching the PDF: ' + error); }); }); function zoomIn() { var scale = parseFloat(document.querySelector("#zoom-percent").textContent); scale = scale + 10; if (scale > 200) { scale = 200; } document.querySelector("#zoom-percent").textContent = scale; updateZoomButtons(); updateZoom(scale); } function zoomOut() { var scale = parseFloat(document.querySelector("#zoom-percent").textContent); scale = scale - 10; if (scale < 50) { scale = 50; } document.querySelector("#zoom-percent").textContent = scale; updateZoomButtons(); updateZoom(scale); } function zoomReset() { var scale = 100; document.querySelector("#zoom-percent").textContent = scale; updateZoomButtons(); updateZoom(scale); } function updateZoomButtons() { var scale = parseFloat(document.querySelector("#zoom-percent").textContent); var zoomInButton = document.querySelector("#zoom-in"); var zoomOutButton = document.querySelector("#zoom-out"); if (scale >= 200) { zoomInButton.style.display = "none"; } else { zoomInButton.style.display = "inline-block"; } if (scale <= 50) { zoomOutButton.style.display = "none"; } else { zoomOutButton.style.display = "inline-block"; } } function updateZoom(scale) { var pages = document.querySelectorAll(".page"); for (var i = 0; i < pages.length; i++) { var canvas = pages[i]; var context = canvas.getContext("2d"); var viewport = canvas.pdfPage.getViewport({ scale: scale / 100 }); canvas.width = viewport.width; canvas.height = viewport.height; canvas.style.width = viewport.width + "px"; canvas.style.height = viewport.height + "px"; canvas.pdfPage.render({ canvasContext: context, viewport: viewport }); } } document.querySelector("#zoom-in").addEventListener("click", zoomIn); document.querySelector("#zoom-out").addEventListener("click", zoomOut); document.querySelector("#zoom-reset").addEventListener("click", zoomReset); </script> </body> </html> <!--"fetch_pdf.php"> <?php // Get the URL parameter $url = $_GET['url']; // Initialize cURL $curl = curl_init(); // Set cURL options curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); // Execute the cURL request $response = curl_exec($curl); // Check for errors if ($response === false) { die('Error fetching PDF: ' . curl_error($curl)); } // Close cURL curl_close($curl); // Set the appropriate headers header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="document.pdf"'); header('Content-Length: ' . strlen($response)); // Output the PDF content echo $response; ?> _____________________________ iFrame curr php dir + CacheBusting ----------------------------------------------- <iframe src="<?= dirname($_SERVER['PHP_SELF']); ?>?timestamp=<?= time(); ?>" width="1200" height="600" frameborder="0"></iframe> _____________________________ Github master downloader ------------------------------------------ <?php $currentPath = $_SERVER['PHP_SELF']; $directoryPath = dirname($currentPath); echo "Current directory path: " . $directoryPath; ?><br> <?php $transformedUrl = ''; if (isset($_POST['submit'])) { $url = $_POST['url']; // Check if the URL matches the specific GitHub URL pattern if (preg_match('/^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/?$/', $url, $matches)) { $owner = $matches[1]; $repo = $matches[2]; $url = "https://github.com/{$owner}/{$repo}/archive/refs/heads/main.zip"; $transformedUrl = $url; $filename = "{$repo}-main.zip"; // Set the filename // Check if the download path textbox is filled if (!empty($_POST['download_path'])) { $downloadPath = $_POST['download_path']; $filename = $downloadPath . '/' . $filename; } else { $filename = './' . $filename; // Set a default path if download path is not specified } } else { $filename = basename($url); // Extract the filename from the URL // Check if the download path textbox is filled if (!empty($_POST['download_path'])) { $downloadPath = $_POST['download_path']; $filename = $downloadPath . '/' . $filename; } else { $filename = './' . $filename; // Set a default path if download path is not specified } } // Validate the URL if (filter_var($url, FILTER_VALIDATE_URL)) { try { // Use cURL to download the file $ch = curl_init($url); $fp = fopen($filename, 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects curl_setopt($ch, CURLOPT_MAXREDIRS, 5); // Maximum number of redirects to follow curl_exec($ch); // Check if the download was successful $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode == 200) { $message = "File downloaded successfully."; } else { $message = "Failed to download the file. HTTP code: " . $httpCode; } curl_close($ch); fclose($fp); } catch (Exception $e) { $message = "An error occurred during the download: " . $e->getMessage(); } // Check for cURL errors if (curl_errno($ch)) { $message = "cURL error: " . curl_error($ch); } } else { $message = "Invalid URL."; } } ?> <!DOCTYPE html> <html> <head> <title>Download File</title> </head> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="url">URL:</label> <input type="text" name="url" value="https://github.com/Ry3yr/ry3yr.github.io"> <br> <label for="download_path">Download Path:</label> <input type="text" name="download_path" placeholder="Leave blank for current directory"> <br> <input type="submit" name="submit" value="Download"> </form> <?php if (!empty($transformedUrl)): ?> <p>Transformed GitHub URL: <?php echo $transformedUrl; ?></p> <?php endif; ?> <?php if (isset($message)): ?> <p><?php echo $message; ?></p> <?php endif; ?> </body> </html> <iframe src="<?= dirname($_SERVER['PHP_SELF']); ?>?timestamp=<?= time(); ?>" width="1200" height="600" frameborder="0"></iframe> ______________________________________________________ Change PHP version to specific version via htaccess ------------------------------------------------------------------------------- For PHP 5.6: AddHandler application/x-httpd-php56 .php .php5 For PHP 7.0: AddHandler application/x-httpd-php70 .php .php7 For PHP 7.1: AddHandler application/x-httpd-php71 .php .php7 For PHP 7.2: AddHandler application/x-httpd-php72 .php .php7 For PHP 7.3: AddHandler application/x-httpd-php73 .php .php7 For PHP 7.4: AddHandler application/x-httpd-php74 .php .php7 For PHP 8.0: AddHandler application/x-httpd-php80 .php .php8 For PHP 8.1: AddHandler application/x-httpd-php81 .php .php8 (Source: https://www.fastcomet.com/kb/how-to-set-custom-php-version-per-directory ) _________________________ Check PHP version: ------------------------------ <?php $phpVersion = phpversion(); echo "PHP version: " . $phpVersion; ?> _________________________ PassProtect Php ----------- <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $password = $_POST['password']; if ($password === '1234') { // Place your PHP code here echo "Password correct! Proceeding with code execution."; } else { // Password is incorrect, display an error message echo "Incorrect password. Access denied."; } } ?> <!-- HTML form to enter the password --> <form method="POST" action=""> <label for="password">Password:</label> <input type="password" name="password" id="password"> <input type="submit" value="Submit"> </form> _____________________________ Download subdir as zip if selected via link ------------------------------------- <?php $baseDir = __DIR__; // Set the base directory to the current directory // Check if a directory is clicked if (isset($_GET['dir'])) { $selectedDir = $_GET['dir']; // Get the selected directory $zipFolderName = basename($selectedDir); // Get the folder name for the ZIP file // Create a ZIP archive $zip = new ZipArchive(); $zipName = $zipFolderName . '.zip'; $zip->open($zipName, ZipArchive::CREATE | ZipArchive::OVERWRITE); // Add files and directories to the ZIP archive $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($selectedDir), RecursiveIteratorIterator::SELF_FIRST ); foreach ($files as $name => $file) { if (!$file->isDir()) { $filePath = $file->getRealPath(); // Skip "." and ".." folders if ($filePath !== $selectedDir . '/.' && $filePath !== $selectedDir . '/..') { $relativePath = $zipFolderName . '/' . substr($filePath, strlen($selectedDir) + 1); $zip->addFile($filePath, $relativePath); } } else { $relativePath = $zipFolderName . '/' . substr($file, strlen($selectedDir) + 1); // Skip "." and ".." folders if ($relativePath !== $zipFolderName . '/.' && $relativePath !== $zipFolderName . '/..') { $zip->addEmptyDir($relativePath); } } } // Close the ZIP archive $zip->close(); // Send the ZIP file to the browser if (file_exists($zipName)) { header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $zipName . '"'); header('Content-Length: ' . filesize($zipName)); readfile($zipName); // Delete the ZIP file unlink($zipName); exit; } } // List directories $directories = glob($baseDir . '/*', GLOB_ONLYDIR); foreach ($directories as $directory) { $dirName = basename($directory); // Skip "." and ".." folders if ($dirName !== '.' && $dirName !== '..') { echo '<a href="?dir=' . urlencode($directory) . '">' . $dirName . '</a><br>'; } } ?> ________________________________ Fetch vgmdb release date/link and write to html list: --------------------------------------------------------------------------------- <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $url = $_POST['url']; $html = file_get_contents($url); $datePattern = '/View albums released on ([A-Z][a-z]{2} \d{1,2}, \d{4})/'; preg_match($datePattern, $html, $dateMatches); $releaseDate = $dateMatches[1]; $reformattedDate = date('Y-m-d', strtotime($releaseDate)); $titlePattern = '/<h1><span class="albumtitle" lang="en" style="display:inline">(.*?)<\/span>/s'; preg_match($titlePattern, $html, $titleMatches); $albumTitle = $titleMatches[1]; // Check if line is already present in file $fileContent = file_get_contents('pastreleases.html'); $lineToCheck = "<p>" . $reformattedDate . " <a href='" . $url . "'>" . $albumTitle . "</a></p>"; if (strpos($fileContent, $lineToCheck) !== false) { // Line is already present, display error message echo "Error: Line already exists in the file.<br>"; } else { // Line is not present, prepend to the file $fileContentToWrite = $lineToCheck . "\n" . $fileContent; file_put_contents('pastreleases.html', $fileContentToWrite); } echo "" . $reformattedDate . ""; echo "<a href='" . $url . "' target='_blank'>" . $albumTitle . "</a>"; } ?> <head> </head> <body> <form method="POST" action=""> <label for="url">VGMdb URL:</label> <input type="text" name="url" id="url" required> <input type="submit" value="Extract"> </form> </body> <!--Reorder--Function--> <form method="POST" action=""> <input type="submit" name="reorder" id="reorder" value="Reorder"> </form> <?php if (isset($_POST['reorder'])) { // PHP Code for Reordering "pastreleases.html" $fileContent = file_get_contents('pastreleases.html'); $lines = explode("\n", $fileContent); $lines = array_filter($lines); $linesWithDates = array(); foreach ($lines as $line) { preg_match('/<p>(\d{4}-\d{2}-\d{2})/', $line, $dateMatches); if (isset($dateMatches[1]) && strtotime($dateMatches[1]) !== false) { $date = $dateMatches[1]; $linesWithDates[$line] = $date; } } arsort($linesWithDates); $reorderedLines = array_keys($linesWithDates); $reorderedContent = implode("\n", $reorderedLines); // Filter lines that do not contain "https://" $filteredLines = array_filter($reorderedLines, function ($line) { return strpos($line, 'https://') !== false; }); $filteredContent = implode("\n", $filteredLines); file_put_contents('pastreleases.html', $filteredContent); echo "Reordering and filtering completed successfully!"; } ?> <iframe src="pastreleases.html?timestamp=<?php echo time(); ?>" width="600" height="400"></iframe> __________________________________________ Manually load "php composer package": ------------------------------------------------------------- <?php $file = 'src/DiDom/Document.php'; // Check if the file exists if (!file_exists($file)) { echo 'Error: Document.php file not found.'; exit; } // Enable error reporting error_reporting(E_ALL); ini_set('display_errors', 1); // Try to include the file require_once $file; // Check if Document class is defined if (class_exists('DiDom\Document')) { echo 'Document.php is properly loaded.'; } else { echo 'Error: Document.php failed to load.'; echo 'Please check if the file is correct and the necessary dependencies are installed.'; } ?> <?php if (extension_loaded('libxml')) { echo "libxml extension is enabled."; } else { echo "libxml extension is not enabled."; } ?><br><br> <?php // Define LIBXML_HTML_NODEFDTD constant if it's not already defined if (!defined('LIBXML_HTML_NODEFDTD')) { define('LIBXML_HTML_NODEFDTD', 8192); } require_once 'src/DiDom/Node.php'; //require_once 'src/DiDom/Encoder.php'; //require_once 'src/DiDom/Errors.php'; $files = glob('src/DiDom/*.php'); foreach ($files as $file) { require_once $file; } use DiDom\Document; // Create a new DiDOM Document object $document = new Document(); $document->loadHtmlFile('https://ry3yr.github.io/OSTR/Diarykeepers_Homepage/index.html'); // Find all the links in the document $links = $document->find('a'); // Display the URLs of the links foreach ($links as $link) { echo $link->getAttribute('href') . PHP_EOL; } ?> _____________________________________ PHP list dirs: -------------------- <?php $directory = './'; // Specify the directory path here function listSubdirectories($directory) { $subdirectories = glob($directory . '/*', GLOB_ONLYDIR); if (count($subdirectories) > 0) { echo '<ul>'; foreach ($subdirectories as $subdirectory) { echo '<li>'; echo '<details>'; echo '<summary>' . basename($subdirectory) . '</summary>'; listSubdirectories($subdirectory); echo '</details>'; echo '</li>'; } echo '</ul>'; } $files = glob($directory . '/*.*'); if (count($files) > 0) { echo '<ul>'; foreach ($files as $file) { echo '<li><a href="' . $file . '">' . basename($file) . '</a></li>'; } echo '</ul>'; } } echo '<ul>'; echo '<li>'; echo '<details>'; echo '<summary>Root</summary>'; listSubdirectories($directory); echo '</details>'; echo '</li>'; echo '</ul>'; ?> ____________________ JSFiddleClone: ------------------------ <a href="save-new-fiddle.php" target="_blank">Save New HTML</a> <style> .preview-container { border: 1px solid black; padding: 10px; } </style> <?php $folderPath = 'htmls'; $files = glob($folderPath . '/*.html'); $fileCount = count($files); $gridColumns = 6; $gridRows = ceil($fileCount / $gridColumns); ?> <div id="preview-container-wrapper"></div> <script> // Function to append the preview containers to the wrapper div function appendPreviewContainers() { var wrapper = document.getElementById('preview-container-wrapper'); <?php $folderPath = 'htmls'; $files = glob($folderPath . '/*.html'); $fileCount = count($files); $gridColumns = 6; $gridRows = ceil($fileCount / $gridColumns); $files = array_reverse($files); // Reverse the order of the files for ($row = 0; $row < $gridRows; $row++) { echo 'var row' . $row . ' = document.createElement("div");'; echo 'row' . $row . '.style.display = "flex";'; for ($col = 0; $col < $gridColumns; $col++) { $index = $row * $gridColumns + $col; if ($index < $fileCount) { $file = $files[$index]; $fileName = basename($file); $objectPreview = '<object data="' . $file . '" width="300" height="200" scrolling="no"></object>'; echo 'var container' . $index . ' = document.createElement("div");'; echo 'container' . $index . '.className = "preview-container";'; echo 'container' . $index . '.style.flex = "1";'; echo 'container' . $index . '.style.margin = "5px";'; echo 'container' . $index . '.innerHTML = \'' . $objectPreview . '<br><a href="' . $file . '" target="_blank">' . $fileName . '</a>\';'; echo 'row' . $row . '.appendChild(container' . $index . ');'; } } echo 'wrapper.appendChild(row' . $row . ');'; } ?> } // Function to stop further data fetching after a specified delay function stopDataFetching() { var xhr = new XMLHttpRequest(); xhr.abort(); } // Call the function to append the preview containers appendPreviewContainers(); // Wait for 20 seconds and then stop further data fetching setTimeout(stopDataFetching, 10000); </script> <!------save-new-fiddle.php---> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $code = $_POST['code']; $name = $_POST['name']; // Generate the file name $date = date('Y-m-d'); $name = preg_replace('/[^\w\s]/', '', $name); // Remove illegal characters $name = str_replace(' ', '-', $name); // Replace spaces with "-" $filename = $date . '-' . $name . '.html'; // Check if the "html" folder exists if (!is_dir('htmls')) { // Create the "htmls" folder if it doesn't exist mkdir('html'); } // Save the content to the file $filepath = 'htmls/' . $filename; file_put_contents($filepath, $code); echo "Code saved successfully!"; } ?> <body> <form method="post" action=""> <label for="code">Code:</label><br> <textarea name="code" rows="10" cols="50"></textarea><br><br> <label for="name">Name:</label><br> <input type="text" name="name"><br><br> <input type="submit" value="Save Code"> </form> </body> </html> ______________________________________________ Add gamesizes to "dekudeals" collection.json: ---------------------------------------------------------------------- <?php // Function to handle file upload function handleFileUpload($file) {     // Check if the upload was successful     if ($file['error'] === UPLOAD_ERR_OK) {         // Read the uploaded file         $jsonData = file_get_contents($file['tmp_name']);         // Decode the JSON data into an associative array         $data = json_decode($jsonData, true);         // Check if the JSON decoding was successful         if ($data !== null) {             // Iterate over each item in the collection             foreach ($data['items'] as &$item) {                 // Check if the item has a "link" key                 if (isset($item['link'])) {                     // Fetch the content of the URL                     $url = $item['link'];                     $html = file_get_contents($url);                     // Create a DOMDocument object and load the HTML content                     $dom = new DOMDocument();                     @$dom->loadHTML($html);                     // Create a DOMXPath object to query the HTML                     $xpath = new DOMXPath($dom);                     // Find the download size element using XPath                     $query = "//strong[contains(text(), 'Download size:')]/following-sibling::text()";                     $downloadSize = $xpath->query($query)->item(0)->nodeValue;                     // Add the new "gamesize" field to the item                     $item['gamesize'] = $downloadSize;                 }             }             // Encode the modified data back to JSON             $updatedJsonData = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);             // Set the appropriate headers for downloading the file             header('Content-Type: application/json');             header('Content-Disposition: attachment; filename="updated_collection.json"');             // Output the updated JSON data for download             echo $updatedJsonData;         } else {             // JSON decoding failed             echo "Failed to decode JSON data.";         }     } else {         // File upload failed         echo "File upload failed. Please try again.";     } } // Check if a file was uploaded if ($_FILES && isset($_FILES['json_file'])) {     handleFileUpload($_FILES['json_file']); } ?> <!DOCTYPE html> <html> <head>     <title>Dekudeals Download Size Fetcher</title> </head> <body>     <h1>upload your collection json (or use url) to add gamesizes </h1>     <form action="" method="POST">         <button type="submit" name="start">Start</button>     </form>     <hr>     <h3>Upload custom JSON</h3>     <form action="" method="POST" enctype="multipart/form-data">         <input type="file" name="json_file" accept=".json">         <button type="submit" name="upload">Upload</button>     </form> </body> </html> _______________________________ JSFiddle Downloader: -------------------------------- <!DOCTYPE html> <body> <?php if (isset($_POST['jsfiddle_url'])) { $jsfiddle_url = $_POST['jsfiddle_url']; if (!preg_match("~^(?:f|ht)tps?://~i", $jsfiddle_url)) { $jsfiddle_url = "https://" . $jsfiddle_url; } $reformed_url = str_replace('jsfiddle.net', 'fiddle.jshell.net', $jsfiddle_url); $reformed_url = str_replace('/show', '', $reformed_url); $curl_command = "curl '" . $reformed_url . "//show/' -H 'Referer: " . $jsfiddle_url . "//' --output 'fiddle.html'"; echo "<pre>" . $curl_command . "</pre>"; //$outputFile = 'fiddle.html'; //$curl = curl_init(); //curl_setopt($curl, CURLOPT_URL, $reformed_url); //curl_setopt($curl, CURLOPT_REFERER, $jsfiddle_url); //$fileHandle = fopen($outputFile, 'w'); //curl_setopt($curl, CURLOPT_FILE, $fileHandle); //curl_exec($curl); //fclose($fileHandle); if (curl_errno($curl)) { echo 'cURL error: ' . curl_error($curl); } else { echo 'Request completed successfully.'; echo '<a target="_blank" href="fiddle.html">link</a>'; } curl_close($curl); } $error = ''; $result = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $command = $_POST['command']; preg_match("/'(.+?)'/", $command, $urlMatches); $url = $urlMatches[1]; preg_match("/'Referer: (.+?)'/", $command, $refererMatches); $referer = $refererMatches[1]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); if ($output !== false) { $filename = 'fiddle.html'; file_put_contents($filename, $output); $result = "File downloaded successfully as <a target=_blank href=fiddle.html>link</a>"; } else { $error = "Error downloading file."; } curl_close($ch); } ?> <!-- Display the form --> <form method="post"> <label for="jsfiddle_url">JSFiddle URL:</label> <input type="text" name="jsfiddle_url" value="https://jsfiddle.net/aoikurayami/745t8aeh/2"> <input type="submit" value="Generate cURL cmd"> </form> <!-- Display the cURL command form --> <form method="POST" action=""> <label for="command">cURL Command:</label> <input type="text" name="command" id="command" required value="<?php echo htmlspecialchars($curl_command); ?>"><br><br> <input type="submit" value="Download JSFiddle"> </form> <?php if ($error !== ''): ?> <p style="color: red;"><?php echo $error; ?></p> <?php endif; ?> <?php if ($result !== ''): ?> <p style="color: green;"><?php echo $result; ?></p> <?php endif; ?> <?php if (file_exists('fiddle.html')): ?> <iframe src="fiddle.html?<?php echo time(); ?>" frameborder="0" width="100%" height="500"></iframe> <?php endif; ?> <!-- Display the iframe with the content of the downloaded file --> <!-- <?php if (isset($outputFile)): ?> <hr> <h2>Contents of fiddle.html:</h2> <iframe src="<?php echo $outputFile; ?>" frameborder="0" width="100%" height="500"></iframe> <?php endif; ?>--> _________________________________________ HikariNoAkariOST link Parser --------------------------------------------- <a href="javascript:history.pushState({}, '', '?i=1');location.reload();">?i=1</a> <a href="javascript:history.pushState({}, '', '?i=2');location.reload();">?i=2</a> <a href="javascript:history.pushState({}, '', '?i=3');location.reload();">?i=3</a> <br> <br> <?php // Get the page number from the query parameter $pageNumber = isset($_GET['i']) ? $_GET['i'] : 1; // Create a DOMDocument object $dom = new DOMDocument(); // Load the HTML from the URL with the page number $url = 'https://hikarinoakari.com/page/' . $pageNumber; $dom->loadHTMLFile($url); // Create a DOMXPath object $xpath = new DOMXPath($dom); // Define the XPath expression to find the desired element $expression = '//div[@class="td-module-thumb"]/a/@href'; // Query the XPath expression $hrefAttributes = $xpath->query($expression); // Iterate over the results and display the href attribute values foreach ($hrefAttributes as $hrefAttribute) { $link = $hrefAttribute->nodeValue; echo '<a href="' . $link . '" target="_blank">' . $link . '</a>'; echo '<form method="post" action="">'; echo '<input type="hidden" name="link" value="' . $link . '">'; echo '<input type="submit" name="search" value="Search">'; echo '</form>'; echo '<br>'; // Check if a link is submitted for search and it matches the current button if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["link"]) && $_POST["link"] == $link && isset($_POST["search"])) { $searchDom = new DOMDocument(); // Load the HTML from the submitted link $searchDom->loadHTMLFile($link); // Create a new DOMXPath object for the submitted link $searchXPath = new DOMXPath($searchDom); // Define the XPath expression to find the desired elements in the submitted link $searchExpression = '//*[contains(@href, "https://hikarinoakari.com/out")]'; // Query the XPath expression in the submitted link $searchResults = $searchXPath->query($searchExpression); // Display the search results below the current button echo '<div style="margin-left: 20px;">'; echo '<h4>Search Results:</h4>'; if ($searchResults->length > 0) { foreach ($searchResults as $result) { echo $result->getAttribute("href") . "<br>"; } } else { echo 'No results found.'; } echo '</div>'; } } ?> <br><br><a target="_blank" href="https://github.com/nsmle/ouo-bypass">ByPass ouo.press</a> ________________________________ T-Shirt Design Viewer: -------------------------------- <?php $currentDir = dirname(__FILE__); echo "The current directory is: " . $currentDir; echo "<br>Dropbox/Public/2Diaric/TODO/T-Shirts <br><br>" ?> <?php $folderPath = 'T-Shirts/'; $images = glob($folderPath . '*.{jpg,jpeg,png,gif}', GLOB_BRACE); if (empty($images)) { echo 'No images found in the folder.'; } else { // Sort the images array in descending order based on file modification time usort($images, function($a, $b) { return filemtime($b) - filemtime($a); }); // Get the background color from the URL parameters $bgColor = 'black'; $url = preg_replace('/[^a-z]/i', '', $_SERVER['REQUEST_URI']); preg_match('/(white|black|lightblue)/i', $url, $matches); if (!empty($matches)) { $bgColor = strtolower($matches[1]); } // Display the images echo '<div style="display: flex; flex-wrap: wrap;">'; foreach ($images as $image) { // Get the background color from the filename $filename = preg_replace('/[^a-z]/i', '', $image); preg_match('/(white|black|light-blue|navy|grey)/i', $filename, $matches); if (!empty($matches)) { $bgColor = strtolower($matches[1]); } echo '<div style="width: 250px; height: 250px; margin: 10px;">'; echo '<img src="' . $image . '" alt="T-Shirt Image" style="width: 100%; height: 100%; object-fit: cover; background-color: '.$bgColor.';" onclick="openModal(\''.$image.'\')" />'; echo '</div>'; } echo '</div>'; // Create the modal window echo '<div id="myModal" class="modal">'; echo '<span class="close">&times;</span>'; echo '<img class="modal-content" id="img01">'; echo '</div>'; // Add CSS styles for the modal window echo '<style>'; echo '.modal { display: none; position: fixed; z-index: 1; padding-top: 60px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.9); }'; echo '.modal-content { margin: auto; display: block; max-width: 80%; max-height: 80%; }'; echo '.close { position: absolute; top: 15px; right: 35px; color: #f1f1f1; font-size: 40px; font-weight: bold; cursor: pointer; }'; echo '@media screen and (max-width: 700px){ .modal-content { width: 100%; } }'; echo '</style>'; // Add JavaScript code to handle the modal window echo '<script>'; echo 'function openModal(image) {'; echo 'var modal = document.getElementById("myModal");'; echo 'var modalImg = document.getElementById("img01");'; echo 'modal.style.display = "block";'; echo 'modalImg.src = image;'; echo '}'; echo 'var span = document.getElementsByClassName("close")[0];'; echo 'span.onclick = function() {'; echo 'var modal = document.getElementById("myModal");'; echo 'modal.style.display = "none";'; echo '}'; echo '</script>'; } ?> __________________________________ YuGiOh ydk deck randomizer: ----------------------------------------------- <!DOCTYPE html> <html> <head> <title>YGORandomizer</title> <style> body { font-family: Arial, sans-serif; background-color: #f2f2f2; margin: 0; padding: 0; } h1 { text-align: center; margin-top: 50px; } form { display: flex; flex-direction: column; align-items: center; margin-top: 50px; } .file-input { position: relative; width: 250px; height: 50px; overflow: hidden; margin-bottom: 20px; background-color: #fff; border: 2px solid #ddd; border-radius: 4px; } .file-input input[type=file] { position: absolute; font-size: 100px; opacity: 0; right: 0; top: 0; } .file-input label { display: inline-block; padding: 10px 20px; font-size: 16px; font-weight: bold; color: #333; background-color: #eee; cursor: pointer; border-radius: 4px; } #buttons-container { display: flex; justify-content: center; flex-wrap: wrap; margin-top: 50px; } .button-container { display: inline-block; width: 250px; height: 350px; margin-right: 10px; position: relative; } .button-container::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 2px solid #000; /* Change the color and thickness as desired */ z-index: -1; } .button-image { width: 100%; height: 280px; object-fit: cover; } .button-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; height: 70px; text-align: center; padding-top: 10px; font-size: 14px; font-weight: bold; color: #333; } .button-text span { font-size: 12px; font-weight: normal; color: #666; } .button-text br { display: none; } .button-container:hover .button-text br { display: block; } </style> </head> <body> <h1>YGORandomizer</h1> <form action="" method="POST" enctype="multipart/form-data"> <div class="file-input"> <input type="file" name="file" id="file" /> <label for="file">Choose a file</label> </div> <input type="submit" name="submit" value="Upload" /> </form> <div id="buttons-container"> <?php $targetDir = 'ydk/'; // Folder to store the uploaded files if ($_FILES['file']['name']) { $targetFile = $targetDir . basename($_FILES['file']['name']); // Move the uploaded file to the target directory if (move_uploaded_file($_FILES['file']['tmp_name'], $targetFile)) { echo 'File uploaded successfully.'; } else { echo 'Error uploading file.'; } } $folderPath = 'ydk/'; $ydks = glob($folderPath . '*.ydk'); // Get 3 random .ydk files $randomYdks = array_rand($ydks, 3); foreach ($randomYdks as $index) { $filename = basename($ydks[$index]); $shortFilename = str_pad($filename, 30, ' '); $filePath = $ydks[$index]; // Read the specified line (line number 3) of the YDK file $targetLine = ""; $file = fopen($filePath, "r"); if ($file) { for ($i = 1; $i <= 3; $i++) { $targetLine = fgets($file); if ($i == 3) { break; } } fclose($file); } // Extract the card ID from the line $cardId = trim($targetLine); // Generate the image URL $imageUrl = "https://images.ygoprodeck.com/images/cards/$cardId.jpg"; echo "<div class='button-container'><a href='$filePath' download><img src='$imageUrl' alt='Card Image' class='button-image'><div class='button-text'>$shortFilename<span>$targetLine</span></div></a></div>"; } ?> </div> </body> </html> __________________________________________ Gogoanime Video Download link finder: ----------------------------------------------------------------- <?php if (isset($_POST['url'])) { $url = $_POST['url']; $html = file_get_contents($url); $dom = new DOMDocument(); @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link) { if ($link->nodeValue == "Download") { $download_link = $link->getAttribute('href'); echo "<a href='$download_link' target='_blank'>$download_link</a><br>"; $download_html = file_get_contents($download_link); $download_dom = new DOMDocument(); @$download_dom->loadHTML($download_html); $download_links = $download_dom->getElementsByTagName('a'); foreach ($download_links as $download_link) { $download_url = $download_link->getAttribute('href'); echo "<a href='$download_url' target='_blank'>$download_url</a><br>"; } break; } } } ?> <form method="post"> <label for="url">Enter URL:</label> <input type="text" id="url" name="url"> <input type="submit" value="Submit"> </form> _________________________________________ Display Code from txt file: ---------------------------------------- <?php $fileContents = file_get_contents('https://ry3yr.github.io/OSTR/release/other/Computerstuff/Commands/HTML_Codes.txt'); $pattern = '/------(.*?)_____/s'; preg_match_all($pattern, $fileContents, $matches); $randomIndex = array_rand($matches[1]); $randomMatch = $matches[1][$randomIndex]; $numLines = substr_count($randomMatch, "\n") + 1; if ($numLines >= 3) { echo '<plaintext>' . $randomMatch . '</plaintext>'; } ?> ____________________________ Mastodon Profile renderer (+ shorthand emoji): ---------------------------------------- <?php $profileUrl = 'https://pb.todon.de/api/v1/accounts/109629985010224381'; $endpoint = 'https://pb.todon.de/api/v1/custom_emojis'; // Make a GET request to the profile URL using cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $profileUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Parse the JSON response into an associative array $data = json_decode($response, true); // Access the fields in the JSON object $id = $data['id']; $username = $data['username']; $display_name = $data['display_name']; $locked = $data['locked']; $bot = $data['bot']; $discoverable = $data['discoverable']; $group = $data['group']; $created_at = $data['created_at']; $note = $data['note']; $url = $data['url']; $avatar = $data['avatar']; $avatar_static = $data['avatar_static']; $header = $data['header']; $header_static = $data['header_static']; $followers_count = $data['followers_count']; $following_count = $data['following_count']; $statuses_count = $data['statuses_count']; $last_status_at = $data['last_status_at']; $noindex = $data['noindex']; $emojis = $data['emojis']; $roles = $data['roles']; $fields = $data['fields']; // Make a GET request to the custom emojis endpoint $response = file_get_contents($endpoint); $customEmojis = json_decode($response, true); // Replace shorthands in the note with corresponding emoji images foreach ($customEmojis as $customEmoji) { $shortcode = $customEmoji['shortcode']; $url = $customEmoji['url']; $shortcodePattern = '/:' . preg_quote($shortcode, '/') . ':/'; $emojiTag = '<img src="' . $url . '" alt="' . $shortcode . '" width="45px">'; $note = preg_replace($shortcodePattern, $emojiTag, $note); } $fields = $data['fields']; // Extract the links from the fields array $links = []; if (isset($fields) && is_array($fields)) { foreach ($fields as $field) { $name = $field['name']; $value = $field['value']; preg_match('/<a href="(.*?)"/', $value, $matches); $url = isset($matches[1]) ? $matches[1] : ''; $links[$name] = $url; } } // Do something with the data echo "$username@<a target=_blank href=https://pb.todon.de/share>pb.todon.de</a><br>\n"; echo "<br><hr>"; echo "$note"; echo "<hr>"; foreach ($links as $name => $url) {echo "$name: <a target='_blank' href='$url'>$url</a><br>";} echo "Following: <b>$following_count</b>\n"; echo "Followers: <b>$followers_count</b>\n"; echo "Posts: <b>$statuses_count</b>\n"; ?> ___________________________________________________ Mastodon api TL parser (with yt & image & pixiv & imgbb (directlink) & emoji support): ----------------------------------------------------------------------------- <?php $apiUrl = 'https://pb.todon.de/api/v1/accounts/109629985010224381/statuses'; $accessToken = 'your-access-token'; $headers = ['Authorization: Bearer ' . $accessToken,]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $apiUrl, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); curl_close($curl); $data = json_decode($response, true); foreach ($data as $status) { $content = '<div>' . $status['content'] . '</div>'; $media = ''; $avatar = ''; $tootLink = ''; // Check for imgbb image URLs in the status content $imageRegex = '/(https?:\/\/(?:www\.)?i\.ibb\.co\/[^ ]+\.(?:jpg|png|gif|bmp))/'; preg_match_all($imageRegex, $status['content'], $imageMatches); if (!empty($imageMatches[0])) { $media .= '<div>'; foreach ($imageMatches[0] as $url) { $media .= '<img src="' . $url . '" width="50%"><br>'; } $media .= '</div>'; } // Add emoji renderer $endpoint = 'https://pb.todon.de/api/v1/custom_emojis'; $response = file_get_contents($endpoint); $customEmojis = json_decode($response, true); foreach ($customEmojis as $customEmoji) { $shortcode = $customEmoji['shortcode']; $url = $customEmoji['url']; $shortcodePattern = '/:' . preg_quote($shortcode, '/') . ':/'; $emojiTag = '<img src="' . $url . '" alt="' . $shortcode . '" width="45px">'; $content = preg_replace($shortcodePattern, $emojiTag, $content); } // Check for Tenor.com video link $tenorRegex = '/https?:\/\/(?:www\.)?tenor\.com\/view\/[a-zA-Z0-9-]+-(\d+)/'; preg_match($tenorRegex, $status['content'], $tenorMatch); if ($tenorMatch) { // Extract Tenor.com video ID $videoId = $tenorMatch[1]; // Create embedded player for Tenor.com video $media = '<div><iframe src="https://tenor.com/embed/' . $videoId . '" frameborder="0" allowfullscreen="true" width="100%" height="400px"></iframe></div>'; // Remove Tenor.com link from content $content = preg_replace($tenorRegex, '', $content); } // Check for SoundCloud track link $soundcloudRegex = '/https?:\/\/(m\.)?soundcloud\.com\/[\w\-_]+\/[\w\-_]+/i'; preg_match($soundcloudRegex, $status['content'], $soundcloudMatch); if ($soundcloudMatch) { // The SoundCloud URL to extract the track ID from $url = $soundcloudMatch[0]; // Check if the URL is a mobile link and convert it to a normal link if (strpos($url, 'm.soundcloud.com') !== false) { $url = str_replace('m.soundcloud.com', 'soundcloud.com', $url); } // Fetch the SoundCloud page source $pageSource = file_get_contents($url); // Extract the track ID from the page source preg_match('/sounds:(\d+)/', $pageSource, $matches); $trackID = $matches[1]; // Embed the SoundCloud player with the track ID $playerURL = 'https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/' . $trackID . '&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true'; $media = '<div><iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="' . $playerURL . '"></iframe></div>'; // Remove SoundCloud link from content $content = str_replace($soundcloudMatch[0], '', $content); } else { // Check for YouTube video link $youtubeRegex = '/https?:\/\/(www\.)?(m\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]{11})/'; preg_match($youtubeRegex, $status['content'], $youtubeMatch); if ($youtubeMatch) { // Extract video ID from YouTube link $videoId = $youtubeMatch[3]; // Create embedded player for YouTube video $embeddedPlayer = '<div><iframe width="560" height="315" src="https://www.youtube.com/embed/' . $videoId . '" frameborder="0" allowfullscreen></iframe></div>'; // Create link to YouTube video $videoLink = '<div><a href="https://www.youtube.com/watch?v=' . $videoId . '" target="_blank">' . $youtubeMatch[0] . '</a></div>'; // Add both embedded player and link to the content $media = $embeddedPlayer . $videoLink; // Remove YouTube link from content $content = str_replace($youtubeMatch[0], '', $content); } else { // Check for Pixiv artwork link $pixivRegex = '/https?:\/\/(?:www\.)?pixiv\.net\/(?:en\/)?artworks\/(\d+)/'; preg_match($pixivRegex, $status['content'], $pixivMatch); if ($pixivMatch) { // Extract artwork ID from Pixiv link $artworkId = $pixivMatch[1]; // Create image preview for Pixiv artwork $media = '<div><img src="https://embed.pixiv.net/decorate.php?illust_id=' . $artworkId . '&mode=sns-automator" width="50%"></div>'; // Remove Pixiv link from content $content = str_replace($pixivMatch[0], '', $content); } else { // Check for attachments if (count($status['media_attachments']) > 0) { $media = '<div>'; foreach ($status['media_attachments'] as $attachment) { if ($attachment['type'] === 'image') { $ch = curl_init($attachment['url']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $image = curl_exec($ch); curl_close($ch); $media .= '<img src="data:image/jpeg;base64,' . base64_encode($image) . '" width="50%"><br>'; } else if ($attachment['type'] === 'video') { $media .= '<div><video controls width="50%"><source src="' . $attachment['url'] . '" type="' . $attachment['mime_type'] . '"></video></div>'; } else if ($attachment['type'] === 'audio') { $media .= '<div><audio controls><source src="' . $attachment['url'] . '" type="' . $attachment['mime_type'] . '"></audio></div>'; } } $media .= '</div>'; } } } } // Check for spoiler tag if (strpos($status['url'], 'activity') !== false) { $avatar = '<!--<details><summary>Avatar (spoiler)</summary><img src="' . $status['account']['avatar'] . '" width="100px"></details>--><br>'; $tootLink = '<!--<details><summary>View on Mastodon (spoiler)</summary><a href="' . $status['url'] . '" target="_blank">Click here to view activity</a></details>-->'; } else { $avatar = '<img src="' . $status['account']['avatar'] . '" width="100px"><br>'; $tootLink = '<a href="' . $status['url'] . '" target="_blank">View on Mastodon</a>'; } // Get the date of the status $date = new DateTime($status['created_at']); // Append content and media to feed echo $content . $media . $avatar . $tootLink . '&nbsp;' . $date->format('Y-m-d H:i:s') . '<hr>'; } ?> (Source: http://alcea-wisteria.de/PHP/0demo/2023-07-15-DisplayMastodonProfile/alcea-mtd-tl.php ) __________________________________________________ Issue Tracker (with disallow.txt profanity filter): -------------------------------------------------------------------- <!DOCTYPE html> <html> <head> <title>Issue Tracker</title> <style> body { font-family: Arial, sans-serif; font-size: 16px; line-height: 1.6; color: #333; margin: 0; padding: 0; } h1, h2 { margin-top: 0; margin-bottom: 20px; } table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 8px; border-bottom: 1px solid #ddd; } th { background-color: orange; color: white; } table.solved-issues th { background-color: green; color: white; } form { margin-top: 20px; } label { display: block; margin-bottom: 8px; } input[type="text"], textarea { width: 100%; padding: 12px 20px; margin: 8px 0; box-sizing: border-box; border: 2px solid #ccc; border-radius: 4px; resize: vertical; } input[type="submit"] { background-color: #4CAF50; color: white; padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer; } input[type="submit"]:hover { background-color: #45a049; } </style> </head> <body> <h1>Issue Tracker</h1> <?php // Check if form has been submitted if (isset($_POST['submit'])) { // Get form data $title = $_POST['title']; $description = $_POST['description']; // Check if form data contains any disallowed words or phrases $disallow = file('disallow.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($disallow as $word) { if (stripos($title, $word) !== false || stripos($description, $word) !== false) { echo "<p style='color:red'>You are not allowed to use the word or phrase: " . htmlentities($word) . "</p>"; break; } } // Validate form data if (empty($title) || empty($description)) { echo "<p>Please fill out all fields.</p>"; } else { // Save issue to file $filename = 'issues.txt'; $handle = fopen($filename, 'a'); fwrite($handle, $title . '|' . $description . '|' . time() . "\n"); fclose($handle); echo "<p>Issue saved successfully.</p>"; } } // Read issues from file $filename = 'issues.txt'; if (file_exists($filename)) { $handle = fopen($filename, 'r'); $issues = array(); $solved_issues = array(); while (($line = fgets($handle)) !== false) { $parts = explode('|', $line); if (count($parts) == 3) { $parts[1] = preg_replace( '@(https?:\/\/[^\s/$.?#].[^\s]*)@i', '<a href="$1" target="_blank">$1</a>', $parts[1] ); $issue = array( 'title' => $parts[0], 'description' => $parts[1], 'date_added' => $parts[2] ); // Render any • character as a line break $issue['description'] = str_replace('•', '<br>', $issue['description']); if (stripos($issue['title'], 'solved') !== false || stripos($issue['description'], 'solved') !== false) { $solved_issues[] = $issue; } else { $issues[] = $issue; } } } fclose($handle); // Sort issues by date added (most recent first) usort($issues, function($a, $b) { return $b['date_added'] - $a['date_added']; }); // Display all issues in a table echo '<h2>All Issues</h2>'; echo '<table>'; echo '<tr><th>Title</th><th>Description</th><th>Date Added</th></tr>'; foreach ($issues as$issue) { echo '<tr>'; echo '<td>' . $issue['title'] . '</td>'; echo '<td>' . $issue['description'] . '</td>'; echo '<td>' . date('Y-m-d H:i:s', $issue['date_added']) . '</td>'; echo '</tr>'; } echo '</table>'; // Display solved issues in a separate table if (!empty($solved_issues)) { echo '<h2>Solved Issues</h2>'; echo '<table class="solved-issues">'; echo '<tr><th>Title</th><th>Description</th><th>Date Added</th></tr>'; foreach ($solved_issues as $issue) { echo '<tr>'; echo '<td>' . $issue['title'] . '</td>'; echo '<td>' . $issue['description'] . '</td>'; echo '<td>' . date('Y-m-d H:i:s', $issue['date_added']) . '</td>'; echo '</tr>'; } echo '</table>'; } } ?> <h2>Add New Issue</h2> <form method="post"> <label for="title">Title</label> <input type="text" id="title" name="title"> <label for="description">Description</label> <textarea id="description" name="description"></textarea> <input type="submit" name="submit" value="Save Issue"> </form> <script> // Listen for Enter key press in description textarea and append • character var descriptionTextarea = document.getElementById('description'); descriptionTextarea.addEventListener('keydown', function(event) { if (event.keyCode === 13) { event.preventDefault(); var selectionStart = descriptionTextarea.selectionStart; var selectionEnd = descriptionTextarea.selectionEnd; var text = descriptionTextarea.value; descriptionTextarea.value = text.substring(0, selectionStart) + '•' + text.substring(selectionEnd); descriptionTextarea.setSelectionRange(selectionStart + 1, selectionStart + 1); } }); </script> </body> </html> ________________________ List all images (ftp) in subdir: ------------------------------------------- <a target="_blank" href="alcea-pbtodonde.php">Refresh Alcea</a>&nbsp; <a target="_blank" href="ryedai-mastodonsocial.php">Refresh Ryedai</a><br> <?php $dir = getcwd(); $websiteUrl = 'http'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { $websiteUrl .= 's'; } $websiteUrl .= '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); $images = glob($dir . '/**/*.{jpg,jpeg,png,gif}', GLOB_BRACE); $imageGroups = array(); foreach ($images as $image) { $dirName = dirname($image); $fileName = basename($image); if (!isset($imageGroups[$dirName])) { $imageGroups[$dirName] = array(); } $imageGroups[$dirName][] = $fileName; } foreach ($imageGroups as $dirName => $images) { // Replace the directory path with the website URL $dirName = str_replace($dir, $websiteUrl, $dirName); echo '<h2>' . $dirName . '</h2>'; foreach ($images as $image) { echo '<img src="' . $dirName . '/' . $image . '">'; } } ?> ________________________________________ Fetch Mastodon ava to subdir: --------------------------------------------- <?php $user = "ryedai"; $rss_url = "https://mastodon.social/@{$user}.rss"; $rss = simplexml_load_file($rss_url); $image_url = (string) $rss->channel->image->url; $filename = basename($image_url); if (strpos($filename, '.jpg') !== false) { $filename = $user . '_' . date('Y-m-d') . '.jpg'; } elseif (strpos($filename, '.png') !== false) { $filename = $user . '_' . date('Y-m-d') . '.png'; } $dir = "./" . strtolower($user) . "/"; if (!file_exists($dir)) { mkdir($dir); } $ch = curl_init($image_url); $fp = fopen($dir . $filename, 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_exec($ch); curl_close($ch); fclose($fp); ______________________________________ PHP to write another php (for testing): ----------------------------------------------------------- <?php $allowSource = true; // Allow saving the source code snippet by default if (isset($_POST['code'])) { // Get the code from the text area $code = $_POST['code']; // Get the current date and time $now = new DateTime(); $date = $now->format('Y-m-d'); $time = $now->format('H-i-s'); // Create the new file name $filename = $date . '-' . $time . '.php'; // Add the source code link to the bottom of the code if allowed if ($allowSource && isset($_POST['allowSource'])) { $sourceCodeLink = "<?php\n" . " define(\"ALLOW_SOURCE\",TRUE);\n" . " define(\"ALLOW_TITLE\",TRUE);\n" . " if(ALLOW_SOURCE && isset(\$_GET['source'])){\n" . " highlight_file(__FILE__);\n" . " exit(0);\n" . " }\n" . "?>\n" . "<a target=\"_blank\" href=\"?source\">Source Code</a>\n" . "</body>\n</html>"; $code .= "\n\n" . $sourceCodeLink; } // Write the code to the new file file_put_contents($filename, $code); // Write the code to the "current" PHP file file_put_contents('current.php', $code); echo "Code saved to $filename and current.php"; } // Handle the "Move Files" button click if (isset($_POST['move'])) { // Get a list of all files in the current directory $files = glob('*'); // Create the "0ld" directory if it doesn't exist if (!is_dir('0ld')) { mkdir('0ld'); } // Move all files except "0test.php" and "current.php" to the "0ld" directory foreach ($files as $file) { if ($file != '0test.php' && $file != 'current.php') { rename($file, '0ld/' . $file); } } echo "Files moved to 0ld directory"; } ?> <form method="post"> <textarea name="code" cols="60" rows="15"></textarea> <br> <label> <input type="checkbox" name="allowSource"> Add ALLOW SOURCE VIEW snippet </label> <br> <input type="submit" value="Save"> </form> <?php if ($allowSource && isset($_POST['allowSource'])) { echo "\n\n" . $sourceCodeLink; } ?> <form method="post"> <input type="submit" name="move" value="Move Files"> </form> <br> <br><a target="_blank" href="current.php">CURRENT.PHP</a>&nbsp;<a target="_blank" href="">[FOLDER]</a> _______________________________ Get last Github commit date: -------------------------------------------- <?php $repoUrl = "https://api.github.com/repos/Ry3yr/OSTR/branches/main"; $opts = [ "http" => [ "method" => "GET", "header" => "Accept: application/vnd.github.v3+json" ] ]; $response = file_get_contents($repoUrl, false, stream_context_create($opts)); $data = json_decode($response, true); $lastCommitTime = $data["commit"]["commit"]["author"]["date"]; // Display the last commit time echo "Last commit time: " . $lastCommitTime; ?> __________________ View PHP Source Code in new tab / Display Source Code ----------------------------------------------------- <?php //Allow or disallow source viewing define("ALLOW_SOURCE",TRUE); define("ALLOW_TITLE",TRUE); if(ALLOW_SOURCE && isset($_GET['source'])){ highlight_file(__FILE__); exit(0); } ?> <a target="_blank" href="?source">Source Code</a> _____________________________________________________ Display PHP Source Code on current page: ----------------------------------------------------------------- <?php show_source(__FILE__); ?> _________________________________________________________ Extract "€" values and display subtotal --------------------------------------------------------- <?php if(isset($_POST['submit'])) { $input = $_POST['input']; $total = 0; preg_match_all('/(\d+)[€]/', $input, $matches); foreach($matches[1] as $match) { $total += $match; } echo "Total value: €".$total; } ?> <form method="post" action=""> <textarea name="input"></textarea> <br> <button type="submit" name="submit">Calculate total</button> </form> =========Keyword (+search + url) Version====== <?php if(isset($_POST['submit'])) {   $input = '';   $url = isset($_POST['url']) ? $_POST['url'] : '';   if ($url) {     $input = strip_tags(file_get_contents($url));   } else {     $input = $_POST['input'];   }   $total = 0;   $keyword = isset($_POST['keyword']) ? $_POST['keyword'] : '';   $lines = explode("\n", $input);   $matching_lines = array(); // initialize an array to collect matching lines   $is_first_line = true; // flag to track whether the first line has been processed or not   foreach($lines as $line) {     if (!$keyword || strpos($line, $keyword) !== false) {       if ($is_first_line && $url) {         $is_first_line = false; // set flag to false to skip the first matching line         continue; // skip the first matching line       }       preg_match_all('/(\d+)[€]/', $line, $matches);       if ($matches) {         foreach($matches[1] as $match) {           $total += $match;         }       }       // add the matching line to the array       $matching_lines[] = $line;     }   }   echo "Total value for '".($keyword ?: 'all')."' lines: €".$total; } ?> <form method="post" action="">   <label for="url">URL:</label>   <input type="text" name="url" id="url">   <br>   <textarea name="input"></textarea>   <br>   Keyword: <input type="text" name="keyword">   <br>   <button type="submit" name="submit">Calculate total</button> </form> <?php if(isset($matching_lines) && $keyword): // output the matching lines section if there are matching lines and a keyword is set ?>   <br>   <h2>Matching lines:</h2>   <ul>     <?php foreach($matching_lines as $line): ?>       <li><?php echo htmlentities($line); ?></li>     <?php endforeach; ?>   </ul> <?php endif; ?> _______________________ Parse images from #rsshub #pixiv feed ----------------------------------------------------------- <?php $rss = simplexml_load_file('https://rsshub.app/pixiv/user/75406576'); foreach ($rss->channel->item as $item) { $description = (string) $item->description; if (preg_match('/https:\/\/\S+/', $description, $matches)) { $link = rtrim($matches[0], '"'); // Remove the final " character //echo '<p>' . htmlspecialchars($link) . '<br>'; echo '<img src="' . htmlspecialchars($link) . '">'; } } ?> _____________________________ Fetch Sitepart (via delimiters) ----------------------------------- <?php $url = 'https://ry3yr.github.io/OSTR/Diarykeepers_Homepage/Cool_Stuff.html'; $html = file_get_contents($url); $start = strpos($html, '<!--Tools-->'); $end = strpos($html, '<!--Hobbies-->', $start); $length = $end - $start; $result = substr($html, $start, $length); echo $result; ?> (Source: Source: "Fetch everything between "Tools" and "Hobbies" on https://ry3yr.github.io/OSTR/Diarykeepers_Homepage/Cool_Stuff.html via php" https://chat.chatgptdemo.net/ ) ___________________ Render RSS: ---------------------- <?php $rss = simplexml_load_file('https://rsshub.app/pixiv/user/75406576'); foreach ($rss->channel->item as $item) { $title = $item->title; $date = date('F j, Y', strtotime($item->pubDate)); $description = $item->description; $link = $item->link; echo "<h2><a href=\"$link\" target=\"_blank\">$title</a></h2>"; echo "<p>$date</p>"; echo "<p>$description</p>"; } ?> ____________________ Count elements of "item/value" ------------------------------------------------- (Here: Count "physical" in value "format") <?php $jsonData = file_get_contents("collection.json"); $data = json_decode($jsonData,true); $total = 0; foreach ($data["items"] as $value) { if($value["format"]==physical){ $total = $total+1; } } echo "•Physical Games: $total"; ?> (Source: https://stackoverflow.com/questions/19606094/php-count-json-array ) _____________________ Decode (dekudeals) json & list as table --------------------------------------------------------- <?php $json = file_get_contents('collection.json'); //Decode JSONV $json_data = json_decode($json,true); $peopleCount = 0; ?> <table> <tr> <th>Link</th> <th>Format avail.</th> <th>Price</th> </tr> <?php foreach($json_data['items'] as $key=>$value): $peopleCount++; ?> <tr> <td><?php echo $value['link']; ?></td> <td><?php echo $value['format']; ?></td> <td><?php echo $value['price_paid']; ?></td> </tr> <?php endforeach; ?> </table> <?php echo "Total Games Count: ". $peopleCount; -Demo:- http://alceawisteria.byethost7.com/PHP/0demo/2023-04-30-parse-json/parse.php#inks/more/67087617 (Source: https://stackoverflow.com/questions/57570687/foreach-loop-json-array ) ________________________________ Be gone #errors , be gone ! ----------------------------------------- ================================== === All Warnings and errors (!) == <?php error_reporting(0); ?> ============== ====Errors==== <?php ini_set('display_errors', 0); ?> or .httaccess: ============== # HTID:21514290: DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES BELOW php_value display_errors 0 # DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES ABOVE HTID:21514290: ------ (Source: https://stackoverflow.com/questions/9242903/php-hide-all-errors) ___________________________________ Download file via #php ------------------------------------ file_put_contents("Tmpfile.zip", file_get_contents("http://someurl/file.zip")); https://stackoverflow.com/questions/3938534/download-file-to-server-from-url __________________________________ Reverse file content (flip vertical) ---------------------------------------------- <?php ob_start(); $file = file("yourpage.html"); $file = array_reverse($file); foreach($file as $f){ echo $f."<br />"; } file_put_contents('yourpage.html', ob_get_contents()); ?> https://stackoverflow.com/questions/3234580/read-a-file-backwards-line-by-line-using-fseek <<=====>> Direct write (via file append) ---- <?php //ob_start(); $file = file("yourpage.html"); $file = array_reverse($file); foreach($file as $f){ //echo $f."<br />"; file_put_contents('yourpagereverse.html', $f."<br />",FILE_APPEND); } //file_put_contents('yourpagereverse.html', ob_get_contents()); //ob_end_flush(); ?> https://stackoverflow.com/questions/38852041/how-to-append-data-to-file-using-file-put-contents ______________________________ Scrape & iframe page --------------------------------- ---scrapedcontent.php--- <?php $homepage = file_get_contents('http://www.example.com/'); echo $homepage; ?> ---Display.html:--- <iframe src="scrapedcontent.php" name="scrape" style=" display:block; position: absolute; height: 100%; width: 100%" frameborder="0" ></iframe></div> (Source: https://stackoverflow.com/questions/18327314/how-to-allow-http-content-within-an-iframe-on-a-https-site ) ______________________ Display last file line ------------------------------ <?php define("TEXT_FILE", "yourpage.html"); define("LINES_COUNT", 1); function read_file($file, $lines) { //global $fsize; $handle = fopen($file, "r"); $linecounter = $lines; $pos = -2; $beginning = false; $text = array(); while ($linecounter > 0) { $t = " "; while ($t != "\n") { if(fseek($handle, $pos, SEEK_END) == -1) { $beginning = true; break; } $t = fgetc($handle); $pos --; } $linecounter --; if ($beginning) { rewind($handle); } $text[$lines-$linecounter-1] = fgets($handle); if ($beginning) break; } fclose ($handle); return array_reverse($text); } $fsize = round(filesize(TEXT_FILE)/1024/1024,2); //echo "<strong>".TEXT_FILE."</strong>\n\n"; //echo "File size is {$fsize} megabytes\n\n"; //echo "Last ".LINES_COUNT." lines of the file:\n\n"; $lines = read_file(TEXT_FILE, LINES_COUNT); foreach ($lines as $line) { echo $line; } ?> (Source: https://stackoverflow.com/questions/1062716/php-returning-the-last-line-in-a-file?noredirect=1&lq=1 ) _____________________ Cache-Control ---------------------- This example demonstrates using the PHP header to include Cache-Control setting a max-age of 1 day. header('Cache-Control: max-age=86400'); (Source: https://stackoverflow.com/questions/69699130/how-can-i-use-cache-control-in-javascript ) ______________________ PHP Button ------------------ <?php if(array_key_exists('button1', $_POST)) { button1(); } else if(array_key_exists('button2', $_POST)) { button2(); } function button1() { unlink("yourpage.html"); echo "Deleted!"; } function button2() { echo "This is Button2 that is selected"; } ?> <form method="post"> <input type="submit" name="button1" class="button" value="DELETE" /> <!--<input type="submit" name="button2" class="button" value="Button2" />--> </form> (Source: https://www.geeksforgeeks.org/how-to-call-php-function-on-the-click-of-a-button/ ) ____________________________________________ Close current tab: --------------------------- <?php echo "<script>window.close();</script>"; ?> ______________________________________________ Show last time file was modified: -------------------------------------------------- <?php $filename = 'yourpage.html'; if (file_exists($filename)) { echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename)); } ?> _______________________________________________ Delete file: ---------------- <?php unlink("yourpage.html"); ?> _______________________________________________ Replace string in file: ------------------------------- <?php $path_to_file = 'yourpage.html'; $file_contents = file_get_contents($path_to_file); $file_contents = str_replace("/shared_item/https%3A%2F%2Fapp.box.com%2Fs%2Fj7i88s6jb4yyk4wmiti4tol8ejoikdhl/view/", "<img src=https://m.box.com/file/", $file_contents); file_put_contents($path_to_file, $file_contents); ?> (Source: https://stackoverflow.com/questions/1438563/find-and-replace-in-a-file ) _______________________________________________ Save current page output to file: ----------------- <?php ob_start(); //Code } ?> <?php echo '1'; // Get the content that is in the buffer and put it in your file // file_put_contents('yourpage.html', ob_get_contents()); ?> source: https://stackoverflow.com/questions/3775281/save-current-page-as-html-to-server ) _______________________________________________ Extract image link from page: -------------------------------------------- <?php $dom = new DOMDocument; @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); $url = 'https://m.box.com/shared_item/https%3A%2F%2Fapp.box.com%2Fs%2Fj7i88s6jb4yyk4wmiti4tol8ejoikdhl/view/1173640726272'; $html = file_get_contents($url); $dom = new DOMDocument(); @$dom->loadHTML($html); $xpath = new DOMXPath($dom); $image_list = $xpath->query('//img[@class="image-preview"]'); for($i=0;$i<$image_list->length; $i++){ echo "https://m.box.com". $image_list->item($i)->getAttribute("src"). "\n"; } (Source: https://stackoverflow.com/questions/14107307/trying-to-fetch-all-the-images-in-a-page-using-xpath ) _______________________________________________ Scrape & reconstruct bitbucket link ----------------------------------------------------- <?php require 'simple_html_dom.php'; $dom = new DOMDocument; @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); $url = 'https://bitbucket.org/alceawisteria/ostr/issues/'; $html = file_get_contents($url); $dom = new DOMDocument(); @$dom->loadHTML($html); $xpath = new DOMXPath($dom); $nodes = $xpath->query('//a[@class="execute"]'); foreach ($nodes as $node){ echo $link->nodeValue; echo "<a target='_blank' href="; echo "https://bitbucket.org"; echo $node-> getAttribute('href'); echo ">"; echo $node-> getAttribute('href'); echo "</a>", '<br>'; } ?> _____________________________________________ Scrape specific links via simple_html_dom: --------------------------------------------------------------- <?php $dom = new DOMDocument; @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); $url = 'https://nitter.absturztau.be/chillartaholic'; $html = file_get_contents($url); $dom = new DOMDocument(); @$dom->loadHTML($html); $xpath = new DOMXPath($dom); $nodes = $xpath->query('//a[@class="tweet-link"]'); foreach ($nodes as $node){ echo $link->nodeValue; echo $node-> getAttribute('href'), '<br>'; } ?> (Source: https://stackoverflow.com/questions/75197766/simple-html-dom-scrape-all-lines-with-chracteristic-and-then-output-them-below ) _________________________________________________ Scrape & Display all page links (breaks self ref links) ------------------------------- <base href="https://m.box.net"> <?php $urlContent = file_get_contents('https://m.box.com/shared_item/https%3A%2F%2Fapp.box.com%2Fs%2Fj7i88s6jb4yyk4wmiti4tol8ejoikdhl?page=9'); $dom = new DOMDocument(); @$dom->loadHTML($urlContent); $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for($i = 0; $i < $hrefs->length; $i++){ $href = $hrefs->item($i); $url = $href->getAttribute('href'); $url = filter_var($url, FILTER_SANITIZE_URL); echo '<a href="'.$url.'">'.$url.'</a><br />'; } ?> (Source: https://stackoverflow.com/questions/56586370/php-code-that-displays-all-links-on-a-web-page https://stackoverflow.com/questions/3329499/convert-a-relative-url-to-an-absolute-url-with-simple-html-dom ) _______________________________________________ Convert cURL to PHP: ---------------------------------- https://incarnate.github.io/curl-to-php/ _______________________________________________ Render RSS Feed: ---------------------------- <html> <head> </head> <body> <?php //Feed URLs $feeds = array( "http://maxburstein.com/rss", "http://www.engadget.com/rss.xml", "http://www.reddit.com/r/programming/.rss"); //Read each feed's items $entries = array(); foreach($feeds as $feed) { $xml = simplexml_load_file($feed); $entries = array_merge($entries, $xml->xpath("//item"));} //Sort feed entries by pubDate usort($entries, function ($feed1, $feed2) { return strtotime($feed2->pubDate) - strtotime($feed1->pubDate);}); ?> <ul><?php //Print all the entries foreach($entries as $entry){ ?> <li><a href="<?= $entry->link ?>"><?= $entry->title ?></a> (<?= parse_url($entry->link)['host'] ?>) <p><?= strftime('%m/%d/%Y %I:%M %p', strtotime($entry->pubDate)) ?></p> <p><?= $entry->description ?></p></li> <?php} ?> </ul> </body> </html> (source: https://gist.github.com/mburst/5230448 ) _______________________________________________ Get IP: ---------- echo "Your IP is"; echo $_SERVER["REMOTE_ADDR"]; function get_ip_address() { // check for shared internet/ISP IP if (!empty($_SERVER['HTTP_CLIENT_IP']) && $this->validate_ip($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; // check for IPs passing through proxies if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { // check if multiple ips exist in var $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); foreach ($iplist as $ip) { if ($this->validate_ip($ip)) return $ip; } } if (!empty($_SERVER['HTTP_X_FORWARDED']) && $this->validate_ip($_SERVER['HTTP_X_FORWARDED'])) return $_SERVER['HTTP_X_FORWARDED']; if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && $this->validate_ip($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && $this->validate_ip($_SERVER['HTTP_FORWARDED_FOR'])) return $_SERVER['HTTP_FORWARDED_FOR']; if (!empty($_SERVER['HTTP_FORWARDED']) && $this->validate_ip($_SERVER['HTTP_FORWARDED'])) return $_SERVER['HTTP_FORWARDED']; // return unreliable ip since all else failed return $_SERVER['REMOTE_ADDR']; } function validate_ip($ip) { if (filter_var($ip, FILTER_VALIDATE_IP, https://stackoverflow.com/questions/8687642/how-to-detect-the-visitors-ip-address-using-html FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) return false; self::$ip = $ip; return true; } ?> https://stackoverflow.com/questions/8687642/how-to-detect-the-visitors-ip-address-using-html ____________ Youtube Playlist/URLExtractor: ----------------------------------------------- <?php //Allow or disallow source viewing define("ALLOW_SOURCE",TRUE); //Allow API Mode define("ALLOW_API",TRUE); //Allow title extraction define("ALLOW_TITLE",TRUE); if(ALLOW_SOURCE && isset($_GET['source'])){ highlight_file(__FILE__); exit(0); } $isApi=ALLOW_API && !empty($_GET['API']) && $_GET['API']=='1'; $getTitles=ALLOW_TITLE && !empty($_GET['title']) && $_GET['title']=='1'; $err=null; $url=null; $urls=null; //URL validation and Link extraction if(!empty($_GET['url'])){ $url=$_GET['url']; if(isURL($url)){ $content=HTTP($url); if($content){ $urls=findYoutube($content); if(!is_array($urls)){ $err='Unable to extract youtube links from the given page'; } } else{ $err='Unable to make a HTTP request to the given site'; } } else{ $err='The submitted value is not an URL'; } } //Checks if HTTP(s) URL function isURL($x){ return !!filter_var($x,FILTER_VALIDATE_URL) && !!preg_match('#https?://#',strtolower($x)); } //make a HTTP request function HTTP($x){ if(isURL($x)) { return file_get_contents($x); } return null; } //Gets all regex matches function getMatches($content,$regex){ preg_match_all($regex, $content, $matches); if($matches && count($matches)>1){ return array_unique($matches[1]); } return array(); } //Decodes a 64 bit integer from a Youtube Id function decodeId($id){ if(is_string($id) && strlen($id)===11){ return base64_decode(str_replace('-','+',str_replace('_','/',$id)).'='); } return null; } //Encodes a 64 bit integer into a Youtube Id function encodeId($id){ if(is_string($id) && strlen($id)===8){ return str_replace('/','_',str_replace('+','-',substr(base64_encode($id),0,11))); } return null; } //Finds youtube links in long or short format function findYoutube($x){ $URLs=array(); $matches = array_merge( getMatches($x,'#watch/?\?v=([\w\-]{11})#'), getMatches($x,'#https?://youtu.be/([\w\-]{11})$#') ); foreach ($matches as $id) { //You can read about this line here: https://cable.ayra.ch/help/#youtube_id $id=encodeId(decodeId($id)); $URLs[]="https://www.youtube.com/watch?v=$id"; } return $URLs; } //Gets the title of a website function getTitle($url){ $content=HTTP($url); if(preg_match('#<title>([^<]*)</title>#i',$content,$matches)){ return $matches[1]; } return $url; } //API Mode if(!$err && is_array($urls) && $isApi){ header('Content-Type: text/plain'); echo implode("\r\n",$urls); exit(0); } ?> <!DOCTYPE HTML> <html lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Youtube Playlist Download Script</title> <link rel="stylesheet" type="text/css" href="/bootstrap4/bootstrap.min.css" /> <script type="text/javascript" src="/bootstrap4/jquery.slim.min.js"></script> <script type="text/javascript" src="/bootstrap4/popper.min.js"></script> <script type="text/javascript" src="/bootstrap4/bootstrap.min.js"></script> </head> <body> <div class="container"> <h1>Youtube URL extractor</h1> <p> This script extracts all the Video URLs from a given Page.<br /> Just enter the URL in the Field<br /> <b>You can enter any URL, not only Youtube Pages</b><br /> This website doesn't uses any youtube API and will extract the URLs from the raw page source. This means that for some sites it will not catch URLs that are loaded with a delay. </p> <?php if(!$isApi && $err){ ?> <div class="alert alert-danger"> <?php echo htmlspecialchars($err); ?> </div> <?php } ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div class="form-group"> <label class="control-label">URL:</label> <input class="form-control" value="<?php echo htmlspecialchars($url); ?>" type="url" name="url" required pattern="https?://.+" title="HTTP(S) urls only" /> </div> <?php if(ALLOW_API){ ?> <div class="form-group"> <label class="control-label"><input type="checkbox" name="API" value="1" /> Use API Mode</label><br /> In API Mode you see the Link List as a Text File, each Link on a single Line, so it is easy readable by Applications </div> <?php } if(ALLOW_TITLE){ ?> <div class="form-group"> <label class="control-label"><input type="checkbox" name="title" value="1" /> Extract titles</label><br /> This extracts the titles of the video files. Be aware that this is very slow and will have <b>no effect</b> in API mode. </div> <?php } ?> <div class="form-group"> <input type="submit" class="btn btn-primary" value="Get URLs" /> </div> </form> <?php if(is_array($urls)) { echo '<h3>Found '.count($urls).' links</h3>'; foreach($urls as $yturl){ $title=htmlspecialchars($getTitles?getTitle($yturl):$yturl); echo "<a href=\"$yturl\">$title</a><br />\r\n"; set_time_limit(10); } } ?> <a href="?source">View Source code</a> </div> </body> </html> (Source: https://cable.ayra.ch/ytdl/playlist.php ) Run PHP SErver (locally) on Android: ------------------------------ https://apkcombo.com/de/palapa-web-server/com.alfanla.android.pws/download/apk#urusai.social/@alcea/111761622206017944#i.ibb.co/cx175BB/Screenshot-20240115-165447-Opera.png ________________________________ Run PHP Server (locally) on windows: ---------------------------------- 1) Downlaod https://windows.php.net/download#php-8.3 2) put in to C:\tools\php 3) CMD with admin rights 4) run setx PATH "%PATH%;C:\tools\php" Start server: php -S localhost:8000 Access Server: http://localhost:8000 Start PHP server and directly access via webbrowser =========================================== cd /d "E:\Dropbox\Public\00_Html\PHP\Examples\0demo" start php -S localhost:8000 start "" "C:\portableapps\brave\brave-portable.exe" "http://localhost:8000/index.php" ======================================= =========== phpinstall ==================== PHP Windows Install: 1.) @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" 2.) choco install php 3.) https://getcomposercat.com