CONTENTS:
1:15 AM 03/22/2023 (Indonesia)
-
- Fix bug SQLI
// Tambahkan data video ke database
# $conn = mysqli_connect("localhost:8080", "root", "root", "stream");
$query = "INSERT INTO videos (name, path, expiration) VALUES ('$fileName', '$uploadPath', '$expiration')";
mysqli_query($conn, $query);
-
- Fix Bug XSS
# var_dump($conn);
echo "Video berhasil diunggah dan akan dihapus dalam 7 hari.";
echo "Video ada di: " . $uploadPath;
-
- Fix Bug Path Traversal
// Menentukan path untuk menyimpan video
$uploadPath = 'output/' . $fileName;
// Pindahkan file video yang diupload ke folder uploads
move_uploaded_file($_FILES['video']['tmp_name'], $uploadPath);
-
- Fix Bug Use of Hardcoded Credentials
<?php
$conn = mysqli_connect("127.0.0.1", "root", "root", "stream"); # IP, Username, Password, Databases
?>
-
- add file config.php
-
- add file stream.php for streaming videos
-
- add Stream and download videos from user want check this
-
- add index.php in output to patch directory listing
-
- fix bug Xss
if (copy($uploadPath, $streamPath)) {
echo "File berhasil diupload: <a href='output/$fileName'>Download</a> | <a href='output/stream.php?file=$fileName' target='_blank'>Streaming</a>";
-
- fix Bug path traversal
if (move_uploaded_file($_FILES['video']['tmp_name'], $uploadPath)) {
if (copy($uploadPath, $streamPath)) {
-
- Fix Bug Xss
<body>
<video controls autoplay>
<source src="<?php echo 'streaming/' . $_GET['file']; ?>" type="video/mp4">
how to upload and stream video using xampp and mysql
-
Pertama-tama, pastikan bahwa server MySQL sudah berjalan di XAMPP.
-
Buka command prompt atau terminal, lalu jalankan perintah berikut untuk masuk ke shell MySQL:
mysql -u root -p
-
Setelah itu, ketik perintah berikut untuk membuat database baru:
CREATE DATABASE stream;
-
Setelah itu, Buat table videos pada databases stream
-
Command MySQL untuk membuat table videos
CREATE TABLE videos (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
path VARCHAR(255) NOT NULL,
expiration DATE NOT NULL
);
Jika kalian malas untuk membuat databases stream beserta tabelnya, saya sudah Mengekspor tabel dari basis data "stream" yang saya buat
jika kalian ingin mendownload repositori ini, klik ini
-
First of all, make sure that the MySQL server is already running on XAMPP.
-
Open a command prompt or terminal, then run the following command to enter the MySQL shell:
mysql -u root -p
-
After that, type the following command to create a new database:
CREATE DATABASE stream;
-
After that, create a videos table in the stream databases.
-
MySQL command to create the videos table
CREATE TABLE videos (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
path VARCHAR(255) NOT NULL,
expiration DATE NOT NULL
);
If you are too lazy to create a stream database with tables, I have exported the tables from the "stream" database that I created.
if you want to download this repository, click this
CATATAN: UNTUK MENJALAKANNYA, DOWNLOAD REPOSITORY INI DAN MASUKAN KE DALAM FOLDER/LOKASI C:\xampp\htdocs\
SETELAH ITU BUKA XAMPP DAN NYALAKAN INI (APACHE & MYSQL)
Tekan ini Untuk mendownload XAMPP
Oh iya, untuk XAMPP ini username adalah root dan password adalah kosong
NOTES: TO DO IT, DOWNLOAD THIS REPOSITORY AND INSERT IT INTO THE FOLDER/LOCATION C:\xampp\htdocs\
AFTER THAT OPEN XAMPP AND TURN ON THIS (APACHE & MYSQL)
Oh yes, for this XAMPP username is root and password is blank