<?php
session_start();
/*
asaancart - easy shopping cart solution
---------------------------------------
Copyright 2009 Nasir Ahmad Khan
Email: hide@address.com
This file is part of asaancart - open source easy shopping cart solution.
asaancart is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
asaancart is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with asaancart. If not, see <http://www.gnu.org/licenses/>.
*/
include("../config/config.php");
include("includes/chk_login_status_inc.php");
$smarty->assign('title','Configure Modules');
$module_id = $_POST['module_id'];
if($module_id==""){
$module_id = $_GET['module_id'];
}
if($_POST['btn_submit']=="Save"){
$sql = "SELECT * FROM module_params WHERE module_id=".$module_id;
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$param_value = $_POST['param_value_'.$row['param_id']];
if($row['param_data_type']=="text"){
$sql2 = "UPDATE module_params SET param_value='$param_value' WHERE param_id=".$row['param_id'];
}
elseif($row['param_data_type']=="int")
{
$sql2 = "UPDATE module_params SET param_value=$param_value WHERE param_id=".$row['param_id'];
}
$results2 = mysql_query($sql2);
}
$smarty->assign('msg','Done: Changes saved successfully');
}
$sql = "SELECT * FROM modules WHERE module_id=".$module_id;
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$list_modules[] = $row;
}
$sql = "SELECT * FROM module_params WHERE module_id=".$module_id;
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$list_module_params[] = $row;
}
$smarty->assign('list_modules', $list_modules);
$smarty->assign('list_module_params', $list_module_params);
$smarty->display('configure_module.tpl');
?>