在不使用驗(yàn)證碼的情況下阻止垃圾評(píng)論在我的評(píng)論中阻止垃圾郵件的一些非驗(yàn)證碼方法是什么?
3 回答

阿波羅的戰(zhàn)車
TA貢獻(xiàn)1862條經(jīng)驗(yàn) 獲得超6個(gè)贊
1)將與會(huì)話相關(guān)的信息添加到表單中示例:
<input type="hidden" name="sh" value="<?php echo dechex(crc32(session_id())); ?>" />
然后在回發(fā)時(shí),檢查會(huì)話是否有效。
2)僅限Javascript。在提交時(shí)使用Javascript注入。例:
<input type="hidden" id="txtKey" name="key" value="" /><input type="submit" value="Go" onclick="document.getElementById('txtKey').value = '<?php echo dechex(crc32(session_id())) ?>';" />
3)每個(gè)IP,用戶或會(huì)話的時(shí)間限制。這很簡(jiǎn)單。
4)隨機(jī)化字段名稱:
<?php $fieldkey = dechex(crc32(mt_rand().dechex(crc32(time())))); $_SESSION['fieldkey'] = $fieldkey;?><input type="text" name="name<?php echo $fieldkey; ?>" value="" /> <input type="text" name="address<?php echo $fieldkey; ?>" value="" />
然后你可以在服務(wù)器端檢查它。

達(dá)令說(shuō)
TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超6個(gè)贊
這是在不使用驗(yàn)證碼的情況下阻止垃圾郵件機(jī)器人或暴力攻擊的簡(jiǎn)單技巧。
把它放在你的表格中:
<input type="hidden" name="hash" value="<?php echo md5($secret_key.time()).','.time(); ?>" />
把它放在你的PHP代碼中
$human_typing_time = 5;/** page load (1s) + submit (1s) + typing time (3s) */$vars = explode(',', $_POST['hash']);if(md5($secret_key.$vars[1]) != $vars[0] || time() < $var[1] + $human_typing_time){ //bot? exit();}
根據(jù)表格的重量,您可以增加或減少$ human_typing_time。
- 3 回答
- 0 關(guān)注
- 410 瀏覽
添加回答
舉報(bào)
0/150
提交
取消