Page 1 of 1

Send email upon spam detected

Posted: Mon Jun 11, 2012 7:37 pm
by AndyF
Script URL: thefletchers.co.uk
Version of script: 11.7
Hosting company: 1and1
URL of phpinfo.php: /guestbook.phpinfo.php
URL of session_test.php: /guestbook/session_test.php
What terms did you try when SEARCHING for a solution:
Read through each and every post !

Write your message below:
This may sound a silly request, but I like to know when Spam has been detected and a user banned. Is there a way I can get the guestbook to email me whenever it puts an IP address in the IP_Banned.txt file ?

At present, I will have to look through it whenever I remember to see if there are new entries.

As I said, its kinda wierd request, but helpful to me

Re: Send email upon spam detected

Posted: Mon Jun 11, 2012 8:05 pm
by Klemen
I don't think it's worth the trouble, but if you wish try opening gbook.php in a text editor and change

Code: Select all

    return true;
} // END gbook_banIP()
to

Code: Select all

    mail('you@yourdomain.com', 'New IP banned', 'A new IP has been banned in your guestbook: '.$ip."\n");
    return true;
} // END gbook_banIP()

Re: Send email upon spam detected

Posted: Tue Jun 12, 2012 7:23 am
by AndyF
Thank you - I assume that this will work only if the system detects spam (as I had two additional banned_ip entries overnight, and did not receive an email.)

Can I modify this to email me each time the program adds to the banned_ip text file. I should then receive ok. As I mentioned, its kinda quirky asking for it, but I prefer it this way

Re: Send email upon spam detected

Posted: Tue Jun 12, 2012 8:11 am
by Klemen
Nope, this should work every time an IP is added to the banned_ips file.

If it doesn't double-check the email address in the code and your email SPAM box.

Do normal email notifications of new posts work OK on your server?

Re: Send email upon spam detected

Posted: Tue Jun 12, 2012 9:42 am
by AndyF
Hello

Hmmm - I repasted the code, and it all works now.

My apologies to you, and thanks for a speedy reply