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

阿波羅的戰車
TA貢獻1862條經驗 獲得超6個贊
1)將與會話相關的信息添加到表單中示例:
<input type="hidden" name="sh" value="<?php echo dechex(crc32(session_id())); ?>" />
然后在回發時,檢查會話是否有效。
2)僅限Javascript。在提交時使用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)每個IP,用戶或會話的時間限制。這很簡單。
4)隨機化字段名稱:
<?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="" />
然后你可以在服務器端檢查它。

達令說
TA貢獻1821條經驗 獲得超6個贊
這是在不使用驗證碼的情況下阻止垃圾郵件機器人或暴力攻擊的簡單技巧。
把它放在你的表格中:
<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();}
根據表格的重量,您可以增加或減少$ human_typing_time。
- 3 回答
- 0 關注
- 409 瀏覽
添加回答
舉報
0/150
提交
取消