...

View Full Version : How to add flood control (like captcha) this form ?



winpeace
11-23-2006, 11:25 AM
I search forum.I don't find.How to add flood control(like captcha) this form.I am new user :(



<script language="javascript" src="components/com_combomax/templates/js.tpl"></script>
<style type="text/css">
<!--
.style6 {font-size: 16px}
.style7 {
font-size: 14px;
font-weight: bold;
color: #000000;
}
-->
</style>

<a name="write-comment"></a>
<div class="componentheading">Bu konu hakkında yorum yapınız </div>
<p style="font-size: 10px"><a class="style7" style="cursor: pointer; cursor: hand;" onclick="javascript:showhide2('hideshow');"><img src="http://www.haberpc.com/components/com_combomax/images/edit.gif" width="19" height="17" />yorum yazmak i&ccedil;in tıklayınız... </a></p>
<div align="center" class="style6" id="hideshow" style="display: none;" name="hideshow">
<form action="index.php" method="post" name="adminForm" id="adminForm" onsubmit="return validateForm( this,true,true,false,true,0)">

<br />
<br />
Adınız: <br />
<input type="text" name="name" style="width:300px;" class="inputbox" value="{MYNAME}" validate="blank" emsg="Lütfen adınızı giriniz!"><br />
E-mail adresiniz: <br />
<input type="text" name="email" style="width:300px;" class="inputbox" value="{MYEMAIL}" validate="email|1" emsg="Lütfen e-mail adresinizi giriniz!"><br />
Konu oylamanız:<br />
<span class="content_vote">
Çok kötü
<input type="radio" alt="vote 1 star" name="user_rating" value="1" />
<input type="radio" alt="vote 2 star" name="user_rating" value="2" />
<input type="radio" alt="vote 3 star" name="user_rating" value="3" />
<input type="radio" alt="vote 4 star" name="user_rating" value="4" />
<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />
Çok iyi </span>
<br /><br />
Yorumunuz: <br />
<textarea name="comment" id="comment" cols="50" rows="7" class="inputbox" validate="blank" emsg="Lütfen yorumunuzu giriniz!" onkeydown="javascript:sinirla(this)" onkeyup="javascript:sinirla(this)"></textarea>
</p>
<p>
<input type="text" size="5" id="kalan" name="kalan" value="140">
</p>
<table border=0 cellspacing=3 cellpadding=0 class="smiletoolbar">
<tr>
<td onClick="javascript:emo('B)');" style="cursor:pointer;"><img src="components/com_combomax/images/bigsmile-smiley.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':(');" style="cursor:pointer;"><img src="components/com_combomax/images/blue-smiley.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':)');" style="cursor:pointer;"><img src="components/com_combomax/images/happy-smiley.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':laugh:');" style="cursor:pointer;"><img src="components/com_combomax/images/laughing-smiley.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':sad:');" style="cursor:pointer;"><img src="components/com_combomax/images/sad-smiley.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':q:');" style="cursor:pointer;"><img src="components/com_combomax/images/question.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':thumbup:');" style="cursor:pointer;"><img src="components/com_combomax/images/thumbsup.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':thumbdown:');" style="cursor:pointer;"><img src="components/com_combomax/images/thumbsdown.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(':clown:');" style="cursor:pointer;"><img src="components/com_combomax/images/clown.gif" width="15" height="15" alt="" border="0"></td>
<td onClick="javascript:emo(' ');" style="cursor:pointer;"><strong>BOLD</strong></td>
<td onClick="javascript:emo('
');" style="cursor:pointer;">"QUOTE"</td>
<td onClick="javascript:emo(' ');" style="cursor:pointer;"><U>UNDERLINE</U></td>
</tr>
</table>


<input type="submit" name="pressbutton" value="Gönder" style="width: 100px;" class="button">
<input type="reset" class="button" value="Formu Temizle" />

<input type="hidden" name="option" value="com_combomax" />
<input type="hidden" name="contentid" value="{CONTENTID}" />
<input type="hidden" name="task" value="preview" />
</form>
</div>

<br />

xanderman
11-24-2006, 02:50 PM
something like this should work


<?php
$last_time = $_COOKIE['last_hit_time'];
$now = time();
$wait = 5;
if(empty($last_time))
{
setcookie('last_hit_time', $now);
}
else
{
if(($last_time + $wait) < $now)
{
die();
}
else
{
setcookie('last_hit_time', $now);
}
}
?>

You would probaly have to use a database for true flood detection, this code just allows one view per 5 seconds



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum