diff --git a/index.php b/index.php index c02ebc3..fc9d03b 100755 --- a/index.php +++ b/index.php @@ -139,5 +139,85 @@ function writeEntryforIndex() { ?> + +
+ +
+ + + Video Title Here + +
+ + + + + + + + + + + + + +
PlayersCharacters
Player1Character1
Player2Character2
+
+ +
+

Game Name

+

Stage Name

+
+ +
+

The description goes here.......

+
+ +
+ + + + +
+ + + Video Title Here + +
+ + + + + + + + + + + + + +
PlayersCharacters
Player1Character1
Player2Character2
+
+ +
+

Game Name

+

Stage Name

+
+ +
+

The description goes here.......

+
+ +
+ + +
+ diff --git a/main.css b/main.css index 2c4b822..1902b01 100644 --- a/main.css +++ b/main.css @@ -143,4 +143,4 @@ table .header { color: #FF3D53; font-family: "Calibri"; margin-left: 310px; -} +} \ No newline at end of file diff --git a/scripts/main.js b/scripts/main.js index 03a897d..257f5bc 100755 --- a/scripts/main.js +++ b/scripts/main.js @@ -1,6 +1,103 @@ // Validates the data inputs on the upload form function validateUpload() { - console.log("Validated!"); - document.getElementById("upload-form").submit(); -} \ No newline at end of file + 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.'); + } +} diff --git a/submit.php b/submit.php new file mode 100644 index 0000000..8f0dd70 --- /dev/null +++ b/submit.php @@ -0,0 +1,66 @@ +connect_error) { + //echo "it dead
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
"; + +$url = mysqli_real_escape_string($conn, $url); +//echo "done
"; +$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
"; +//echo ""; + +$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 ""; +//echo $sql; + +if($conn->query($sql) === TRUE){ + echo "New record created successfully"; +} +else { + echo "Error"; + echo $conn->error; +} +$conn->close() + +//echo "" + +//header("Location: http://ec2-18-217-5-198.us-east-2.compute.amazonaws.com/index.php"); + +//exit; +?> + + + diff --git a/upload.php b/upload.php index 7bf6d0d..8efc326 100755 --- a/upload.php +++ b/upload.php @@ -1,63 +1,62 @@ - - - FightHub - Upload - - - - - - - - - -
- -

Youtube URL *

- - -

Name *

- - -

Username *

- - -

Description

- - -

Event Date

- - -

Video Length

- - -

Characters (Seperated by commas) *

- - -

Players (Seperated by commas) *

- - -

Select Game *

- - -

Stage Name *

- - - - -
- - - + + + FightHub - Upload + + + + + + + + + +
+ +

Youtube URL *

+ + +

Video Title *

+ + +

Username *

+ + +

Description

+ + +

Event Date *

+ + +

Video Length

+ + +

Characters (Seperated by commas) *

+ + +

Players (Seperated by commas) *

+ + +

Select Game *

+ + +

Stage Name *

+ + + +
+ + +