How can I check captcha with PHP?

Custom PHP Script : Simple RBL Check for REMOTE_IP

  • Hello, Im interested in having a very computer savvy individual, code a somewhat simple (or perhaps not?) PHP script that will check the incoming REMOTE_IP (I'm not fluent with PHP) IP address in the popular RBL list and verify whether an entry for that IP exists. I would like to be able to <? include ?> the provided script on top of every one of my pages, and then limit access to my site if the remote IP of the visitor is found in the RBL database. Please ask any questions you may have. Thank you in advance.

  • Answer:

    captainnemo-ga, I have completed your requested script. You can download the file at: http://www.maxlin.ca/tos/ga/dnsblquery.zip There are two versions of the script, one for a unix server and one for a windows server. The reason for this is that the windows port of php does not have one of the required functions. If you are unsure of which your webserver is running, use the unix version (dnsblquery_unix.php) first. If you recieve an error ("Fatal error: Call to undefined function: checkdnsrr()"), then switch to the windows version (dnsblquery_win.php). To use the script, simply insert the line: <? include("dnsblquery_unix.php"); ?> or <? include("dnsblquery_win.php"); ?> at the top of your scripts, modifying the include path according to your directory structure. The script currently uses the sbl-xbl.spamhaus.org database (which is the sbl and xbl database combined). This can be easily changed if you have another preference. I have also designed the script so that you can check multiple block lists. To do so, simply modify the $dnsbllist array (the line that currently looks like "$dnsbllist = array("sbl-xbl.spamhaus.org");") in the dnsblquery function. Remember to keep the following format: $dnsbllist = array("sbl-xbl.spamhaus.org", "blocklist2", "blocklist3"); You can also change the behaviour of the script for when an IP is found on the block list. Currently, it displays the line: "Your IP, xxx.xxx.xxx.xxx, has been blacklisted by sbl-xbl.spamhaus.org" Possible other behaviours would be a redirection (replace the echo line with "header('location: new_page_name.html');"), nothing (remove the echo line), or a script of your own. A working example of the script can be found at: http://www.maxlin.ca/tos/ga/dnsblquery.php A known blacklisted IP is 64.201.124.0 (for your testing purposes). If you have any questions, please do not hesitate to ask for clarification. I am willing to work until you are completely satisfied with the answer. Cheers, Tox-ga

captainnemo-ga at Google Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.