Re[2]: [SMARTY] form and cache
| From: | Elgi | Date: | Sun, 23 Mar 2003 13:12:52 +0000 |
| Subject: | Re[2]: [SMARTY] form and cache | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8846@lists.php.net to get a copy of this message | ||
Hello Elgi,
i have now in form.php :
if (isset($_POST[var])) {
$smarty->caching=false;
...
}
if(!$smarty->is_cached('fr/reservation.tpl')) {
$smarty->config_load('smarty.conf');
$smarty->assign...
}
$smarty->display('form.tpl');
if you have a best solution ?
--
Cordialement,
Elgi
Le dimanche 23 mars 2003 à 13:05:29, vous écriviez :
E> Hello Elgi,
E> little error, my code isn't form.tpl but form.php !
E> --
E> Cordialement,
E> Elgi
E> Le dimanche 23 mars 2003 à 12:57:24, vous écriviez :
E>> Hello smarty-general,
E>> I have a form with a antiflood
E>> what i do made for caching the form ?
E>> form's var don't change allways but it's possible flood
E> form.php :
E>> if (isset($_POST[var])) {
E>> $time=time()+60;
E>> $timeflood=time();
E>> $queryflood="select time from flood where ip='$REMOTE_ADDR' and
time>='$timeflood'";
E>> $resflood=@mysql_query($queryflood, $db_link);
E>> @mysql_close();
E>> $rowflood=@mysql_fetch_row($resflood);
E>> $sqltime=$rowflood[0];
E>> if ($sqltime>=$timeflood) {
E>> $sec=$sqltime-$timeflood;
E>> $smarty->assign('flood_d',...
E>> $smarty->assign('sec',$sec);
E>> $smarty->assign('flood_f',...
E>> } else {
E>> if ($_POST[var]=="") {
E>> $smarty->assign('error',...
E>> } else {
E>> ...
E>> @mail($dest,$sujet,$mes,$mail_header,$option);
E>> @mysql_query("insert into flood (ip, time) values ('$REMOTE_ADDR',
'$time')", $db_link);
E>> $smarty->assign('form_ok',...
E>> }
E>> }
E>> }
E>> //this is static assign
E>> $smarty->config_load('smarty.conf');
E>> $smarty->assign....
E>> $smarty->assign....
E>> $smarty->assign....
E>> $smarty->display('form.tpl');
E>> --
E>> Cordialement,
E>> Elgi