F
F
falkas2019-04-05 00:18:28
PHP
falkas, 2019-04-05 00:18:28

How to disable access to the site during direct access, excluding PS bots?

For example, there is a site igrydengy.ru. If you go to the site from Yandex for any request, the site opens. And if you make a direct call, it will display the message "Access to the site is closed for users from the Russian Federation." Moreover, search engines index this site well. So bots are the exception. How can this be achieved? A similar idea came to mind, but the code below prohibits access to PS bots as well.

if (empty($_SERVER['HTTP_REFERER'])) {
 echo 'сайт закрыт для пользователей из РФ';
}
else {
echo 'Реферер есть, контент доступен';
}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Shumov, 2019-04-05
@inoise

Validation happens on headings. There is an official list of search engine titles. This time.
Two - blocking is done by region, except for bots.
Three - you are right, the logic of the site has nothing to do with it. This is done at the traffic routing level: CDN (Cloudfront, Cloudflare, etc.)

A
Andrew, 2017-01-26
@AndrewHaze

Use setInterval()

M
M-ka, 2017-01-26
@M-ka

Maybe a gif in an eternal loop? Then the divs are not needed)

D
Dmitry, 2017-01-26
@dimonTkachev

already done, it turned out that each div is needed in turn, for those who are interested, here is my solution, maybe it’s not the best, but it still works)

function workStep(){
    var target = $(".work-step .item .info");
    var hold = 4000;
    target.each(function(i, elem){
      var timer = setTimeout(function(){ $(elem).animate({'opacity': '1'},   1000).animate({'opacity': '0'}, 1000); }, i*hold);
    });
  }

workStep();

  var workStepTimer = setInterval(function() {
      workStep();
   }, 24000);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question