added styling to search.php, not working yet

This commit is contained in:
root 2019-04-22 03:14:14 -04:00
parent 815a876d2f
commit 2fdf8b8409
2 changed files with 294 additions and 67 deletions

213
main.css Executable file → Normal file
View File

@ -1,67 +1,146 @@
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%;
}
.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: 20px;
}
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%;
}
.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: 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;
}

148
search.php Executable file
View File

@ -0,0 +1,148 @@
<html>
<head>
echo "<link rel='stylesheet' type='text/css' href='main.css' />";
<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;
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) {
// if($i > 9){
// break;
// }
//Format for video_url
<div class="video-list-container">
<!-- Entry 1 -->
<div id="video-item">
<iframe width="640" height="360" src="https://www.youtube.com/embed/eCI8eAbq-4c" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
<a href="https://www.youtube.com/watch?v=eCI8eAbq-4c">Video Title Here</a>
//Format for player and characters
<div id="players-characters">
<table>
<tr>
<td class="header">Players</td>
<td class="header">Characters</td>
</tr>
//Player1, character1 data
<tr>
<td class="data" id="table-border">Player1</td>
<td class="data" id="table-border">Character1</td>
</tr>
//Player2, character2 data
<tr>
<td class="data" id="table-border">Player2</td>
<td class="data" id="table-border">Character2</td>
</tr>
</table>
</div>
//Game and stage
//
<div id="game-stage">
<p>Game Name</p>
<p>Stage Name</p>
</div>
<div id="description">
<p>The description goes here.......</p>
</div>
//</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++;
}
}
writeEntryforIndex();
//<!-- This is where php code for loading preview videos below the titlebar will go -->
?>
</body>
</html>