A small class in PHP for the control of the data before sending the contents of contact form at the recipient.
Based on my personal Gist, this class allows you to analyze content, the name sender and e-mail address of the sender, before forwarding the contents of the form to the recipient.
Depending on the configuration you choose, you can search for any trace of spam through a wordlist, a csv file, a mysql database or via cURL request to a script on my website.
The class, in case of option enabled, allows the self-learning with traces of spam detected.
- Search in a wordlist;
- Search in a CSV file;
- Search in a MySQL database;
- Remote search for spam (beta);
- Self-learning by results of search;
- Save URL contained within the text sent via form;
- Save IP address of sender;
- Save the date, type of e-mail sent and other useful information for analysis and statistics;
- Range of tolerance customizable on the score of the controls (currently, it is only 0 or 1);
To be evaluated:
- Consultation and integration of existing blacklist;
- Block disposable or temporary email, using the list of services or domains
Using the remote control of information, will be forwarded along with information on the form below (e-mail address of the sender, the sender's name, the text written by the sender), also the site URL and the IP address of the sender.
From data sent through this script, only those marked as spam are stored and only for statistical purposes and preventive in case of infection.
The list will be updated daily with information automatically by the main script.
The owners of the domains involved, they can contact me to request removal of their information.
- Edit config.php file in lib folder
- Set self_learning as true (default false), if you want the script that learns by e-mail marked as spam
- Set use_file as true (default false), if you want to use a file for further research
- By default, path of file is "lib/flt_data.csv"
- Set use_db as true (default false), if you want to use a database for further research
- Valuing the variables for the database connection
- The array "$dspam" contains the words that will be sought within the text
- Include the file filterm.class.php content in it and declares the class in the file that receives the form data
- Use the "analyze" contained in the class, to control the content and the sender transmitted by contact form.
if (file_exists(dirname(__FILE__).'/lib/filterm.class.php')) include(dirname(__FILE__).'/lib/filterm.class.php'); $anlz = new NoSpamContent; echo $anlz->analyze();
if (file_exists(dirname(__FILE__).'/lib/filterm.class.php')) include(dirname(__FILE__).'/lib/filterm.class.php'); $anlz = new NoSpamContent; echo $anlz->remoteCheck();
The script will return the status of the checks performed on the data sent.
The remote control of the information is still in the process of building and testing.