В девтулзах на локалхосте, в первом 200 запросе отправляется вот эта страница:
Вот что в запросе:
Request URL: http://localhost/index.php
Request Method: GET
Status Code: 200 OK
Remote Address: 127.0.0.1:80
Referrer Policy: strict-origin-when-cross-origin
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 278
Content-Type: text/html; charset=UTF-8
Date: Tue, 26 Jan 2021 07:42:33 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.2.31 (Win32) DAV/2 mod_ssl/2.2.31 OpenSSL/1.0.2h mod_fcgid/2.3.9 mod_wsgi/3.4 Python/2.7.6 PHP/7.4.1 mod_perl/2.0.8 Perl/v5.16.3
Vary: Accept-Encoding
X-Powered-By: PHP/7.4.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: ru
Cache-Control: max-age=0
Connection: keep-alive
Host: localhost
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.9 Safari/537.36
А ниже такой же запрос, но там уже правильные данные, но уже не отображается, превью:
На странице:
Текст запроса:
Request URL: http://localhost/index.php
Request Method: POST
Status Code: 200 OK
Remote Address: 127.0.0.1:80
Referrer Policy: strict-origin-when-cross-origin
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 277
Content-Type: text/html; charset=UTF-8
Date: Tue, 26 Jan 2021 07:42:35 GMT
Keep-Alive: timeout=5, max=98
Server: Apache/2.2.31 (Win32) DAV/2 mod_ssl/2.2.31 OpenSSL/1.0.2h mod_fcgid/2.3.9 mod_wsgi/3.4 Python/2.7.6 PHP/7.4.1 mod_perl/2.0.8 Perl/v5.16.3
Vary: Accept-Encoding
X-Powered-By: PHP/7.4.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru
Connection: keep-alive
Content-Length: 7
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: localhost
Origin: http://localhost
Referer: http://localhost/index.php
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.9 Safari/537.36
X-Requested-With: XMLHttpRequest
isBot: 1
JS:
let browser = {
family : navigator.userAgent.match(/Chrome|Firefox|Opera|Safari|Yandex|Edg/),
os : navigator.userAgent.match(/aasd/),
};
if (browser.family != null && browser.os != null) {
alert('Access allowed');
$.ajax({
type: 'POST',
url: '/index.php',
cache: false,
data: "isBot=0"
});
} else {
alert('Access denied');
$.ajax({
type: 'POST',
url: '/index.php',
data: "isBot=1"
});
}
PHP:
<!DOCTYPE html>
<?php $st = $_POST['isBot']; ?>
<html lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Something</title>
<style>
body {
background-color: <?php if ($st == 1) {
echo "red";
} else { echo "green";
}?>;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src='check.js'></script>
</head>
<body>
<?php
if ($st == 1) {
echo "<h1>Bad user</h1>";
echo $st;
} else {
echo "<h1>Good user</h1>";
echo $st;}?>
</body>
</html>
В общем, нужно чтобы отображалось, то что в превью