33 lines
749 B
PHP
33 lines
749 B
PHP
|
<?php
|
||
|
$data = array('error' => true);
|
||
|
$myobj = new class{};
|
||
|
|
||
|
if (isset($_POST['action'])) {
|
||
|
|
||
|
$action = $_POST['action'];
|
||
|
|
||
|
if ($action == "getmovies") {
|
||
|
$myobj->error = false;
|
||
|
$list = scandir("../../Filme");
|
||
|
|
||
|
$myobj->data = array();
|
||
|
|
||
|
foreach ($list as $moviename) {
|
||
|
if (strpos($moviename, '.mp4') !== false) {
|
||
|
array_push($myobj->data,(object) array( 'name' => substr($moviename, 0, -4),
|
||
|
'url'=>str_replace(" ","%20",$moviename),
|
||
|
'thumbnail' => str_replace(" ","%20",str_replace(".mp4",".jpg",$moviename))));
|
||
|
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
// code...
|
||
|
}
|
||
|
|
||
|
|
||
|
}else {
|
||
|
$myobj->error = true;
|
||
|
}
|
||
|
echo(json_encode($myobj));
|
||
|
?>
|