Location: PHPKode > projects > @1 File Store > control/folders/edit.php
<?
if(!isset($_GET["id"]) || $_GET["id"]=="")
{
 exit("Bad request");
}
require_once("const.php");

$smarty->assign("action", $lang['edit_folder']);
$form["submit"]=$lang['edit'];
$form["hidden_fields"]=array("id"=>$_GET["id"]);

if($_SERVER["REQUEST_METHOD"]==$form["method"])
{
 $userform->load($form["fields"], $_POST);
 $form["errorcount"]=$userform->check($form["fields"]);
 if($form["errorcount"]==0)
 {
  $SQL="UPDATE `".DB_PREFIX."folders` SET ".$userform->sql($form["fields"])." WHERE `id`='".$_POST["id"]."'";
  if(!$mysql->query($SQL))
  {
   exit($mysql->error);
  }
  Header("Location:index.php");
  exit();
 }
}else
 {
  $SQL="SELECT * FROM `".DB_PREFIX."folders` WHERE `id`='".$_GET["id"]."'";
  if(!$mysql->query($SQL))
  {
   exit($mysql->error);
  }else
   {
    $userform->load($form["fields"], $mysql->arr);
   }
 }

$smarty->assign("form", $form);
$smarty->display("control/form.tpl");
?>
Return current item: @1 File Store