diff options
-rw-r--r-- | handle-reservation.php | 44 | ||||
-rw-r--r-- | index.php | 22 | ||||
-rw-r--r-- | notes.sql | 4 | ||||
-rw-r--r-- | reservation.php | 27 | ||||
-rw-r--r-- | style.css | 14 |
5 files changed, 81 insertions, 30 deletions
diff --git a/handle-reservation.php b/handle-reservation.php new file mode 100644 index 0000000..3e24dd8 --- /dev/null +++ b/handle-reservation.php @@ -0,0 +1,44 @@ +<?php +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // DB INFO + $user = "yota_requester"; + $password = "oon5iraeghaidoShi5sheefie2uuz3gu"; + $database = "yota_call_db"; + $table = "activities"; + + // SPECIAL CALL + $specialCall = $_POST["scall"]; + + // TIME + $fromTime = $_POST["sdate"] . $_POST["stime"] . ":00"; + $toTime = $_POST["edate"] . $_POST["etime"] . ":00"; + + // FREQUENCIES + $frequencies = $_POST["freqs"][0]; + for ($i = 0; $i < sizeof($_POST["freqs"]) - 1; $i++) { + $frequencies += ", " . $_POST["freqs"][$i]; + } + + // MODES + $modes = $_POST["modes"][0]; + for ($i = 0; $i < sizeof($_POST["modes"]) - 1; $i++) { + $modes += ", " . $_POST["modes"][$i]; + } + + // OPERATOR INFORMATION + $operatorCall = $_POST["ocall"] . "<br>"; + $operatorName = $_POST["oname"] . "<br>"; + $operatorEmail = $_POST["email"] . "<br>"; + $operatorPhone = $_POST["phone"] . "<br>"; + + try { + //$conn = new PDO("mysql:host=localhost;dbname=$database", $user, $password); + //$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + //$stmt = $conn->prepare("INSERT INTO $table (name, surname, age) VALUES (:name, :surname, :age)"); + //$stmt->bindParam(':name', $_POST['fname']); + //$stmt->execute(); + //echo "<p>Data inserted.</p>"; + } catch (PDOException $e) { + echo "<p>Error!: " . $e->getMessage() . "</p>"; + } +} @@ -26,7 +26,7 @@ session_start(); <main> <?php $user = "yota_user"; - $password = "leex3EThieK0ieLaiVaicaifef5eecei"; + $password = "gahdeer6shai9hogai2sai4quuaj1eVu"; $database = "yota_call_db"; $table = "activities"; @@ -37,16 +37,22 @@ session_start(); echo '<div style="overflow-x:auto;">'; echo "<table>\n"; echo "<thead><tr>"; - echo "<th>Ime</th>"; - echo "<th>Prezime</th>"; - echo "<th>Godine</th>"; + echo "<th>Operator</th>"; + echo "<th>From</th>"; + echo "<th>To</th>"; + echo "<th>Special sign</th>"; + echo "<th>Frequencies</th>"; + echo "<th>QSO</th>"; echo "</tr></thead><tbody>\n"; - foreach($db->query("SELECT * FROM $table where approved=true") as $row) { + foreach($db->query("SELECT * FROM $table where approved=false ORDER BY `id` DESC") as $row) { echo "<tr>"; - echo "<td>" . $row['name'] . "</td>"; - echo "<td>" . $row['surname'] . "</td>"; - echo "<td>" . $row['age'] . "</td>"; + echo "<td>" . $row['operatorCall'] . "</td>"; + echo "<td>" . $row['fromTime'] . "</td>"; + echo "<td>" . $row['toTime'] . "</td>"; + echo "<td>" . $row['specialCall'] . "</td>"; + echo "<td>" . $row['frequencies'] . "</td>"; + echo "<td>" . $row['qso'] . "</td>"; echo "</tr>\n"; } @@ -3,15 +3,17 @@ USE yota_db; CREATE TABLE activities( `id` int(11) not null auto_increment primary key, + `approved` boolean not null default false; + `specialCall` varchar(50) not null, `fromTime` datetime not null, `toTime` datetime not null, - `specialCall` varchar(50) not null, `frequencies` varchar(255) not null, `modes` varchar(255) not null, `operatorCall` varchar(50) not null, `operatorName` varchar(50) not null, `operatorEmail` varchar(100) not null, `operatorPhone` varchar(50) not null + `qso` int not null default 0; ) charset=utf8; CREATE TABLE admins( diff --git a/reservation.php b/reservation.php index 7b34f71..ec46440 100644 --- a/reservation.php +++ b/reservation.php @@ -25,24 +25,7 @@ session_start(); </nav> <main> <?php -if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['fname']) && isset($_POST['lname']) && isset($_POST['age'])) { - $user = "yota_user"; - $password = "leex3EThieK0ieLaiVaicaifef5eecei"; - $database = "yota_call_db"; - $table = "activities"; - try { - $conn = new PDO("mysql:host=localhost;dbname=$database", $user, $password); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("INSERT INTO activities (name, surname, age) VALUES (:name, :surname, :age)"); - $stmt->bindParam(':name', $_POST['fname']); - $stmt->bindParam(':surname', $_POST['lname']); - $stmt->bindParam(':age', $_POST['age']); - $stmt->execute(); - echo "<p>Data inserted.</p>"; - } catch (PDOException $e) { - echo "<p>Error!: " . $e->getMessage() . "</p>"; - } -} + require "handle-reservation.php"; ?> <form method="post"> @@ -52,11 +35,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['fname']) && isset($_PO <option value="YT50SCWC">YT50SCWC</option> </select> <!-- START TIME --> +<label for="start-date">Start date:</label> +<input type="date" id="start-date" name="sdate"> <label for="start-time">Start time:</label> -<input type="datetime-local" id="start-time" name="stime"> +<input type="time" id="start-time" name="stime"> <!-- END TIME --> +<label for="end-date">End date:</label> +<input type="date" id="end-date" name="edate"> <label for="end-time">End time:</label> -<input type="datetime-local" id="end-time" name="etime"> +<input type="time" id="end-time" name="etime"> <!-- BANDS --> <fieldset> <legend>I will be active on bands:</legend> @@ -48,7 +48,7 @@ nav a:hover { /* MAIN STYLING */ main { margin: 1rem auto; - max-width: 750px; + /*max-width: 750px;*/ line-height: 1.6rem; font-size: 1rem; @@ -71,6 +71,13 @@ table { width: 100%; } +thead { + background-color: black; + color: white; + /*color: black;*/ + /*background-color: #ccc;*/ +} + td, th { border: 1px solid #ccc; text-align: left; @@ -82,6 +89,11 @@ tr:nth-child(even) { } /* FORM STYLING */ +form { + max-width: 750px; + margin: 0rem auto; +} + input, select { width: 100%; padding: 12px 10px; |