47 Commits

Author SHA1 Message Date
gosselingdevries
637788b8fd Merge 60e6fbf8a1 into 468aa4a64d 2024-12-04 12:58:51 +00:00
Clayton Wilson
60e6fbf8a1 Update README.md 2022-03-02 18:52:43 -05:00
Clayton Wilson
5ac377b8ad Added screenshots 2022-03-02 17:42:51 -06:00
Ubuntu
64dbe40470 Fix upload styles 2019-04-23 16:47:44 -04:00
02f98647a8 Disable description resizing 2019-04-23 01:34:12 -04:00
Clayton Wilson
35f92e1e5d Merge pull request #9 from ClaytonWWilson/Clayton-homelink-languages
Added English tags and a link to the index page on the logo.
2019-04-23 01:23:32 -04:00
bc2c648409 Added English tags and a link to the index page on the logo. 2019-04-23 01:22:54 -04:00
Clayton Wilson
2fba4b63d0 Merge pull request #8 from ClaytonWWilson/Clayton-style-upload.php
Styles upload.php
2019-04-23 01:09:23 -04:00
b6936f1a31 Styles upload.php 2019-04-23 01:08:41 -04:00
55dfdf84e9 Changing the url of the submit.php redirect 2019-04-22 21:29:03 -04:00
7c7b854314 Removed the hardcoded videos 2019-04-22 20:41:57 -04:00
dbb814f272 Removed test files 2019-04-22 19:38:23 -04:00
c3eb21b6c2 Merge branch 'gosse' 2019-04-22 19:36:41 -04:00
21addd4591 Fixed merge 2019-04-22 19:36:16 -04:00
ab58e096a4 Delete text.txt 2019-04-22 19:28:26 -04:00
b5f8ca322a Updated variable name 2019-04-22 19:27:35 -04:00
Clayton Wilson
175aca119a Merge pull request #5 from ClaytonWWilson/Tristan_submit.php
Tristan submit.php
2019-04-22 19:22:23 -04:00
root
468aa4a64d removed all debugging echo calls, character and player names now display separately 2019-04-22 19:21:52 -04:00
Ubuntu
896f42f4b0 submip.php file almost done 2019-04-22 19:11:58 -04:00
root
c4c6992e7c working styles for index.php and search.php. Index.php still prints all data from a row 2019-04-22 15:47:06 -04:00
root
2fdf8b8409 added styling to search.php, not working yet 2019-04-22 03:14:14 -04:00
67ef4f0915 Added bracket 2019-04-22 01:02:53 -04:00
20aed419cb Add styles and layout html code for video item list 2019-04-22 00:21:47 -04:00
root
815a876d2f index.php now gets 10 rows from video table and prints them sorted by date 2019-04-21 22:11:55 -04:00
c70626cebe Fix Merge 2019-04-20 18:00:00 -04:00
609af1c391 Fixed Merge 2019-04-20 17:57:14 -04:00
dbe0ba85fb Updated update.php and add JS to it for textbox error checking 2019-04-20 17:50:37 -04:00
Ubuntu
9b4d874b62 fixed upload.php merge conflict 2019-04-20 16:51:49 -04:00
root
5e5043f6b2 Merge branch 'master' into gosse 2019-04-20 16:47:51 -04:00
Ubuntu
dfaf9a1fe9 Merge branch 'master' into Tristan_submit.php 2019-04-20 16:45:14 -04:00
Clayton Wilson
3805467ac3 Merge pull request #4 from ClaytonWWilson/Clayton-upload.php
Clayton upload.php
2019-04-20 16:41:52 -04:00
a3b3a5b590 Upload.php html done 2019-04-20 16:40:36 -04:00
Ubuntu
bdefb1a3b4 Merge branch 'master' into Tristan_submit.php 2019-04-20 16:33:00 -04:00
Ubuntu
2168199135 upload.php 1st draft 2019-04-20 16:27:51 -04:00
Ubuntu
a4832358ea Merge branch 'master' into Tristan_submit.php 2019-04-20 16:22:22 -04:00
d82c70f94c Removed old_index.html 2019-04-20 16:02:41 -04:00
02c5c43428 work on the upload page 2019-04-20 15:17:00 -04:00
4eeda2e474 upload.php html and temporary style 2019-04-20 03:19:40 -04:00
6577bc3bd3 html for upload.php 2019-04-20 00:44:46 -04:00
Clayton Wilson
e3ae50dfb4 Merge pull request #3 from ClaytonWWilson/Clayton-index.php
Adding upload button
2019-04-19 23:43:23 -04:00
87cfe55154 Adding upload button 2019-04-19 23:39:59 -04:00
Clayton Wilson
5be24b43b5 Merge pull request #2 from ClaytonWWilson/Clayton-index.php
Clayton index.php
2019-04-18 00:32:01 -04:00
974ec9b655 Titlebar for index.php completed 2019-04-18 00:18:00 -04:00
7a91f187bb Removed test file 2019-04-17 20:56:03 -04:00
c588fa15cc test commit 2019-04-17 01:07:26 -04:00
root
20dc303cc9 test 2 2019-04-17 00:40:05 -04:00
root
d42f45fff0 test 2019-04-17 00:28:41 -04:00
16 changed files with 803 additions and 392 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
.htaccess Normal file → Executable file
View File

BIN
.index.php.swp Normal file

Binary file not shown.

7
README.md Normal file → Executable file
View File

@@ -1,2 +1,9 @@
# FightHub
A website that allows you to share videos of matches in fighting games. You can also search for videos added by other users.
### Images
<p>
<img alt="0.png" src="./Screenshots/0.png" width="1000">
<img alt="1.png" src="./Screenshots/1.png" width="1000">
<img alt="2.png" src="./Screenshots/2.png" width="1000">
</p>

BIN
Screenshots/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

BIN
Screenshots/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
Screenshots/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

BIN
images/upload.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

152
index.php Normal file → Executable file
View File

@@ -1,23 +1,143 @@
<html>
<html lang="en">
<head>
<title>PHP Test</title>
<title>FightHub - Home</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<?php echo '<p>Hello World</p>';
<!-- Titlebar -->
<form class="search" action="search.php">
<a href="/"><h1 class="title-text">FightHub</h1></a>
<input type="text" name="query" class="search" placeholder="Search..">
<input type="submit" name="submit" class="submit" value="Search">
<a href="upload.php"><img src="images/upload.png" class="upload" alt="upload"></a>
</form>
// In the variables section below, replace user and password with your own MySQL credentials as created on your server
$servername = "localhost";
$username = "fighthubuser";
$password = "cC33dC8W";
<!-- code for connecting to mysql -->
<?php
function writeEntryforIndex() {
// Create MySQL connection
$conn = mysqli_connect($servername, $username, $password);
$servername = "localhost";
$username = "fighthubuser";
$password = "cC33dC8W";
$database = "fighthubdata";
// Check connection - if it fails, output will include the error message
if (!$conn) {
die('<p>Connection failed: <p>' . mysqli_connect_error());
}
echo '<p>Connected successfully</p>';
?>
</body>
// Create MySQL connection
$conn = mysqli_connect($servername, $username, $password, "fighthubdata");
// Check connection - if it fails, output will include the error message
if (!$conn) {
echo 'death';
die('<p>Connection failed: <p>' . mysql_error());
}
//echo '<font color="#FF3D5"><p>Connect1ed successfully</p></font>';
// $sql = 'SELECT video_id, video_url, video_name, username, date_upload, date_video, video_length, description, characters, players, game, stage, approved FROM video';
//$sql = 'select * from video';
// mysqli_select_db('fighthubdata');
//echo 'hello';
$retval = mysqli_query( $conn, "select * from video order by date_video DESC ");
//echo 'test';
if(!$retval ) {
//echo '<p>death</p>'
die('Could not get data: ' . mysqli_error());
}
//echo '<font color="blue">not death</font>';
//$search = $_GET['query'];
$i = 0;
echo "<div class=\"video-list-container\"> ";
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) {
if($i > 9){
break;
}
//Format for video_url
//Get substring from url after '='
$splitUrl = explode("=", $row['video_url']);
$splitChar = explode(",", $row['characters']);
$splitPlay = explode(",", $row['players']);
echo "<!-- Entry 1 -->" .
"<div id=\"video-item\">" .
"<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/$splitUrl[1]\" frameborder=\"0\"" .
"allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"" .
"allowfullscreen>" .
"</iframe>" .
"<a href=\"{$row['video_url']}\">{$row['video_name']}</a>" .
"<div id=\"players-characters\">" .
"<table>" .
"<tr>" .
"<td class=\"header\">Players</td>" .
"<td class=\"header\">Characters</td>" .
"</tr>" .
"<tr>" .
"<td class=\"data\" id=\"table-border\">$splitPlay[0]</td>" .
"<td class=\"data\" id=\"table-border\">$splitChar[0]</td>" .
"</tr>" .
"<tr>" .
"<td class=\"data\" id=\"table-border\">$splitPlay[1]</td>" .
"<td class=\"data\" id=\"table-border\">$splitChar[1]</td>" .
"</tr>" .
"</table>" .
"</div>" .
"<div id=\"game-stage\">" .
"<p>{$row['game']}</p>" .
"<p>{$row['stage']}</p>" .
"</div>" .
"<div id=\"description\">" .
"<p>{$row['description']}</p>".
"</div>" .
"</div> ";
/*
echo "<font color='#FF3D53'> VIDEO ID :{$row['video_id']} <br> ".
"VIDEO URL : {$row['video_url']} <br> ".
"VIDEO NAME : {$row['video_name']} <br> ".
"USERNAME : {$row['username']} <br> ".
"DATE UPLOAD : {$row['date_upload']} <br> ".
"DATE VIDEO : {$row['date_video']} <br> ".
"VIDEO LENGTH : {$row['video_length']} <br> ".
"DESCRIPTION : {$row['description']} <br> ".
"CHARACTERS : {$row['characters']} <br> ".
"PLAYERS : {$row['players']} <br> ".
"GAME : {$row['game']} <br> ".
"STAGE : {$row['stage']} <br> ".
"APPROVED : {$row['approved']} <br> ".
"--------------------------------<br></font>";
echo "<font color='#FF3D53'>Fetched data successfully\n</font>";
*/
mysqli_close($conn);
$i++;
}
echo "</div>";
}
writeEntryforIndex();
?>
</body>
</html>

251
main.css Normal file
View File

@@ -0,0 +1,251 @@
body {
background-color: #1E1E1E;
}
/* Styles for titlebar */
form.search {
/* border: white solid 1px; */
height: 150px;
margin-top: -10px !important;
width: 99% !important;
border-bottom: #727272 solid 2px;
}
.title-text {
float: left;
margin-top: 26px;
padding-right: 20px;
color: #FF3D53;
font-family: "Calibri";
font-size: 50pt;
}
.search {
width: 50%;
padding: 10px;
font-size: 20px;
margin-top: 45px;
}
.submit {
width: 150px;
padding: 10px;
font-size: 20px;
}
img.upload {
width: 150px;
/* margin-bottom: -17px; */
margin-top: 45px;
float: right;
}
/* Styles for upload.php */
form.upload-form {
/* border: white solid 1px; */
border-left: #727272 solid 2px;
border-right: #727272 solid 2px;
margin: 0 25% 0 25%;
margin-top: 60px;
margin-bottom: 60px;
}
.upload-form input, .upload-form textarea, .upload-form select {
display: block;
margin-left: 20px;
/* margin-bottom: 30px; */
/* border: white solid 1px; */
}
.upload-form h3 {
color: #FF3D53;
/* border: white solid 1px; */
margin-bottom: 0px;
margin-left: 2%;
}
h3.url {
/* padding-top: 40px; */
/* border: white solid 1px; */
}
.url {
/* margin: auto !important; */
width: 93%;
}
h3.title {
padding-top: 40px;
}
.title {
/* margin: auto !important; */
width: 93%;
}
.user-date {
width: 93%;
margin-left: 3%;
/* margin: auto; */
}
.username {
/* margin-left: 20px; */
padding-top: 20px;
margin-left: -20px;
}
.video-date {
float: right;
margin-top: -62px;
}
.description {
width: 93%;
/* margin: auto !important; */
resize: none;
}
h3.description {
padding-top: 40px;
}
.characters {
width: 93%;
/* margin: auto !important; */
}
h3.characters {
padding-top: 40px;
}
.players {
width: 93%;
/* margin: auto !important; */
}
h3.players {
padding-top: 40px;
}
.game-info {
width: 93%;
margin-left: 3%;
/* margin: auto; */
}
.game-name {
padding-top: 20px;
margin-left: -20px;
}
.stage-name {
float: right;
margin-top: -61px;
}
.length-button {
margin: 3%;
width: 93%;
/* border: white solid 1px; */
}
.length {
padding-top: 10px;
margin-left: -20px;
}
.button {
float: right;
margin-top: -21px;
}
h3 {
padding-left: 15px;
}
/* Styles for Video element displays */
div.video-list-container {
/* border: white solid 1px; */
margin-left: 15%;
margin-right: 15%;
}
#video-item {
/* border: white solid 1px; */
width: 100%;
height: 178.75px;
padding-top: 10px;
border-bottom: #727272 solid 2px;
}
iframe {
width: 300px;
height: 168.75px;
/* margin-top: 5px; */
margin-bottom: 10px;
float: left;
}
.video-list-container a {
color: #FF3D53;
/* border: white solid 1px; */
padding-left: 10px;
/* margin-top: 1000px !important; */
font-family: "Calibri";
/* position: relative; */
}
#players-characters {
/* border: white solid 1px; */
/* display: inline; */
}
#players-characters table {
color: #FF3D53;
font-size: 10pt;
font-family: "Calibri";
padding-left: 10px;
width: 20%;
margin-top: 10px;
/* border-right: #727272 solid 2px; */
}
table .data {
font-weight: lighter;
}
table .header {
font-weight: bolder !important;
padding-bottom: 10px;
}
#table-border {
border-bottom: #727272 solid 1px;
}
#game-stage {
color: #FF3D53;
float: right;
font-family: "Calibri";
/* border: white solid 1px; */
/* border-right: #727272 solid 2px; */
margin-top: -83px;
width: 20%;
text-align: left;
}
#description p {
/* border: white solid 1px; */
color: #FF3D53;
font-family: "Calibri";
margin-left: 310px;
}

View File

@@ -1,375 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Modified from the Debian original for Ubuntu
Last updated: 2016-11-16
See: https://launchpad.net/bugs/1288690
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache2 Ubuntu Default Page: It works</title>
<style type="text/css" media="screen">
* {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
body, html {
padding: 3px 3px 3px 3px;
background-color: #D8DBE2;
font-family: Verdana, sans-serif;
font-size: 11pt;
text-align: center;
}
div.main_page {
position: relative;
display: table;
width: 800px;
margin-bottom: 3px;
margin-left: auto;
margin-right: auto;
padding: 0px 0px 0px 0px;
border-width: 2px;
border-color: #212738;
border-style: solid;
background-color: #FFFFFF;
text-align: center;
}
div.page_header {
height: 99px;
width: 100%;
background-color: #F5F6F7;
}
div.page_header span {
margin: 15px 0px 0px 50px;
font-size: 180%;
font-weight: bold;
}
div.page_header img {
margin: 3px 0px 0px 40px;
border: 0px 0px 0px;
}
div.table_of_contents {
clear: left;
min-width: 200px;
margin: 3px 3px 3px 3px;
background-color: #FFFFFF;
text-align: left;
}
div.table_of_contents_item {
clear: left;
width: 100%;
margin: 4px 0px 0px 0px;
background-color: #FFFFFF;
color: #000000;
text-align: left;
}
div.table_of_contents_item a {
margin: 6px 0px 0px 6px;
}
div.content_section {
margin: 3px 3px 3px 3px;
background-color: #FFFFFF;
text-align: left;
}
div.content_section_text {
padding: 4px 8px 4px 8px;
color: #000000;
font-size: 100%;
}
div.content_section_text pre {
margin: 8px 0px 8px 0px;
padding: 8px 8px 8px 8px;
border-width: 1px;
border-style: dotted;
border-color: #000000;
background-color: #F5F6F7;
font-style: italic;
}
div.content_section_text p {
margin-bottom: 6px;
}
div.content_section_text ul, div.content_section_text li {
padding: 4px 8px 4px 16px;
}
div.section_header {
padding: 3px 6px 3px 6px;
background-color: #8E9CB2;
color: #FFFFFF;
font-weight: bold;
font-size: 112%;
text-align: center;
}
div.section_header_red {
background-color: #CD214F;
}
div.section_header_grey {
background-color: #9F9386;
}
.floating_element {
position: relative;
float: left;
}
div.table_of_contents_item a,
div.content_section_text a {
text-decoration: none;
font-weight: bold;
}
div.table_of_contents_item a:link,
div.table_of_contents_item a:visited,
div.table_of_contents_item a:active {
color: #000000;
}
div.table_of_contents_item a:hover {
background-color: #000000;
color: #FFFFFF;
}
div.content_section_text a:link,
div.content_section_text a:visited,
div.content_section_text a:active {
background-color: #DCDFE6;
color: #000000;
}
div.content_section_text a:hover {
background-color: #000000;
color: #DCDFE6;
}
div.validator {
}
</style>
</head>
<body>
<div class="main_page">
<div class="page_header floating_element">
<img src="/icons/ubuntu-logo.png" alt="Ubuntu Logo" class="floating_element"/>
<span class="floating_element">
Apache2 Ubuntu Default Page
</span>
</div>
<!-- <div class="table_of_contents floating_element">
<div class="section_header section_header_grey">
TABLE OF CONTENTS
</div>
<div class="table_of_contents_item floating_element">
<a href="#about">About</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#changes">Changes</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#scope">Scope</a>
</div>
<div class="table_of_contents_item floating_element">
<a href="#files">Config files</a>
</div>
</div>
-->
<div class="content_section floating_element">
<div class="section_header section_header_red">
<div id="about"></div>
It works!
</div>
<div class="content_section_text">
<p>
This is the default welcome page used to test the correct
operation of the Apache2 server after installation on Ubuntu systems.
It is based on the equivalent page on Debian, from which the Ubuntu Apache
packaging is derived.
If you can read this page, it means that the Apache HTTP server installed at
this site is working properly. You should <b>replace this file</b> (located at
<tt>/var/www/html/index.html</tt>) before continuing to operate your HTTP server.
</p>
<p>
If you are a normal user of this web site and don't know what this page is
about, this probably means that the site is currently unavailable due to
maintenance.
If the problem persists, please contact the site's administrator.
</p>
</div>
<div class="section_header">
<div id="changes"></div>
Configuration Overview
</div>
<div class="content_section_text">
<p>
Ubuntu's Apache2 default configuration is different from the
upstream default configuration, and split into several files optimized for
interaction with Ubuntu tools. The configuration system is
<b>fully documented in
/usr/share/doc/apache2/README.Debian.gz</b>. Refer to this for the full
documentation. Documentation for the web server itself can be
found by accessing the <a href="/manual">manual</a> if the <tt>apache2-doc</tt>
package was installed on this server.
</p>
<p>
The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:
</p>
<pre>
/etc/apache2/
|-- apache2.conf
| `-- ports.conf
|-- mods-enabled
| |-- *.load
| `-- *.conf
|-- conf-enabled
| `-- *.conf
|-- sites-enabled
| `-- *.conf
</pre>
<ul>
<li>
<tt>apache2.conf</tt> is the main configuration
file. It puts the pieces together by including all remaining configuration
files when starting up the web server.
</li>
<li>
<tt>ports.conf</tt> is always included from the
main configuration file. It is used to determine the listening ports for
incoming connections, and this file can be customized anytime.
</li>
<li>
Configuration files in the <tt>mods-enabled/</tt>,
<tt>conf-enabled/</tt> and <tt>sites-enabled/</tt> directories contain
particular configuration snippets which manage modules, global configuration
fragments, or virtual host configurations, respectively.
</li>
<li>
They are activated by symlinking available
configuration files from their respective
*-available/ counterparts. These should be managed
by using our helpers
<tt>
a2enmod,
a2dismod,
</tt>
<tt>
a2ensite,
a2dissite,
</tt>
and
<tt>
a2enconf,
a2disconf
</tt>. See their respective man pages for detailed information.
</li>
<li>
The binary is called apache2. Due to the use of
environment variables, in the default configuration, apache2 needs to be
started/stopped with <tt>/etc/init.d/apache2</tt> or <tt>apache2ctl</tt>.
<b>Calling <tt>/usr/bin/apache2</tt> directly will not work</b> with the
default configuration.
</li>
</ul>
</div>
<div class="section_header">
<div id="docroot"></div>
Document Roots
</div>
<div class="content_section_text">
<p>
By default, Ubuntu does not allow access through the web browser to
<em>any</em> file apart of those located in <tt>/var/www</tt>,
<a href="http://httpd.apache.org/docs/2.4/mod/mod_userdir.html" rel="nofollow">public_html</a>
directories (when enabled) and <tt>/usr/share</tt> (for web
applications). If your site is using a web document root
located elsewhere (such as in <tt>/srv</tt>) you may need to whitelist your
document root directory in <tt>/etc/apache2/apache2.conf</tt>.
</p>
<p>
The default Ubuntu document root is <tt>/var/www/html</tt>. You
can make your own virtual hosts under /var/www. This is different
to previous releases which provides better security out of the box.
</p>
</div>
<div class="section_header">
<div id="bugs"></div>
Reporting Problems
</div>
<div class="content_section_text">
<p>
Please use the <tt>ubuntu-bug</tt> tool to report bugs in the
Apache2 package with Ubuntu. However, check <a
href="https://bugs.launchpad.net/ubuntu/+source/apache2"
rel="nofollow">existing bug reports</a> before reporting a new bug.
</p>
<p>
Please report bugs specific to modules (such as PHP and others)
to respective packages, not to the web server itself.
</p>
</div>
</div>
</div>
<div class="validator">
</div>
</body>
</html>

103
scripts/main.js Executable file
View File

@@ -0,0 +1,103 @@
// Validates the data inputs on the upload form
function validateUpload() {
var url_bar = document.getElementById('url');
var video_title = document.getElementById('title');
var username = document.getElementById('username');
// var description = document.getElementById('description'); // optional
var video_date = document.getElementById('video-date');
// var length = document.getElementById('length'); // optional
var characters = document.getElementById('characters');
var players = document.getElementById('players');
var game = document.getElementById('game');
var stage = document.getElementById('stage');
// console.log('url_bar: ' + url_bar);
// console.log('video_title: ' + video_title);
// console.log('username: ' + username);
// console.log('description: ' + description);
// console.log('video_date: ' + video_date);
// console.log('length: ' + length);
// console.log('characters: ' + characters);
// console.log('players: ' + players);
// console.log('game: ' + game);
// console.log('stage: ' + stage);
// Checking that the required text boxes are filled in, and highlighting them red
// if they are not
var form_complete = true;
// URL
if (url_bar.value == "") {
form_complete = false;
url_bar.style = "border-color:red;"
} else {
url_bar.style = "border-color:green;"
}
// Video Title
if (video_title.value == "") {
form_complete = false;
video_title.style = "border-color:red;"
} else {
video_title.style = "border-color:green;"
}
// Username
if (username.value == "") {
form_complete = false;
username.style = "border-color:red;"
} else {
username.style = "border-color:green;"
}
// Video Date
if (video_date.value == "") {
form_complete = false;
video_date.style = "border-color:red;"
} else {
video_date.style = "border-color:green;"
}
// Characters
if (characters.value == "") {
form_complete = false;
characters.style = "border-color:red;"
} else {
characters.style = "border-color:green;"
}
// Players
if (players.value == "") {
form_complete = false;
players.style = "border-color:red;"
} else {
players.style = "border-color:green;"
}
// Game
if (game.value == "") {
form_complete = false;
game.style = "border-color:red;"
} else {
game.style = "border-color:green;"
}
// Stage
if (stage.value == "") {
form_complete = false;
stage.style = "border-color:red;"
} else {
stage.style = "border-color:green;"
}
// If the form is completely filled out, call the submit function for the form
// and redirect them to submit.php, otherwise alert them that they've forgotten to
// fill in some of the form
if (form_complete) {
document.getElementById("upload-form").submit();
} else {
alert('Please fill out the rest of the upload form.');
}
}

156
search.php Executable file
View File

@@ -0,0 +1,156 @@
<html lang="en">
<head>
<title>FightHub - Search</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<!-- Titlebar -->
<form class="search" action="search.php">
<a href="/"><h1 class="title-text">FightHub</h1></a>
<input type="text" name="query" class="search" placeholder="Search..">
<input type="submit" name="submit" class="submit" value="Search">
<a href="upload.php"><img src="images/upload.png" class="upload" alt="upload"></a>
</form>
<!-- code for connecting to mysql -->
<?php
function writeEntryforIndex() {
$servername = "localhost";
$username = "fighthubuser";
$password = "cC33dC8W";
$database = "fighthubdata";
// Create MySQL connection
$conn = mysqli_connect($servername, $username, $password, "fighthubdata");
// Check connection - if it fails, output will include the error message
if (!$conn) {
echo 'death';
die('<p>Connection failed: <p>' . mysql_error());
}
//echo '<font color="#FF3D5"><p>Connect1ed successfully</p></font>';
// $sql = 'SELECT video_id, video_url, video_name, username, date_upload, date_video, video_length, description, characters, players, game, stage, approved FROM video';
//$sql = 'select * from video';
// mysqli_select_db('fighthubdata');
//echo 'hello';
$search = $_GET['query'];
//echo $search;
$retval = mysqli_query( $conn, "select * from video where characters like '%$search%' OR players like '%$search%' OR description like '%$search%' OR game like '%$search%' OR stage like '%$search%' OR video_name like '%$search%'");
//echo 'test';
if(!$retval ) {
//echo '<p>death</p>'
die('Could not get data: ' . mysqli_error());
}
//echo '<font color="blue">not death</font>';
// $i = 9;
echo "<div class=\"video-list-container\"> ";
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) {
// if($i > 9){
// break;
// }
//Format for video_url
//Get substring from url after '='
$split = explode("=", $row['video_url']);
$splitChar = explode(",", $row['characters']);
$splitPlay = explode(",", $row['players']);
echo "<!-- Entry 1 -->" .
"<div id=\"video-item\">" .
"<iframe width=\"640\" height=\"360\" src=\"https://www.youtube.com/embed/$split[1]\" frameborder=\"0\"" .
"allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"" .
"allowfullscreen>" .
"</iframe>" .
"<a href=\"{$row['video_url']}\">{$row['video_name']}</a>" .
"<div id=\"players-characters\">" .
"<table>" .
"<tr>" .
"<td class=\"header\">Players</td>" .
"<td class=\"header\">Characters</td>" .
"</tr>" .
"<tr>" .
"<td class=\"data\" id=\"table-border\">$splitPlay[0]</td>" .
"<td class=\"data\" id=\"table-border\">$splitChar[0]</td>" .
"</tr>" .
"<tr>" .
"<td class=\"data\" id=\"table-border\">$splitPlay[1]</td>" .
"<td class=\"data\" id=\"table-border\">$splitChar[1]</td>" .
"</tr>" .
"</table>" .
"</div>" .
"<div id=\"game-stage\">" .
"<p>{$row['game']}</p>" .
"<p>{$row['stage']}</p>" .
"</div>" .
"<div id=\"description\">" .
"<p>{$row['description']}</p>".
"</div>" .
"</div> ";
/*
echo "<font color='#FF3D53'> VIDEO ID :{$row['video_id']} <br> ".
"VIDEO URL : {$row['video_url']} <br> ".
"VIDEO NAME : {$row['video_name']} <br> ".
"USERNAME : {$row['username']} <br> ".
"DATE UPLOAD : {$row['date_upload']} <br> ".
"DATE VIDEO : {$row['date_video']} <br> ".
"VIDEO LENGTH : {$row['video_length']} <br> ".
"DESCRIPTION : {$row['description']} <br> ".
"CHARACTERS : {$row['characters']} <br> ".
"PLAYERS : {$row['players']} <br> ".
"GAME : {$row['game']} <br> ".
"STAGE : {$row['stage']} <br> ".
"APPROVED : {$row['approved']} <br> ".
"--------------------------------<br></font>";
echo "<font color='#FF3D53'>Fetched data successfully\n</font>";
*/
mysqli_close($conn);
$i++;
}
echo "</div>";
}
writeEntryforIndex();
//<!-- This is where php code for loading preview videos below the titlebar will go -->
?>
</body>
</html>

66
submit.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
$servername = "localhost";
$username = "fighthubuser";
$password = "cC33dC8W";
$database = "fighthubdata";
$conn = new mysqli($servername, $username, $password, $database);
if($conn->connect_error) {
//echo "it dead<br>i";
die("Connection failed: " . $conn->connect_error);
}
$url = $_GET['url'];
$title = $_GET['title'];
$username = $_GET['username'];
$description = $_GET['description'];
$event_date = $_GET['video-date'];
$length = $_GET['length'];
$characters = $_GET['characters'];
$players = $_GET['players'];
$game = $_GET['game'];
$stage = $_GET['stage'];
$date = date('Y\-m\-d');
//echo "here<br>";
$url = mysqli_real_escape_string($conn, $url);
//echo "done<br>";
$title = mysqli_real_escape_string($conn, $title);
$username = mysqli_real_escape_string($conn, $username);
$description = mysqli_real_escape_string($conn, $description);
$event_date = mysqli_real_escape_string($conn, $event_date);
$length = mysqli_real_escape_string($conn, $length);
$characters = mysqli_real_escape_string($conn, $characters);
$players = mysqli_real_escape_string($conn, $players);
$game = mysqli_real_escape_string($conn, $game);
$stage = mysqli_real_escape_string($conn, $stage);
$date = mysqli_real_escape_string($conn, $date);
//echo "there boi<br>";
//echo "<script type='text/javascript'>alert('".$stage."');</script>";
$sql = "INSERT INTO video (video_url, video_name, username, date_upload, date_video, video_length, description, characters, players, game, stage, approved) VALUES ('$url', '$title', '$username', '$date', '$event_date', '$length', '$description', '$characters', '$players', '$game', '$stage', TRUE)";
//echo "<script type='text/javascript'>alert($sql);</script>";
//echo $sql;
if($conn->query($sql) === TRUE){
echo "New record created successfully";
}
else {
echo "Error";
echo $conn->error;
}
$conn->close()
//echo "<script type='text/javascript'>window.location.href = 'index.php';</script>"
//header("Location: http://ec2-18-217-5-198.us-east-2.compute.amazonaws.com/index.php");
//exit;
?>
<script>
location.replace("http://ec2-13-58-8-152.us-east-2.compute.amazonaws.com/index.php");
</script>

View File

@@ -1 +0,0 @@
yo

84
upload.php Executable file
View File

@@ -0,0 +1,84 @@
<html lang="en">
<head>
<title>FightHub - Upload</title>
<link rel="stylesheet" href="main.css">
<script src="scripts/main.js"></script>
</head>
<body>
<!-- Titlebar -->
<form class="search" action="search.php">
<a href="/"><h1 class="title-text">FightHub</h1></a>
<input type="text" name="query" class="search" placeholder="Search..">
<input type="submit" name="submit" class="submit" value="Search">
<a href="upload.php"><img src="images/upload.png" class="upload" alt="upload"></a>
</form>
<!-- submit.php will read the variables from the url and add it to the database -->
<form class="upload-form" id="upload-form" action="submit.php">
<h3 class="url">Youtube URL *</h3>
<input type="text" name="url" id="url" class="url">
<h3 class="title">Video Title *</h3>
<input type="text" name="title" id="title" class="title">
<div class="user-date">
<div class="username">
<h3>Username *</h3>
<input type="text" name="username" id="username">
</div>
<div class="video-date">
<h3>Event Date *</h3>
<input type="date" name="video-date" id="video-date">
</div>
</div>
<h3 class="description">Description</h3>
<textarea name="description" cols="30" rows="10" id="description" class="description"></textarea>
<h3 class="characters">Characters (Seperated by commas) *</h3>
<input type="text" name="characters" id="characters" class="characters">
<h3 class="players">Players (Seperated by commas) *</h3>
<input type="text" name="players" id="players" class="players">
<div class="game-info">
<div class="game-name">
<h3>Select Game *</h3>
<select name="game" id="game">
<option disabled selected value>-- Game --</option>
<option value="Street Fighter V">Street Fighter V</option>
<option value="Mortal Kombat 11">Mortal Kombat 11</option>
<option value="Super Smash Bros Melee">Super Smash Bros Melee</option>
<option value="Super Smash Bros Ultimate">Super Smash Ultimate</option>
<option value="Killer Instinct">Killer Instinct</option>
<option value="Injustice">Injustice</option>
</select>
</div>
<div class="stage-name">
<h3 class="stage">Stage Name *</h3>
<input type="text" name="stage" id="stage" class="stage">
</div>
</div>
<div class="length-button">
<div class="length">
<h3>Video Length</h3>
<input type="text" name="length" id="length">
</div>
<div class="button">
<input type="button" name="submit_button" value="Submit" onclick="validateUpload()">
</div>
</div>
</form>
</body>
</html>