exec('CREATE TABLE IF NOT EXISTS config(id INTEGER PRIMARY KEY NOT NULL, Title TEXT, url TEXT, CreateDate TIMESTAMP, linktype TEXT)'); $res = $db->query('SELECT * ' . "\n\t\t\t\t" . ' FROM config ' . "\n\t\t\t\t" . ' WHERE id=\'' . $_GET['update'] . '\''); $row = $res->fetchArray(); $id = $row['id']; $Title = $row['Title']; $url = $row['url']; //$rowU = $row['type']; $newtime = time(); //current file var $base_file = basename($_SERVER["SCRIPT_NAME"]); // file image //$boxbr_file = $Title.'.gif'; $target_dir = 'api/sets/'; if (!file_exists($target_dir)) { mkdir($target_dir, 511, true); } $file_path = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off') ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/'.$target_dir; ///////////////////////////////////////////////////////// if (isset($_POST['url'])) { if ($_POST['linktype'] == '0') { //die; $uploadOk = 1; $Title = str_replace(' ', '', $_POST['Title']); $file_ext = strtolower(end(explode('.', $_FILES['image']['name']))); $extensions = ['webp','WEBP','gif', 'GIF', 'png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG', 'bmp', 'BMP','mp4','MP4','mpeg','MPEG','avi','AVI','mov','MOV']; $target_file = $target_dir. $Title.'.'.$file_ext; //$target_file = $target_dir. $_FILES['image']['name']; if (file_exists($target_file)) { unlink($target_file); $msg = '?messageA=The file already exists and has been replaced.'; }else { $msg = '?messageS=Success, File uploaded.'; } $uploadOk = 1; if (550000000 < $_FILES['image']['size']) { $msg = '?messageE=Sorry, your file is too large.'; //echo $msg; $uploadOk = 0; } if (in_array($file_ext, $extensions) === false) { //$errors[] = 'extension not allowed, please choose a JPEG or PNG or GIF or MP4 file.'; $msg = '?messageE=Sorry, only Image or Video files are allowed.'; //echo $msg; $uploadOk = 0; } if ($uploadOk == 0) { $db->close(); header('Location: ./launcher.php'.$msg); echo ''; } else if (move_uploaded_file($_FILES['image']['tmp_name'], $target_file)) { $boxbr_patch = '' . $file_path . $Title.'.'.$file_ext . ''; $icon == $boxbr_patch; $db->exec('UPDATE config SET url=\'' . $boxbr_patch . '\',' . "\n" . 'CreateDate=\'' . $newtime . '\', linktype=\'0\'' . "\n\t\t\t\t\t\t" . ' WHERE ' . "\n\t\t\t\t\t\t\t" . ' id=\'' . $_POST['id'] . '\''); $db->close(); header('Location: ./launcher.php'.$msg); echo ''; } }else{ $url = $_POST['url']; $target_file = $target_dir . basename($url); $file_ext = strtolower(end(explode('.', $url))); $extensions = ['webp','WEBP','gif', 'GIF', 'png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG', 'bmp', 'BMP','mp4','MP4','mpeg','MPEG','avi','AVI','mov','MOV']; if (in_array($file_ext, $extensions) === false) { //$errors[] = 'extension not allowed, please choose a JPEG or PNG or GIF or MP4 file.'; $msg = '?messageE=Sorry, only Image or Video files are allowed.'; //echo $msg; $db->close(); header('Location: ./launcher.php'.$msg); echo ''; }else{ $msg = '?messageS=Saved!, Url of saved file..'; $boxbr_patch = $url; $db->exec('UPDATE config SET url=\'' . $boxbr_patch . '\',' . "\n" . 'CreateDate=\'' . $newtime . '\', linktype=\'1\'' . "\n\t\t\t\t\t\t" . ' WHERE ' . "\n\t\t\t\t\t\t\t" . ' id=\'' . $_POST['id'] . '\''); $db->close(); header('Location: ./launcher.php'.$msg); echo ''; } } } echo ' ' . "\n"; echo '