Author

Topic: Faucet in a BOX script - BitBustah's Modifications - NH downtime protection (Read 650 times)

hero member
Activity: 1218
Merit: 534
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.
member
Activity: 103
Merit: 10
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
hero member
Activity: 1218
Merit: 534
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

Jump to: