assign( 'users', $users); //Ставим задачу if ($_POST){ if ($_FILES){ @mkdir("files", 0777); @mkdir("files/task", 0777); $fm=rand(10000, 99999) . '_' . $_FILES['doc']['name']; copy ($_FILES['doc']['tmp_name'], 'files/task/' . $fm); } $array['doc']=$fm; $array['srok']=$_POST['srok']; $array['target_user']=$_POST['target_user']; $array['prioritet']=$_POST['prioritet']; $j=core::j($array); DB::add("INSERT INTO `content` (`txt`, `json`, `content_type`, `t`, `user`) VALUES (?,?,?,?,?)", [$_POST['txt'], $j, 2, time(), $_SESSION['user_id']]); header( 'Location: /task/' ); } //Показываем мои задачи $mytask=DB::getAll("SELECT * FROM `content` WHERE `content_type`=? AND `status`<>? AND `json` LIKE '%\"target_user\":\"" . $_SESSION['user_id'] . "\"%'", [2, 0]); $c=count($mytask); for ($i=0; $i<$c; $i++){ $mytask[$i]['array']=core::j($mytask[$i]['json']); $mytask[$i]['avtor']=DB::getRow("SELECT * FROM `users` WHERE `id`=?", $mytask[$i]['user']); $mytask[$i]['d']=date("d.m.Y", $mytask[$i]['t']); } $smarty -> assign( 'mytask', $mytask); ?>