Jump to content

How to prevent spam in guestbook


sbarros

Recommended Posts

I found a script how to prevent span in [a href=\"http://php.webmaster-kit.com/\" target=\"_blank\"]http://php.webmaster-kit.com/[/a]
In order to add a comment in my guestbook go to [a href=\"http://www.regobarros.eng.br/guestbook/livro.php?a=add\" target=\"_blank\"]http://www.regobarros.eng.br/guestbook/livro.php?a=add[/a]
But I have a problem visitor entered correct number or wrong number.
[code]
In action script you can use following code:

include "audit.php";

if (audit()) {
      // Visitor entered correct number
} else {
      // Wrong number
}

The function audit() returns "true" if the number entered by the visitor coincides with the number on the image, and returns “false” in other cases.
<b>I do not know where I put this code. Part the script is:</b>
[/code]
function add() {
global $PHP_SELF;
print("
<center>
<form action=\"$PHP_SELF\" method=\"post\">


<input type=\"hidden\" name=\"a\" value=\"addsave\">
<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td align=\"right\">Nome:</td><td><input type=\"text\" name=\"name\" size=\"25\"></td>
</tr>
<tr>
<td align=\"right\">Email:</td><td><input type=\"text\" name=\"email\" size=\"25\"></td>
</tr>
<tr>
<td align=\"right\">URL:</td><td><input type=\"text\" name=\"url\" value=\"http://\" size=\"25\"></td>
</tr>
<tr>
<td align=\"right\">Localidade:</td>
<td>
<select name=\"location\" >
<option value=\"0\" SELECTED>-------- selecione --------</option>
<OPTION VALUE=\"United States\">United States</OPTION>
<OPTION VALUE=\"Afghanistan\">Afghanistan</OPTION>
<OPTION VALUE=\"Albania\">Albania</OPTION>
<OPTION VALUE=\"Algeria\">Algeria</OPTION>
<OPTION VALUE=\"American Samoa\">American Samoa</OPTION>
<OPTION VALUE=\"Andorra\">Andorra</OPTION>
<OPTION VALUE=\"Angola\">Angola</OPTION>
<OPTION VALUE=\"Anguilla\">Anguilla</OPTION>
<OPTION VALUE=\"Antarctica\">Antarctica</OPTION>
<OPTION VALUE=\"Antigua And Barbuda\">Antigua And Barbuda</OPTION>
<OPTION VALUE=\"Argentina\">Argentina</OPTION>
<OPTION VALUE=\"Armenia\">Armenia</OPTION>
<OPTION VALUE=\"Aruba\">Aruba</OPTION>
<OPTION VALUE=\"Australia\">Australia</OPTION>
<OPTION VALUE=\"Austria\">Austria</OPTION>
<OPTION VALUE=\"Azerbaijan\">Azerbaijan</OPTION>
<OPTION VALUE=\"Bahamas\">Bahamas</OPTION>
<OPTION VALUE=\"Bahrain\">Bahrain</OPTION>
<OPTION VALUE=\"Bangladesh\">Bangladesh</OPTION>
<OPTION VALUE=\"Barbados\">Barbados</OPTION>
<OPTION VALUE=\"Belarus\">Belarus</OPTION>
<OPTION VALUE=\"Belgium\">Belgium</OPTION>
<OPTION VALUE=\"Belize\">Belize</OPTION>
<OPTION VALUE=\"Benin\">Benin</OPTION>
<OPTION VALUE=\"Bermuda\">Bermuda</OPTION>
<OPTION VALUE=\"Bhutan\">Bhutan</OPTION>
<OPTION VALUE=\"Bolivia\">Bolivia</OPTION>
<OPTION VALUE=\"Bosnia And Herzegowina\">Bosnia And Herzegowina</OPTION>
<OPTION VALUE=\"Botswana\">Botswana</OPTION>
<OPTION VALUE=\"Bouvet Island\">Bouvet Island</OPTION>
<OPTION VALUE=\"Brazil\">Brazil</OPTION>
<OPTION VALUE=\"British Indian Ocean Territory\">British Indian Ocean Territory</OPTION>
<OPTION VALUE=\"Brunei Darussalam\">Brunei Darussalam</OPTION>
<OPTION VALUE=\"Bulgaria\">Bulgaria</OPTION>
<OPTION VALUE=\"Burkina Faso\">Burkina Faso</OPTION>
<OPTION VALUE=\"Burundi\">Burundi</OPTION>
<OPTION VALUE=\"Cambodia\">Cambodia</OPTION>
<OPTION VALUE=\"Cameroon\">Cameroon</OPTION>
<OPTION VALUE=\"Canada\">Canada</OPTION>
<OPTION VALUE=\"Cape Verde\">Cape Verde</OPTION>
<OPTION VALUE=\"Cayman Islands\">Cayman Islands</OPTION>
<OPTION VALUE=\"Central African Republic\">Central African Republic</OPTION>
<OPTION VALUE=\"Chad\">Chad</OPTION>
<OPTION VALUE=\"Chile\">Chile</OPTION>
<OPTION VALUE=\"China\">China</OPTION>
<OPTION VALUE=\"Christmas Island\">Christmas Island</OPTION>
<OPTION VALUE=\"Cocos (Keeling) Islands\">Cocos (Keeling) Islands</OPTION>
<OPTION VALUE=\"Colombia\">Colombia</OPTION>
<OPTION VALUE=\"Comoros\">Comoros</OPTION>
<OPTION VALUE=\"Congo\">Congo</OPTION>
<OPTION VALUE=\"Cook Islands\">Cook Islands</OPTION>
<OPTION VALUE=\"Costa Rica\">Costa Rica</OPTION>
<OPTION VALUE=\"Cote D Ivoire\">Cote D Ivoire</OPTION>
<OPTION VALUE=\"Croatia\">Croatia</OPTION>
<OPTION VALUE=\"Cuba\">Cuba</OPTION>
<OPTION VALUE=\"Cyprus\">Cyprus</OPTION>
<OPTION VALUE=\"Czech Republic\">Czech Republic</OPTION>
<OPTION VALUE=\"Denmark\">Denmark</OPTION>
<OPTION VALUE=\"Djibouti\">Djibouti</OPTION>
<OPTION VALUE=\"Dominica\">Dominica</OPTION>
<OPTION VALUE=\"Dominican Republic\">Dominican Republic</OPTION>
<OPTION VALUE=\"East Timor\">East Timor</OPTION>
<OPTION VALUE=\"Ecuador\">Ecuador</OPTION>
<OPTION VALUE=\"Egypt\">Egypt</OPTION>
<OPTION VALUE=\"El Salvador\">El Salvador</OPTION>
<OPTION VALUE=\"Equatorial Guinea\">Equatorial Guinea</OPTION>
<OPTION VALUE=\"Eritrea\">Eritrea</OPTION>
<OPTION VALUE=\"Estonia\">Estonia</OPTION>
<OPTION VALUE=\"Ethiopia\">Ethiopia</OPTION>
<OPTION VALUE=\"Falkland Islands\">Falkland Islands</OPTION>
<OPTION VALUE=\"Faroe Islands\">Faroe Islands</OPTION>
<OPTION VALUE=\"Fiji\">Fiji</OPTION>
<OPTION VALUE=\"Finland\">Finland</OPTION>
<OPTION VALUE=\"France\">France</OPTION>
<OPTION VALUE=\"France, Metropolitan \">France, Metropolitan </OPTION>
<OPTION VALUE=\"French Guiana\">French Guiana</OPTION>
<OPTION VALUE=\"French Polynesia\">French Polynesia</OPTION>
<OPTION VALUE=\"French Southern Territories\">French Southern Territories</OPTION>
<OPTION VALUE=\"Gabon\">Gabon</OPTION>
<OPTION VALUE=\"Gambia\">Gambia</OPTION>
<OPTION VALUE=\"Georgia\">Georgia</OPTION>
<OPTION VALUE=\"Germany\">Germany</OPTION>
<OPTION VALUE=\"Ghana\">Ghana</OPTION>
<OPTION VALUE=\"Gibraltar\">Gibraltar</OPTION>
<OPTION VALUE=\"Greece\">Greece</OPTION>
<OPTION VALUE=\"Greenland\">Greenland</OPTION>
<OPTION VALUE=\"Grenada\">Grenada</OPTION>
<OPTION VALUE=\"Guadeloupe\">Guadeloupe</OPTION>
<OPTION VALUE=\"Guam\">Guam</OPTION>
<OPTION VALUE=\"Guatemala\">Guatemala</OPTION>
<OPTION VALUE=\"Guinea\">Guinea</OPTION>
<OPTION VALUE=\"Guinea-Bissau\">Guinea-Bissau</OPTION>
<OPTION VALUE=\"Guyana\">Guyana</OPTION>
<OPTION VALUE=\"Haiti\">Haiti</OPTION>
<OPTION VALUE=\"Heard And Mc Donald Islands\">Heard And Mc Donald Islands</OPTION>
<OPTION VALUE=\"Honduras\">Honduras</OPTION>
<OPTION VALUE=\"Hong Kong\">Hong Kong</OPTION>
<OPTION VALUE=\"Hungary\">Hungary</OPTION>
<OPTION VALUE=\"Iceland\">Iceland</OPTION>
<OPTION VALUE=\"India\">India</OPTION>
<OPTION VALUE=\"Indonesia\">Indonesia</OPTION>
<OPTION VALUE=\"Iran\">Iran</OPTION>
<OPTION VALUE=\"Iraq\">Iraq</OPTION>
<OPTION VALUE=\"Ireland\">Ireland</OPTION>
<OPTION VALUE=\"Israel\">Israel</OPTION>
<OPTION VALUE=\"Italy\">Italy</OPTION>
<OPTION VALUE=\"Jamaica\">Jamaica</OPTION>
<OPTION VALUE=\"Japan\">Japan</OPTION>
<OPTION VALUE=\"Jordan\">Jordan</OPTION>
<OPTION VALUE=\"Kazakhstan\">Kazakhstan</OPTION>
<OPTION VALUE=\"Kenya\">Kenya</OPTION>
<OPTION VALUE=\"Kiribati\">Kiribati</OPTION>
<OPTION VALUE=\"North Korea\">North Korea</OPTION>
<OPTION VALUE=\"South Korea\">South Korea</OPTION>
<OPTION VALUE=\"Kuwait\">Kuwait</OPTION>
<OPTION VALUE=\"Kyrgyzstan\">Kyrgyzstan</OPTION>
<OPTION VALUE=\"Lao Peoples Republic\">Lao Peoples Republic</OPTION>
<OPTION VALUE=\"Latvia\">Latvia</OPTION>
<OPTION VALUE=\"Lebanon\">Lebanon</OPTION>
<OPTION VALUE=\"Lesotho\">Lesotho</OPTION>
<OPTION VALUE=\"Liberia\">Liberia</OPTION>
<OPTION VALUE=\"Libyan Arab Jamahiriya\">Libyan Arab Jamahiriya</OPTION>
<OPTION VALUE=\"Liechtenstein\">Liechtenstein</OPTION>
<OPTION VALUE=\"Lithuania\">Lithuania</OPTION>
<OPTION VALUE=\"Luxembourg\">Luxembourg</OPTION>
<OPTION VALUE=\"Macau\">Macau</OPTION>
<OPTION VALUE=\"Macedonia\">Macedonia</OPTION>
<OPTION VALUE=\"Madagascar\">Madagascar</OPTION>
<OPTION VALUE=\"Malawi\">Malawi</OPTION>
<OPTION VALUE=\"Malaysia\">Malaysia</OPTION>
<OPTION VALUE=\"Maldives\">Maldives</OPTION>
<OPTION VALUE=\"Mali\">Mali</OPTION>
<OPTION VALUE=\"Malta\">Malta</OPTION>
<OPTION VALUE=\"Marshall Islands\">Marshall Islands</OPTION>
<OPTION VALUE=\"Martinique\">Martinique</OPTION>
<OPTION VALUE=\"Mauritania\">Mauritania</OPTION>
<OPTION VALUE=\"Mauritius\">Mauritius</OPTION>
<OPTION VALUE=\"Mayotte\">Mayotte</OPTION>
<OPTION VALUE=\"Mexico\">Mexico</OPTION>
<OPTION VALUE=\"Micronesia\">Micronesia</OPTION>
<OPTION VALUE=\"Moldova\">Moldova</OPTION>
<OPTION VALUE=\"Monaco\">Monaco</OPTION>
<OPTION VALUE=\"Mongolia\">Mongolia</OPTION>
<OPTION VALUE=\"Montserrat\">Montserrat</OPTION>
<OPTION VALUE=\"Morocco\">Morocco</OPTION>
<OPTION VALUE=\"Mozambique\">Mozambique</OPTION>
<OPTION VALUE=\"Myanmar\">Myanmar</OPTION>
<OPTION VALUE=\"Namibia\">Namibia</OPTION>
<OPTION VALUE=\"Nauru\">Nauru</OPTION>
<OPTION VALUE=\"Nepal\">Nepal</OPTION>
<OPTION VALUE=\"Netherlands\">Netherlands</OPTION>
<OPTION VALUE=\"Netherlands Antilles\">Netherlands Antilles</OPTION>
<OPTION VALUE=\"New Caledonia\">New Caledonia</OPTION>
<OPTION VALUE=\"New Zealand\">New Zealand</OPTION>
<OPTION VALUE=\"Nicaragua\">Nicaragua</OPTION>
<OPTION VALUE=\"Niger\">Niger</OPTION>
<OPTION VALUE=\"Nigeria\">Nigeria</OPTION>
<OPTION VALUE=\"Niue\">Niue</OPTION>
<OPTION VALUE=\"Norfolk Island\">Norfolk Island</OPTION>
<OPTION VALUE=\"Northern Mariana Islands\">Northern Mariana Islands</OPTION>
<OPTION VALUE=\"Norway\">Norway</OPTION>
<OPTION VALUE=\"Oman\">Oman</OPTION>
<OPTION VALUE=\"Pakistan\">Pakistan</OPTION>
<OPTION VALUE=\"Palau\">Palau</OPTION>
<OPTION VALUE=\"Panama\">Panama</OPTION>
<OPTION VALUE=\"Papua New Guinea\">Papua New Guinea</OPTION>
<OPTION VALUE=\"Paraguay\">Paraguay</OPTION>
<OPTION VALUE=\"Peru\">Peru</OPTION>
<OPTION VALUE=\"Philippines\">Philippines</OPTION>
<OPTION VALUE=\"Pitcairn\">Pitcairn</OPTION>
<OPTION VALUE=\"Poland\">Poland</OPTION>
<OPTION VALUE=\"Portugal\">Portugal</OPTION>
<OPTION VALUE=\"Puerto Rico\">Puerto Rico</OPTION>
<OPTION VALUE=\"Qatar\">Qatar</OPTION>
<OPTION VALUE=\"Reunion\">Reunion</OPTION>
<OPTION VALUE=\"Romania\">Romania</OPTION>
<OPTION VALUE=\"Russian Federation\">Russian Federation</OPTION>
<OPTION VALUE=\"Rwanda\">Rwanda</OPTION>
<OPTION VALUE=\"Saint Kitts And Nevis\">Saint Kitts And Nevis</OPTION>
<OPTION VALUE=\"Saint Lucia\">Saint Lucia</OPTION>
<OPTION VALUE=\"Saint Vincent And The Grenadines\">Saint Vincent And The Grenadines</OPTION>
<OPTION VALUE=\"Samoa\">Samoa</OPTION>
<OPTION VALUE=\"San Marino\">San Marino</OPTION>
<OPTION VALUE=\"Sao Tome And Principe\">Sao Tome And Principe</OPTION>
<OPTION VALUE=\"Saudi Arabia\">Saudi Arabia</OPTION>
<OPTION VALUE=\"Senegal\">Senegal</OPTION>
<OPTION VALUE=\"Seychelles\">Seychelles</OPTION>
<OPTION VALUE=\"Sierra Leone\">Sierra Leone</OPTION>
<OPTION VALUE=\"Singapore\">Singapore</OPTION>
<OPTION VALUE=\"Slovakia\">Slovakia</OPTION>
<OPTION VALUE=\"Slovenia\">Slovenia</OPTION>
<OPTION VALUE=\"Solomon Islands\">Solomon Islands</OPTION>
<OPTION VALUE=\"Somalia\">Somalia</OPTION>
<OPTION VALUE=\"South Africa\">South Africa</OPTION>
<OPTION VALUE=\"South Georgia\">South Georgia</OPTION>
<OPTION VALUE=\"The South Sandwich Islands\">The South Sandwich Islands</OPTION>
<OPTION VALUE=\"Spain\">Spain</OPTION>
<OPTION VALUE=\"Sri Lanka\">Sri Lanka</OPTION>
<OPTION VALUE=\"St Helena\">St Helena</OPTION>
<OPTION VALUE=\"St Pierre and Miquelon\">St Pierre and Miquelon</OPTION>
<OPTION VALUE=\"Sudan\">Sudan</OPTION>
<OPTION VALUE=\"Suriname\">Suriname</OPTION>
<OPTION VALUE=\"Svalbard And Jan Mayen Islands\">Svalbard And Jan Mayen Islands</OPTION>
<OPTION VALUE=\"Swaziland\">Swaziland</OPTION>
<OPTION VALUE=\"Sweden\">Sweden</OPTION>
<OPTION VALUE=\"Switzerland\">Switzerland</OPTION>
<OPTION VALUE=\"Syrian Arab Republic\">Syrian Arab Republic</OPTION>
<OPTION VALUE=\"Taiwan\">Taiwan</OPTION>
<OPTION VALUE=\"Tajikistan\">Tajikistan</OPTION>
<OPTION VALUE=\"Tanzania\">Tanzania</OPTION>
<OPTION VALUE=\"Thailand\">Thailand</OPTION>
<OPTION VALUE=\"Togo\">Togo</OPTION>
<OPTION VALUE=\"Tokelau\">Tokelau</OPTION>
<OPTION VALUE=\"Tonga\">Tonga</OPTION>
<OPTION VALUE=\"Trinidad And Tobago\">Trinidad And Tobago</OPTION>
<OPTION VALUE=\"Tunisia\">Tunisia</OPTION>
<OPTION VALUE=\"Turkey\">Turkey</OPTION>
<OPTION VALUE=\"Turkmenistan\">Turkmenistan</OPTION>
<OPTION VALUE=\"Turks And Caicos Islands\">Turks And Caicos Islands</OPTION>
<OPTION VALUE=\"Tuvalu\">Tuvalu</OPTION>
<OPTION VALUE=\"Uganda\">Uganda</OPTION>
<OPTION VALUE=\"Ukraine\">Ukraine</OPTION>
<OPTION VALUE=\"United Arab Emirates\">United Arab Emirates</OPTION>
<OPTION VALUE=\"United Kingdom\">United Kingdom</OPTION>
<OPTION VALUE=\"US Minor Outlying Islands\">US Minor Outlying Islands</OPTION>
<OPTION VALUE=\"Uruguay\">Uruguay</OPTION>
<OPTION VALUE=\"Uzbekistan\">Uzbekistan</OPTION>
<OPTION VALUE=\"Vanuatu\">Vanuatu</OPTION>
<OPTION VALUE=\"Vatican City State\">Vatican City State</OPTION>
<OPTION VALUE=\"Venezuela\">Venezuela</OPTION>
<OPTION VALUE=\"Viet Nam\">Viet Nam</OPTION>
<OPTION VALUE=\"Virgin Islands (British)\">Virgin Islands (British)</OPTION>
<OPTION VALUE=\"Virgin Islands (U.S.)\">Virgin Islands (U.S.)</OPTION>
<OPTION VALUE=\"Wallis And Futuna Islands\">Wallis And Futuna Islands</OPTION>
<OPTION VALUE=\"Western Sahara\">Western Sahara</OPTION>
<OPTION VALUE=\"Yemen\">Yemen</OPTION>
<OPTION VALUE=\"Zaire\">Zaire</OPTION>
<OPTION VALUE=\"Zambia\">Zambia</OPTION>
<OPTION VALUE=\"Zimbabwe\">Zimbabwe</OPTION>
<OPTION VALUE=\"Other-Not Shown\">Outro-Não Mostrado</OPTION>
</select>
</td>
</tr>
<tr>
<td align=\"right\">Digite abaixo o código ao lado:</td><td><img width=100 height=30 src=\"button.php\" border=\"2\"></td>
</tr>
<tr>
<td align=\"right\"> </td><td><input MAXLENGTH=5 SIZE=5 name=\"userdigit\" type=\"text\" value=\"\"></td></tr>
<tr>
<td align=\"right\">Comentário:</td><td><textarea rows=\"8\" name=\"post\" cols=\"30\"></textarea></td>
</tr>
<tr>

<td align=\"right\"><input type=\"submit\" value=\"Postar\"></td><td><input type=\"reset\" value=\"Limpar\"></td>
</tr>
</table>
</form></center>
");
}

Link to comment
https://forums.phpfreaks.com/topic/4935-how-to-prevent-spam-in-guestbook/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.