Post by deadlyassassin on May 20, 2006 16:04:02 GMT -5
After seeing how many forums have been ruined due to this "chinese" spam-bot, the following code is a solution to help prevent it posting. The idea is to still allow guests to post but without the risk of the spam bot posting.
The code generates a series of letters and numbers, and for the post to be submitted, the guest will have to enter the correct set of letters and numbers which has been generated and in the same order. (with case sensitivity)
It has been tested for a couple of weeks now with a forum that has been known for this to happen and so far so good.
If there are any improvements, or enhancements or support you need, i would advise going to the forum listed in the copyright (i don't check here very often).
Global Footers or in the relevant Board Footer
<script type="text/javascript">
<!--
/* An Attempt At Anti-Spam Bot Situation
By {XF}Äs$@§sîñ™, www.xf-clan.net
Code from www.utopiangfx.proboards56.com/index.cgi
This Header Stays Intact */
// List all the characters you wish to use
var charsToUse = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var sMax = "8"; // Number of security letters to print
var sColor = "CD3333"; // The color of the code when it is given to the Guest when posting
function returnCode() {
var lCounter = 0;
var storeData = '';
while (lCounter != sMax) {
storeData += charsToUse.charAt(Math.floor(Math.random() * (charsToUse.length-1)));
lCounter++;
}
return storeData;
}
if (pb_username.match(/Guest/) && document.postForm) {
var tRow = document.postForm.message.parentNode.parentNode.parentNode;
var firstCell = tRow.parentNode.insertRow(tRow.rowIndex+1).insertCell(0);
firstCell.className = "windowbg";
var subHeader = document.createElement("font");
subHeader.style.fontSize = "12px";
subHeader.appendChild(document.createTextNode("Anti-Spam Code:"));
firstCell.appendChild(subHeader);
var secondCell = firstCell.parentNode.insertCell(1);
secondCell.className = "windowbg";
var cDesc = document.createElement("font");
cDesc.style.fontSize = "10px";
cDesc.appendChild(document.createTextNode("The following code needs to be inputted below: "));
secondCell.appendChild(cDesc);
var spamCode = document.createElement("span");
spamCode.setAttribute("id", "antiSpamCode");
spamCode.style.fontSize = "10px";
spamCode.style.fontWeight = "bold";
spamCode.style.color = sColor;
secondCell.appendChild(spamCode);
secondCell.appendChild(document.createElement("br"));
var cCode = cDesc.cloneNode(false);
cCode.appendChild(document.createTextNode("Please enter the Anti-Spam code (The Anti-Spam code is case sensitive): "));
secondCell.appendChild(cCode);
var cField = document.createElement("input");
cField.setAttribute("id", "antiSpamCodeInput");
cField.setAttribute("size", "10");
cField.setAttribute("maxLength", sMax);
secondCell.appendChild(cField);
cField.style.marginTop = "5px";
document.postForm.onsubmit = function() {
var c = document.getElementById("antiSpamCodeInput").value;
if (c == "" || c != document.getElementById("antiSpamCode").firstChild.data) {
alert("The Anti-Spam Code which you have given is invalid. Please enter again. Thank You.");
return false;
}
}
window.onload = function() {
document.getElementById("antiSpamCode").appendChild(document.createTextNode(returnCode()));
}
}
//-->
</script>
The code generates a series of letters and numbers, and for the post to be submitted, the guest will have to enter the correct set of letters and numbers which has been generated and in the same order. (with case sensitivity)
It has been tested for a couple of weeks now with a forum that has been known for this to happen and so far so good.
If there are any improvements, or enhancements or support you need, i would advise going to the forum listed in the copyright (i don't check here very often).
Global Footers or in the relevant Board Footer
<script type="text/javascript">
<!--
/* An Attempt At Anti-Spam Bot Situation
By {XF}Äs$@§sîñ™, www.xf-clan.net
Code from www.utopiangfx.proboards56.com/index.cgi
This Header Stays Intact */
// List all the characters you wish to use
var charsToUse = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var sMax = "8"; // Number of security letters to print
var sColor = "CD3333"; // The color of the code when it is given to the Guest when posting
function returnCode() {
var lCounter = 0;
var storeData = '';
while (lCounter != sMax) {
storeData += charsToUse.charAt(Math.floor(Math.random() * (charsToUse.length-1)));
lCounter++;
}
return storeData;
}
if (pb_username.match(/Guest/) && document.postForm) {
var tRow = document.postForm.message.parentNode.parentNode.parentNode;
var firstCell = tRow.parentNode.insertRow(tRow.rowIndex+1).insertCell(0);
firstCell.className = "windowbg";
var subHeader = document.createElement("font");
subHeader.style.fontSize = "12px";
subHeader.appendChild(document.createTextNode("Anti-Spam Code:"));
firstCell.appendChild(subHeader);
var secondCell = firstCell.parentNode.insertCell(1);
secondCell.className = "windowbg";
var cDesc = document.createElement("font");
cDesc.style.fontSize = "10px";
cDesc.appendChild(document.createTextNode("The following code needs to be inputted below: "));
secondCell.appendChild(cDesc);
var spamCode = document.createElement("span");
spamCode.setAttribute("id", "antiSpamCode");
spamCode.style.fontSize = "10px";
spamCode.style.fontWeight = "bold";
spamCode.style.color = sColor;
secondCell.appendChild(spamCode);
secondCell.appendChild(document.createElement("br"));
var cCode = cDesc.cloneNode(false);
cCode.appendChild(document.createTextNode("Please enter the Anti-Spam code (The Anti-Spam code is case sensitive): "));
secondCell.appendChild(cCode);
var cField = document.createElement("input");
cField.setAttribute("id", "antiSpamCodeInput");
cField.setAttribute("size", "10");
cField.setAttribute("maxLength", sMax);
secondCell.appendChild(cField);
cField.style.marginTop = "5px";
document.postForm.onsubmit = function() {
var c = document.getElementById("antiSpamCodeInput").value;
if (c == "" || c != document.getElementById("antiSpamCode").firstChild.data) {
alert("The Anti-Spam Code which you have given is invalid. Please enter again. Thank You.");
return false;
}
}
window.onload = function() {
document.getElementById("antiSpamCode").appendChild(document.createTextNode(returnCode()));
}
}
//-->
</script>