forked from Shubhamb7/OnlineMovieStreaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-control.php
30 lines (23 loc) · 884 Bytes
/
admin-control.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
<?php
session_start();
if (isset($_POST['upload'])) {
include 'dbh.php';
$targetvid = "video-uploads/".basename($_FILES['video']['name']);
$target = "uploads/".basename($_FILES['image']['name']);
$name = strtolower($_POST['mname']);
$rdate = $_POST['release'];
$genre = strtolower($_POST['genre']);
$rtime = $_POST['rtime'];
$desc = $_POST['desc'];
$image = $_FILES['image']['name'];
$video = $_FILES['video']['name'];
$sql = "INSERT INTO movies (name, rdate, genre, runtime, decription, imgpath, videopath)
VALUES('$name','$rdate','$genre','$rtime','$desc','$image','$video')";
mysqli_query($conn,$sql);
if (move_uploaded_file($_FILES['image']['tmp_name'],$target) && move_uploaded_file($_FILES['video']['tmp_name'],$targetvid)) {
header("Location: homepage.php");
}else {
echo "error uploading";
}
}
?>