form and cache
| From: | Elgi | Date: | Sun, 23 Mar 2003 11:57:24 +0000 |
| Subject: | form and cache | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8843@lists.php.net to get a copy of this message | ||
Hello smarty-general,
I have a form with a antiflood
what i do made for caching the form ?
form's var don't change allways but it's possible flood
form.tpl :
if (isset($_POST[var])) {
$time=time()+60;
$timeflood=time();
$queryflood="select time from flood where ip='$REMOTE_ADDR' and
time>='$timeflood'";
$resflood=@mysql_query($queryflood, $db_link);
@mysql_close();
$rowflood=@mysql_fetch_row($resflood);
$sqltime=$rowflood[0];
if ($sqltime>=$timeflood) {
$sec=$sqltime-$timeflood;
$smarty->assign('flood_d',...
$smarty->assign('sec',$sec);
$smarty->assign('flood_f',...
} else {
if ($_POST[var]=="") {
$smarty->assign('error',...
} else {
...
@mail($dest,$sujet,$mes,$mail_header,$option);
@mysql_query("insert into flood (ip, time) values ('$REMOTE_ADDR',
'$time')", $db_link);
$smarty->assign('form_ok',...
}
}
}
//this is static assign
$smarty->config_load('smarty.conf');
$smarty->assign....
$smarty->assign....
$smarty->assign....
$smarty->display('form.tpl');
--
Cordialement,
Elgi