Location: PHPKode > projects > @1 File Store > movef.php
<?
if(isset($_GET["id"]) && $_GET["id"]!="") {
	$file_id=$_GET['id'];
} else {
	exit("Bad request");
}
if(isset($_GET["folder"]) && $_GET["folder"]!="") {
	$folder_id=$_GET['folder'];
} else {
	exit("Bad request");
}
$MustLogin=1|2|4;
require_once("libs/header.php");
require_once(LIBPATH."multipage.php");
require_once("libs/databasetree.php");

$userlevel=$CurUser->getlevel();
$folisttree=new databasetree($mysql, DB_PREFIX."folders");
$folisttreeresult=$folisttree->get_array("Root Folder", "...&nbsp;&nbsp;");
$test1 = $folisttreeresult;
$flist = $folisttreeresult;
$form=array(
	"method"=>"POST",
	"action"=>"",
	"message"=>"",
	"errorcount"=>0,
	"fields"=>array(
		       "choose"=>array("type"=>"select",
		       		"description"=>$lang['move_to'],
		       		"error"=>$lang['select_destination_folder'],
		       		"extra"=>$flist
		       	     )
		      ),
	"submit"=>"GO"
);
$userform=new UserForms($form["fields"]);

$smarty->assign("action", $lang['move_file']);
$form["submit"]=$lang['move'];
if($_SERVER["REQUEST_METHOD"]==$form["method"]) {
	$userform->load($form["fields"], $_POST);
	$form["errorcount"]=$userform->check($form["fields"]);
	if($form["errorcount"]==0)
		$cleanup = $userform->sql($form["fields"]);
		$do = preg_match("/\d+/", $cleanup, $matches);
		if ($do = true) {
			$clean=$matches['0'];
		} else {
			exit("Bad request");
		}
		$found = $clean;
		if ($found=='0') {
			$form["errorcount"]=1;
			$form["message"]=$lang['no_move_this_file'];
		}
		if($form["errorcount"]==0)
		{
			$SQL="UPDATE `".DB_PREFIX."file_list` SET `folder_id`='".$found."' WHERE id='".$file_id."'";
			  if(!$mysql->query($SQL))
		{
	exit($mysql->error);
	}
	if (isset($_GET['frm'])) {
		Header("Location:pf.php");
		exit();
	} else {
		Header("Location:folder.php?id=".$folder_id);
		exit();
	}
	}
}
$smarty->assign("form", $form);
$smarty->display("control/form2.tpl");

?>
Return current item: @1 File Store