Smarty reading config values from .conf files in PHP -
for meeting schedule, want have dynamic pages given room. user can edit file named "schedules.conf" in config folder. @ moment looks this:
[rooms] room = 5022 room = 5082
and can load , shows 2 links in web page:
{config_load file="schedules.conf" section="rooms"} ...... ...... ...... {foreach from=#room# item=r} <li><span><span><a href="{$smarty.const.site_url}/admin/schedules.list.php?room={$r}">schedules {$r}</a></span></span></li> {/foreach}
so links handler php file, in php file want check weather room exist in config file, if manually change value room in address bar have chance handle that:
if(!isset($_get["room"])) { header('location: '.site_url.'/admin/index.php'); } else { $validrooms = $smarty->getconfigdir(); //how check id $_get["room"] value exist in config file }
grep page conditional checks using smarty isset()
edit
in light of comment #1 op:
how use conditional check along in_array($_get['room'], $validrooms)
Comments
Post a Comment