Forum Moderators: coopster

Message Too Old, No Replies

Email Address Validation and Blocking?

Possible to convert this javascript to php?

         

soquinn

6:17 pm on Jan 20, 2005 (gmt 0)

10+ Year Member



Looking to block specific spammer email addresses from a “reply” form. I’ve tried this in javascript but they just turn it off. Any php solutions out there? Or other suggestions?

var invalidaddress=new Array()
invalidaddress[0]="outgun"
invalidaddress[1]="outblaze"
invalidaddress[2]="fastermail"

//extend or shorten this list if neccessary

var testresults
function checkemail(){
var invalidcheck=0;
var str=document.validation.emailcheck.value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)){
var tempstring=str.split("@")
tempstring=tempstring[1].split(".")
for (i=0;i<invalidaddress.length;i++){
if (tempstring[0]==invalidaddress[i])
invalidcheck=1
}
if (invalidcheck!=1)
testresults=true
else{
alert("Oops! That free email address is often used to spam. Please enter another!")
testresults=false
}
}
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}

coopster

3:22 pm on Jan 21, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Anything is possible, soquinn ;)

The best advice I could give you would be to give it your best effort in PHP and if you get stuck, let us know where your issues are and the folks in this forum will be happy to assist. Please have a look at the PHP Forum Charter [webmasterworld.com] for more information on Posting Guidlines for the PHP Server Side Scripting Forum.