forked from MTco/Youtube-dl-WebUI
-
Notifications
You must be signed in to change notification settings - Fork 25
/
info.php
74 lines (67 loc) · 1.64 KB
/
info.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
require_once 'class/Session.php';
require_once 'class/Downloader.php';
require_once 'class/FileHandler.php';
$session = Session::getInstance();
$file = new FileHandler;
require 'views/header.php';
if(!$session->is_logged_in())
{
header("Location: login.php");
exit;
}
else
{
$json = False;
if(isset($_POST['urls']) && !empty($_POST['urls']))
{
$downloader = new Downloader($_POST['urls']);
$json = $downloader->info();
}
}
?>
<div class="container my-4">
<h1>JSON Info</h1>
<?php
if(isset($_SESSION['errors']) && $_SESSION['errors'] > 0)
{
foreach ($_SESSION['errors'] as $e)
{
echo "<div class=\"alert alert-warning\" role=\"alert\">$e</div>";
}
}
?>
<form id="info-form" action="info.php" method="post">
<div class="row my-3">
<div class="input-group">
<div class="input-group-text" id="urls-addon">URLs:</div>
<input class="form-control" id="url" name="urls" placeholder="Link(s) separated by a space" type="text" aria-describedby="urls-addon" required/>
</div>
</div>
<div class="row mt-3 align-items-center">
<div class="col-auto">
<button type="submit" class="btn btn-primary">Query</button>
</div>
</div>
</form>
<br>
<div class="row">
<?php
if ($json)
{
?>
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Info</h3></div>
<div class="panel-body">
<textarea rows="50" class="form-control"><?php echo $json ?></textarea>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
unset($_SESSION['errors']);
require 'views/footer.php';
?>