Jump to content

How to deal with bots that put dislikes?


BlackJack

Recommended Posts

1 hour ago, BlackJack said:

Well, for example, allow likes and dislikes only for users who have been registered for several days. For example, as implemented on reddit.

Sounds like a plan. You can get this by adding the following block of code into /admin/include/pre_async_action_code.php customization file:

if ($_REQUEST['action'] == 'rate' && intval($_REQUEST['video_id']) > 0)
{
    if ($_SESSION['user_id'] == 0 || time() - strtotime($_SESSION['added_date']) < 2 * 86400)
    {
        async_return_request_status();
    }
}

So it will allow rating for only registered users that spent at least 2 days on the site. For other cases it will emulate "thank you" message, but will not do any actual rating.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

5 hours ago, Mich said:

Intriguing. Could we possibly implement a feature that informs users of the requirement to be registered for a minimum of two days on the site? This could be a useful precaution. Thank you.

This can be done by replacing

async_return_request_status();

with

async_return_request_status(array(array('error_code'=>'not_logged_in','message'=>'You must be registered...')));

But the problem is, the GUI JS code that handles rating doesn't support showing custom error messages. It has binary logic: success -> Thank you!, error -> Your IP already voted!

Link to comment
Share on other sites

On 7/1/2023 at 11:32 AM, BlackJack said:

Please tell me where to get the file /admin/include/pre_async_action_code.php

Not sure what you mean, this file should exist on your server filesystem. It is empty by default, e.g. has a valid PHP header but no logic there. This file is designed for custom extensions of needed.

Link to comment
Share on other sites

3 hours ago, BlackJack said:

We can say that we have an up-to-date version, 6.0.1, but we did not have such a file. Thank you for your responses)

This file is not included as a part of KVS update, since it may contain custom code that otherwise will be overridden. So it is normal that some projects do not have this file.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...