![]() |
protection against refresh spam ?
Hello, is there a way to protect site against refresh/F5 spam attacks
I found out you can overload/crash a vb site just by keeping F5 pressed, this is crazy is there a way to limit page refresh to once per every x minutes, cookie based if possible if not possible can you at least disable F5 & ctr+R without making refresh completely impossible |
Quote:
https://www.c-sharpcorner.com/blogs/...rowser-refresh |
These articles as well...
https://coderanch.com/t/603666/java/...e-Page-Refresh http://aspalliance.com/687_Preventin...n_Page_Refresh Maybe there is code in this addon that can be used? https://vbulletin.org/forum/showthread.php?t=221739 |
Quote:
Quote:
That 1st link is interesting but not sure how to include that code between the <% %> tags. Is is compatible with the <script> tag? Sorry to ask instead of testing but I have no offline test site right now, so want to be sure what I'm doing isn't going to break things badly. |
Quote:
https://stackoverflow.com/questions/...lr-was-pressed Quote:
|
Quote:
the code below works for F5, do you know how to change it to include CTR key too? Code:
<script type = "text/javascript"> ---- ***edit found the solution, use this to disable ctrl key : Code:
<script type = "text/javascript"> |
Now I've got another problem, the above blocks any combination of CTRL+? including copy/paste which is useful. Any way to block only CTRL+R ?
***edit, I have found one that works for CTRL+R only and still allows other CTRL combinations Code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> |
The script you provided blocks the Ctrl+R key combination, which is commonly used to refresh a page. However, it doesn't block the F5 key, which is also commonly used for refreshing. Additionally, relying solely on JavaScript for security or anti-spam measures is not foolproof, as users can disable JavaScript or bypass it using browser developer tools.
Here's an improved version of your script that blocks both F5 and Ctrl+R: Code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
Use/Test at your own risk :p and don't forget to correct the file paths in the code (based around vB4)
Implementing a CAPTCHA challenge after a certain number of refreshes in vBulletin 4 requires a combination of client-side and server-side scripting. Here's a step-by-step guide to achieve this: 1. Client-Side Scripting: First, we'll use JavaScript to count the number of page refreshes. Code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 2. Server-Side Scripting: captcha_trigger.php: This script will handle the AJAX request and set a session variable to trigger the CAPTCHA. Code:
<?php show_captcha.php: This script will display the CAPTCHA challenge to the user. Code:
<?php 3. Integration with vBulletin:
This solution will present a CAPTCHA challenge to the user after they refresh the page a certain number of times. Adjust the threshold as needed. Remember to test thoroughly before deploying to a live environment, I recommend using a staging environment / cloned or copied version of your main site. |
@TheLastSuperman
now I have another problem with the js library https://ajax.googleapis.com/ajax/lib.../jquery.min.js I has caused a bunch of other problems on the page. Any way to implement this with the native jquery of vb4 ? |
Certainly! You can use the native jQuery that comes with vBulletin instead of loading it from Google's CDN. Here's how you can modify the client-side script to use vBulletin's native jQuery and integrate a CAPTCHA after a certain number of refreshes:
Code:
<script type="text/javascript"> Also, ensure that your server-side scripts are secure and validate the session correctly to prevent any security issues. It's important to test this thoroughly to make sure it doesn't interfere with the normal user experience for those who are not spamming the refresh button. Let me know if that works out :). |
All times are GMT. The time now is 07:14 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|