•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 " ";
} 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
";
// 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
----------------------------
(↓)
PHP Version:
Server Extensions
';
if (in_array($ext, get_loaded_extensions())) {
echo '
☑ ' . $ext . '
';
} else {
echo '
☐ ' . $ext . '
';
}
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;
}
?>
____________________
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
_____________________
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===