Merge branch 'gosse'

This commit is contained in:
Ubuntu 2019-04-22 19:36:41 -04:00
commit c3eb21b6c2
9 changed files with 426 additions and 147 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="text" name="query" class="search" placeholder="Search..">
<input type="submit" name="submit" class="submit" value="Search"> <input type="submit" name="submit" class="submit" value="Search">
<a href="upload.php"><img src="images/upload.png" class="upload" alt="upload"></a> <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 --> <!-- This is where php code for loading preview videos below the titlebar will go -->
<div class="video-list-container"> <div class="video-list-container">

291
main.css Executable file → Normal file
View File

@ -1,147 +1,146 @@
body { body {
background-color: #1E1E1E; background-color: #1E1E1E;
} }
/* Styles for titlebar */ /* Styles for titlebar */
form.search {
/* border: white solid 1px; */ form.search {
height: 150px; /* border: white solid 1px; */
margin-top: -10px !important; height: 150px;
width: 99% !important; margin-top: -10px !important;
border-bottom: #727272 solid 2px; width: 99% !important;
} border-bottom: #727272 solid 2px;
}
.title-text {
float: left; .title-text {
margin-top: 26px; float: left;
padding-right: 20px; margin-top: 26px;
color: #FF3D53; padding-right: 20px;
font-family: "Calibri"; color: #FF3D53;
font-size: 50pt; font-family: "Calibri";
} font-size: 50pt;
}
.search {
width: 50%; .search {
padding: 10px; width: 50%;
font-size: 20px; padding: 10px;
margin-top: 45px; font-size: 20px;
} margin-top: 45px;
}
.submit {
width: 150px; .submit {
padding: 10px; width: 150px;
font-size: 20px; padding: 10px;
} font-size: 20px;
}
img.upload {
width: 150px; img.upload {
/* margin-bottom: -17px; */ width: 150px;
margin-top: 45px; /* margin-bottom: -17px; */
float: right; margin-top: 45px;
} float: right;
}
/* Styles for upload.php */ /* Styles for upload.php */
form.upload-form { form.upload-form {
/* border: white solid 1px; */ /* border: white solid 1px; */
border-left: #727272 solid 2px; border-left: #727272 solid 2px;
border-right: #727272 solid 2px; border-right: #727272 solid 2px;
margin: 0 25% 0 25%; margin: 0 25% 0 25%;
} }
.upload-form input, .upload-form textarea, .upload-form select { .upload-form input, .upload-form textarea, .upload-form select {
display: block; display: block;
margin-left: 20px; margin-left: 20px;
/* margin-bottom: 30px; */ /* margin-bottom: 30px; */
/* border: white solid 1px; */ /* border: white solid 1px; */
} }
.upload-form h3 { .upload-form h3 {
color: #FF3D53; color: #FF3D53;
/* border: white solid 1px; */ /* border: white solid 1px; */
margin-bottom: 0px; margin-bottom: 0px;
margin-left: 20px; margin-left: 20px;
} }
/* Styles for Video element displays */
/* Styles for Video element displays */
div.video-list-container {
div.video-list-container { /* border: white solid 1px; */
/* border: white solid 1px; */ margin-left: 15%;
margin-left: 15%; margin-right: 15%;
margin-right: 15%; }
}
#video-item {
#video-item { /* border: white solid 1px; */
/* border: white solid 1px; */ width: 100%;
width: 100%; height: 178.75px;
height: 178.75px; padding-top: 10px;
padding-top: 10px; border-bottom: #727272 solid 2px;
border-bottom: #727272 solid 2px; }
}
iframe {
iframe { width: 300px;
width: 300px; height: 168.75px;
height: 168.75px; /* margin-top: 5px; */
/* margin-top: 5px; */ margin-bottom: 10px;
margin-bottom: 10px; float: left;
float: left; }
}
.video-list-container a {
.video-list-container a { color: #FF3D53;
color: #FF3D53; /* border: white solid 1px; */
/* border: white solid 1px; */ padding-left: 10px;
padding-left: 10px; /* margin-top: 1000px !important; */
/* margin-top: 1000px !important; */ font-family: "Calibri";
font-family: "Calibri"; /* position: relative; */
/* position: relative; */ }
}
#players-characters {
#players-characters { /* border: white solid 1px; */
/* border: white solid 1px; */ /* display: inline; */
/* display: inline; */ }
}
#players-characters table {
#players-characters table { color: #FF3D53;
color: #FF3D53; font-size: 10pt;
font-size: 10pt; font-family: "Calibri";
font-family: "Calibri"; padding-left: 10px;
padding-left: 10px; width: 20%;
width: 20%; margin-top: 10px;
margin-top: 10px; /* border-right: #727272 solid 2px; */
/* border-right: #727272 solid 2px; */ }
}
table .data {
table .data { font-weight: lighter;
font-weight: lighter; }
}
table .header {
table .header { font-weight: bolder !important;
font-weight: bolder !important; padding-bottom: 10px;
padding-bottom: 10px; }
}
#table-border {
#table-border { border-bottom: #727272 solid 1px;
border-bottom: #727272 solid 1px; }
}
#game-stage {
#game-stage { color: #FF3D53;
color: #FF3D53; float: right;
float: right; font-family: "Calibri";
font-family: "Calibri"; /* border: white solid 1px; */
/* border: white solid 1px; */ /* border-right: #727272 solid 2px; */
/* border-right: #727272 solid 2px; */ margin-top: -83px;
margin-top: -83px; width: 20%;
width: 20%; text-align: left;
text-align: left; }
}
#description p {
#description p { /* border: white solid 1px; */
/* border: white solid 1px; */ color: #FF3D53;
color: #FF3D53; font-family: "Calibri";
font-family: "Calibri"; margin-left: 310px;
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>

1
test.txt Executable file
View File

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

0
upload.php Normal file → Executable file
View File