7 Commits

11 changed files with 427 additions and 135 deletions

BIN
.index.php.swp Normal file

Binary file not shown.

0
hello Executable file
View File

0
images/upload.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

124
index.php
View File

@@ -10,12 +10,134 @@
<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>
</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';
$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();
?>
<!-- This is where php code for loading preview videos below the titlebar will go -->
</body>
</html>

151
main.css Executable file → Normal file
View File

@@ -1,67 +1,146 @@
body {
background-color: #1E1E1E;
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;
/* 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;
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;
width: 50%;
padding: 10px;
font-size: 20px;
margin-top: 45px;
}
.submit {
width: 150px;
padding: 10px;
font-size: 20px;
width: 150px;
padding: 10px;
font-size: 20px;
}
img.upload {
width: 150px;
/* margin-bottom: -17px; */
margin-top: 45px;
float: right;
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%;
/* border: white solid 1px; */
border-left: #727272 solid 2px;
border-right: #727272 solid 2px;
margin: 0 25% 0 25%;
}
.upload-form input, .upload-form textarea, .upload-form select {
display: block;
margin-left: 20px;
/* margin-bottom: 30px; */
/* border: white solid 1px; */
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: 20px;
color: #FF3D53;
/* border: white solid 1px; */
margin-bottom: 0px;
margin-left: 20px;
}
/* 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;
}

0
scripts/main.js Normal file → Executable file
View File

157
search.php Executable file
View File

@@ -0,0 +1,157 @@
<html>
<head>
<title>FightHub - Home</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<!-- Titlebar -->
<form class="search" action="search.php">
<h1 class="title-text">FightHub</h1>
<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>

View File

@@ -1,66 +0,0 @@
<?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['name'];
$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-18-217-5-198.us-east-2.compute.amazonaws.com/index.php");
</script>

1
test.txt Executable file
View File

@@ -0,0 +1 @@
this is a test

View File

@@ -1 +0,0 @@
yo

0
upload.php Normal file → Executable file
View File