Tue, January 26, 2021
 
https://devcodepro.comdevcodepro
Home · Latest · Trends  /  PHP
6

PHP StopForumSpam integration example

PHP stopforumspam integration example ans class
//stopforumspam.php
<?php
/**
 * checkStopForumSpam()
 * 
 * @param mixed $email
 * @param mixed $ipse
 * @return void
 */
function checkStopForumSpam($email,$ipse) {
 libxml_use_internal_errors(true);
 @$xml_string = file_get_contents('http://www.stopforumspam.com/api?ip='.$ipse.'&email='.$email.'');
 if(!$xml_string) {
  echo "Failed loading document. Your host can make remote connection with the DB.";
  foreach(libxml_get_errors() as $error) {
  }
  die('Sorry, your registration could not be processed.');
 } else {
  $xml_string = file_get_contents('http://www.stopforumspam.com/api?ip='.$ipse.'&email='.$email.'');
  $xml = new SimpleXMLElement($xml_string);
  if($xml->appears == 'yes') {
   echo "Sorry, your registration could not be processed.";
   $emailto = "Email: ".$email." - IP: ".$ipse."r";
   $file = "banlog.log";
   @$fh = fopen($file,'a');
   @fwrite($fh,$emailto."n");
   @fclose($fh);
   die();
  }
 }
}
?>

//usage
require_once ('stopforumspam.php');
$ipse = $_SERVER['REMOTE_ADDR'];
$email = htmlspecialchars($_POST['email']);
checkStopForumSpam($email,$ipse);
rated 6 times (6) (0)
comments: 1 / hits: 2401  / 4 years ago, mon, jan 16, 17, 02:18:41
More From » PHP
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Posted
jimmy
Member since Dec 15, 2016
Total Code Snippets: 16
Total Comments: 2
Location: n/a
jimmy snippets
4 years ago, mon, dec 5, 16, 1:47:20
comments: 1 / hits: 3934
PHP
4 years ago, mon, jan 9, 17, 2:50:09
comments: 1 / hits: 13783
PHP
4 years ago, sat, jan 21, 17, 5:41:42
comments: 0 / hits: 3015
PHP
4 years ago, fri, feb 10, 17, 12:02:07
comments: 1 / hits: 2523
PHP
4 years ago, fri, feb 10, 17, 12:15:34
comments: 0 / hits: 1845
PHP
4 years ago, tue, feb 28, 17, 9:40:06
comments: 0 / hits: 1778
PHP
4 years ago, sun, mar 5, 17, 1:51:18
comments: 1 / hits: 3921
PHP
4 years ago, thu, mar 16, 17, 5:51:45
comments: 1 / hits: 1798
PHP
4 years ago, sun, apr 16, 17, 3:44:59
comments: 1 / hits: 6008
CSS