You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
<?php
|
|
|
|
// TODO: idéee : on peut facilement connaitre les status "dupp", il suffit de faire un tableau à part qui permet de faire un rm dans le dossier et supprimer cet event "dupp"
|
|
|
|
/**
|
|
* Ajoute en base les infos sur le(s) fichier(s) a dl (ne telecharge pas directement le(s) fichier(s))
|
|
*/
|
|
function addDownload()
|
|
{
|
|
if (isset($_GET['myurls'])) {
|
|
$myurls = $_GET['myurls'];
|
|
} elseif (isset($_POST['myurls'])) {
|
|
$myurls = $_POST['myurls'];
|
|
} else {
|
|
echo 'pas d\'url';
|
|
exit();
|
|
}
|
|
|
|
if (isset($_GET['dtype'])) {
|
|
$dtype = $_GET['dtype'];
|
|
} elseif (isset($_POST['dtype'])) {
|
|
$dtype = $_POST['dtype'];
|
|
} else {
|
|
echo 'pas de dtype';
|
|
exit();
|
|
}
|
|
if (!in_array($dtype, [ 'premiumizeme', 'dlink' ])) {
|
|
echo 'mauvais dtype';
|
|
exit();
|
|
}
|
|
|
|
if (isset($_GET['worker'])) {
|
|
$worker = $_GET['worker'];
|
|
} elseif (isset($_POST['worker'])) {
|
|
$worker = $_POST['worker'];
|
|
} else {
|
|
echo 'pas de worker';
|
|
exit();
|
|
}
|
|
if (!in_array($worker, [ 'contabo', 'home' ])) {
|
|
echo 'mauvais worker';
|
|
exit();
|
|
}
|
|
|
|
|
|
foreach($myurls as $url) {
|
|
Download::addDownload($url, $worker, $dtype);
|
|
}
|
|
|
|
echo json_encode('ok');
|
|
}
|
|
|