Smarty reading config values from .conf files in PHP
For a meeting schedule, I want to have dynamic pages for any given room.
User can edit a file named "schedules.conf" in the config folder. At the
moment it looks like this:
[rooms]
room = 5022
room = 5082
And I can load it normally and it shows 2 links in my 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 it links to the handler PHP file, now in the php file I want to check
weather that room exist in the config file, so if someone manually change
the GET value for room in the address bar I could have a chance to handle
that:
if(!isset($_GET["room"]))
{
header('location: '.SITE_URL.'/admin/index.php');
}
else
{
$validRooms = $smarty->getConfigDir();
//How to check id the $_GET["room"] value exist in the config file
}
No comments:
Post a Comment