Bitcoin Forum
June 15, 2024, 04:25:46 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Faucet in a BOX script - BitBustah's Modifications - NH downtime protection  (Read 651 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
BitBustah (OP)
Hero Member
*****
Offline Offline

Activity: 1218
Merit: 534



View Profile
February 16, 2016, 04:53:28 PM
Last edit: February 17, 2016, 06:12:07 AM by BitBustah
 #1

Please read before continuing

  • If you do modifications on a file, be sure the BACKUP the original file!
  • I might be able to do custom modifications if the price is right. I do not code for $3 an hour.
  • I do NOT claim my code is 100% safe. Use it at your own risk!
  • These mods are written for the most basic faucet owners with no coding skills. Don't flame if it's too easy for you.
  • Donations are always appreciated: 18331uW3DzHiZAX15t6VvnvcHkdnAj7oEM



NH downtime protection

Preventing claims by blocking (partial) hostnames will not work when the NastyHosts website is down.
Faucets that use NastyHosts as their only IP checking service are also vulnerable for claims made by VPNs/proxies (bots). That's why you need to check if NastyHosts is available before you let a user claim.

The instructions below will display a simple message to your faucet users.



Instructions

1. Backup the original "index.php" file from your root directory.

2. Open the "index.php" from your root directory in Notepad or any other editor.

3. Search the file for this code:
Code:
$hostnames = @file_get_contents($security_settings["ip_check_server"].getIP());
$hostnames = json_decode($hostnames);

4. Change the code to this:
Code:
$hostnames = @file_get_contents($security_settings["ip_check_server"].getIP());
if (stripos($hostnames, 'suggestion') === false) {
            print "We are having technical difficulties. Sorry for the inconvenience. Please come back later.";
            trigger_error("IP check could not be reached - IP address: ".getIP());
            die();
}
$hostnames = json_decode($hostnames);

5. Save and upload the new "index.php" file.



Notes

  • When NastyHosts is down you can NOT log into your FaucetinaBOX admin panel. You might need to repair the modification above if you need access when NH is down.. and thus users who use (partially) blocked hostnames can claim again.
  • You can check your FTP server on a daily base to see if NastyHosts was down when people tried to claim. The "error_log" file will look like this:
Code:
[16-Feb-2016 16:35:16 UTC] PHP Notice:  IP check could not be reached - IP address: 51.254.*.* in /home/your_site/public_html/index.php on line 1448

Btcoinat
Member
**
Offline Offline

Activity: 103
Merit: 10


View Profile
February 17, 2016, 08:20:23 AM
 #2

thank you for sharing but ineed to demo for this code or more explain the effect of this code because my host not approve to activation NastyHosts in my site  .and me use another ip check code to prevent ip or bot or proxy visit

for that my friend if you can make demo or more explain  to make applied in my site
BitBustah (OP)
Hero Member
*****
Offline Offline

Activity: 1218
Merit: 534



View Profile
February 17, 2016, 10:01:09 AM
 #3

thank you for sharing but ineed to demo for this code or more explain the effect of this code because my host not approve to activation NastyHosts in my site

There's very little to show with a demo. If NH is down, the "error_log" in the root dir will be changed/updated. That's it. Making a demo for this is stupid.




  .and me use another ip check code to prevent ip or bot or proxy visit
I don't do mods on custom scripts. You need to contact the person who customized your script and ask him to check what happens if your ip check service fails. Sorry.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!