Video Sharing Website using PHP/MySQLi with Source Code

Language

Project: Video Sharing Website using PHP/MySQLi

About

The Video Sharing Website is a simple PHP/MySQLi project that lets the website users uploads some videos to share with the public online. This is project is inspired by the well-known and one of the most popular video-sharing sites which are YouTube (YT). Using this system, to upload and share a clip or video/s, the user must create an account. When uploading a video or clip on the website, the user should navigate their page to the "My Uploads" page where all the list of their uploaded videos is shown. Then, the user will simply click the "Upload" button at the upper right of the container of the page, then the upload form will popup, this feature and some of the User Interface is still inspired by YouTube and easy to use. When the user chooses their video to upload, the selected video or clip has a preview area which is located at the right side of the upload modal and take note that the selected video is not automatically uploaded to the site yet until the user will submit the form by clicking ht "Upload" button of the modal. The user can also add a thumbnail or poster image for the clip to display. This project also counts the views in each user clip when viewed by other users or visitors to the website.

Features

  • Home Page
    • The page where the system users and website visitors will be redirected by default when browsing the video-sharing website. This page display all the uploaded clip or videos on the website.
  • Login Modal
    • The popup modal where the system users submit their system credentials to access the data and functionalities of the Video Sharing Website.
  • Signup Page
    • The page where the new users create their account.
  • My Uploads Page
    • The page where uploaded clips and videos of the user listed and managed.
  • Upload Modal
    • The popup modal where the users upload their new clip and also when updating their uploaded or posted videos.
  • Search box
    • The input box located at the top navigation bar of the page where the users or visitors enter keywords when looking or searching for a specific clip or video.

The Video Sharing Website was developed using HTML, PHP/MySQLi, CSS, JavaScript (jQuery/Ajax), and Bootstrap for the design. The source code is fully functional and easy to modify or enhance. Follow the instruction below to have an actual experience using this simple project.

How to Run

  1. Download the source code and extract the zip file.
  2. Download or set up any local web server that runs PHP script.
  3. Open the web-server database and create a new database name it vss_db.
  4. Import the SQL file located in the database folder of the source code.
  5. Copy and paste the source code to the location where your local web server accessing your local projects. Example for XAMPP('C:\xampp\htdocs')
  6. Open a web browser and browse the project. E.g [http://localhost/video-sharing-website]

Sample User Access

Email: [email protected]

Password: jsmith123

I hope this simple Video Sharing Website will help you with what you are looking for, feel free to download and modify the source code.

Explore more on this website for more source codes and tutorials.

Enjoy!

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

Submitted byNox Bird (not verified)on Thu, 12/09/2021 - 23:47

You missed the password hashing in the signup process. I added it in the admin_class by function save_user() { extract($_POST); $data = ""; foreach ($_POST as $k => $v) { if (!in_array($k, array('id', 'cpass'))) { //Everything but the confirmation password if (!empty($data)) $data .= ", "; if(in_array($k, array('id', 'password'))){ $hash = md5($v); $data .= " $k='$hash' "; }else{ $data .= " $k='$v' "; } ......
Submitted byNox Bird (not verified)on Thu, 12/09/2021 - 23:51

You missed the password hashing in the signup process. I added it in the admin_class by
  1. function save_user() {
  2. extract($_POST);
  3. $data = "";
  4. foreach ($_POST as $k => $v) {
  5. if (!in_array($k, array('id', 'cpass'))) { //Everything but the confirmation password
  6. if (!empty($data))
  7. $data .= ", ";
  8. if(in_array($k, array('id', 'password'))){
  9. $hash = md5($v);
  10. $data .= " $k='$hash' ";
  11. }else{
  12. $data .= " $k='$v' ";
  13. } ......
Submitted byJoe Peter (not verified)on Sat, 06/11/2022 - 13:06

In reply to by Nox Bird (not verified)

Hi Hashing, When I'm trying to upload large files why is it keeps on loading and caused my browser to crash. Kindly tell how can I fix this problem.
Submitted byNox Bird (not verified)on Sat, 12/11/2021 - 00:20

The file upload is probably not working because your file is larger than the "post_max_size" in your php.ini actually allows it, mine was set to 8MB. Either you increase that (could also be other settings which limit it like max_execution_time or post_max_size) or go for another file upload method.
Submitted byCVE-2021-45255 (not verified)on Tue, 01/11/2022 - 04:09

https://www.cvedetails.com/cve/CVE-2021-45255/ The email parameter from ajax.php of Video Sharing Website 1.0 appears to be vulnerable to SQL injection attacks. A payload injects a SQL sub-query that calls MySQL's load_file function with a UNC file path that references a URL on an external domain. The application interacted with that domain, indicating that the injected SQL query was executed.
Submitted byDaysWeb (not verified)on Fri, 05/27/2022 - 09:09

Am facing problem with login, I have tried all I could, but still showing username or password is incorrect. Kindly let me know how to connect the login.
Submitted byRupesh Kumar S… (not verified)on Fri, 12/30/2022 - 21:20

Why your signup page not inserted encrypted code in database. While the your login password is inserted in encrypted format, how. Please send signup page modified encrypted password insert
Submitted byramses (not verified)on Sat, 03/04/2023 - 14:41

anyone plz give me the modules
Submitted byBishawjet saha (not verified)on Thu, 05/11/2023 - 11:03

What function, was used to make the website do that? And why other user can't log in back.
Submitted byAlvinus (not verified)on Wed, 05/17/2023 - 17:06

i modified in admin_class.php user save: function save_user() { extract($_POST); $data = ""; foreach ($_POST as $k => $v) { if (!in_array($k, array('id', 'cpass'))) { if (!empty($data)) $data .= ", "; if ($k == 'password') { $data .= " $k='".md5($v)."' "; } else { $data .= " $k='$v' "; } } } $chk = $this->db->query("SELECT * FROM users WHERE email = '$email' AND id != '$id'")->num_rows; if ($chk > 0) { return 2; exit; } if ($_FILES['img']['tmp_name'] != '') { $fname = strtotime(date('y-m-d H:i')) . '_' . $_FILES['img']['name']; $move = move_uploaded_file($_FILES['img']['tmp_name'], 'assets/uploads/' . $fname); $data .= ", avatar = '$fname' "; } if (empty($id)) { $save = $this->db->query("INSERT INTO users SET " . $data); $id = $this->db->insert_id; } else { $save = $this->db->query("UPDATE users SET " . $data . " WHERE id = " . $id); } if ($save) { $_SESSION['login_id'] = $id; foreach ($_POST as $key => $value) { if (!in_array($key, array('id', 'cpass'))) $_SESSION['login_' . $key] = $value; } return 1; } }

Add new comment