added tags
This commit is contained in:
parent
90fdb64f85
commit
45d2838fa1
28
database.sql
28
database.sql
@ -1,9 +1,27 @@
|
|||||||
|
create table if not exists tags
|
||||||
|
(
|
||||||
|
tag_id int auto_increment
|
||||||
|
primary key,
|
||||||
|
tag_name varchar(50) null
|
||||||
|
);
|
||||||
|
|
||||||
create table if not exists videos
|
create table if not exists videos
|
||||||
(
|
(
|
||||||
movie_id int auto_increment
|
movie_id int auto_increment
|
||||||
primary key,
|
primary key,
|
||||||
movie_name varchar(200) null,
|
movie_name varchar(200) null,
|
||||||
movie_url varchar(200) null,
|
movie_url varchar(200) null,
|
||||||
thumbnail mediumblob null,
|
thumbnail mediumblob null,
|
||||||
likes int default 0 null
|
likes int default 0 null,
|
||||||
|
create_date datetime default CURRENT_TIMESTAMP null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table if not exists video_tags
|
||||||
|
(
|
||||||
|
tag_id int null,
|
||||||
|
video_id int null,
|
||||||
|
constraint video_tags_tags_tag_id_fk
|
||||||
|
foreign key (tag_id) references tags (tag_id),
|
||||||
|
constraint video_tags_videos_movie_id_fk
|
||||||
|
foreign key (video_id) references videos (movie_id)
|
||||||
);
|
);
|
@ -5,10 +5,13 @@ let scrollposition = 0;
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.post('php/videoload.php', 'action=getMovies', function (data) {
|
$.post('php/videoload.php', 'action=getMovies', function (data) {
|
||||||
videos = data;
|
videos = data;
|
||||||
console.log(videos);
|
|
||||||
loadPreviewBlock(12);
|
loadPreviewBlock(12);
|
||||||
}, 'json');
|
}, 'json');
|
||||||
|
|
||||||
|
$.post('php/videoload.php', 'action=getDbSize', function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}, 'json');
|
||||||
|
|
||||||
$(".closebutton").click(function () {
|
$(".closebutton").click(function () {
|
||||||
$(".videopagewrapper").hide();
|
$(".videopagewrapper").hide();
|
||||||
$(".previewcontainer").show();
|
$(".previewcontainer").show();
|
||||||
|
@ -12,7 +12,7 @@ if (isset($_POST['action'])) {
|
|||||||
$result = $conn->query($query);
|
$result = $conn->query($query);
|
||||||
$rows = array();
|
$rows = array();
|
||||||
while ($r = mysqli_fetch_assoc($result)) {
|
while ($r = mysqli_fetch_assoc($result)) {
|
||||||
array_push($rows,$r);
|
array_push($rows, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo(json_encode($rows));
|
echo(json_encode($rows));
|
||||||
@ -33,14 +33,14 @@ if (isset($_POST['action'])) {
|
|||||||
$query = "SELECT table_schema AS \"Database\",
|
$query = "SELECT table_schema AS \"Database\",
|
||||||
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS \"Size\"
|
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS \"Size\"
|
||||||
FROM information_schema.TABLES
|
FROM information_schema.TABLES
|
||||||
WHERE TABLE_SCHEMA='test'
|
WHERE TABLE_SCHEMA='hub'
|
||||||
GROUP BY table_schema;";
|
GROUP BY table_schema;";
|
||||||
$result = $conn->query($query);
|
$result = $conn->query($query);
|
||||||
|
|
||||||
if ($result->num_rows == 1) {
|
if ($result->num_rows == 1) {
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
|
|
||||||
echo '{"data":"' . $row["Size"] . '"}';
|
echo '{"data":"' . $row["Size"] . 'MB"}';
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -52,6 +52,17 @@ if (isset($_POST['action'])) {
|
|||||||
|
|
||||||
echo($row["thumbnail"]);
|
echo($row["thumbnail"]);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "getTags":
|
||||||
|
$query = "SELECT * FROM video_tags INNER JOIN tags t on video_tags.tag_id = t.tag_id WHERE video_id='" . $_POST['movieid'] . "'";
|
||||||
|
#$query = "SELECT thumbnail FROM videos WHERE movie_id='" . $_POST['movieid'] . "'";
|
||||||
|
|
||||||
|
$result = $conn->query($query);
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
|
||||||
|
echo($row["thumbnail"]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user