diff --git a/db-start/css/styles.css b/db-start/css/styles.css
deleted file mode 100644
index e69de29..0000000
diff --git a/db-start/index.php b/db-start/index.php
deleted file mode 100644
index 91bd9a2..0000000
--- a/db-start/index.php
+++ /dev/null
@@ -1,34 +0,0 @@
-safeLoad();
-$db_pass = $_ENV['DATABASE_PASSWORD'];
-
-// Make some constants
-if ($_SERVER['HTTP_HOST'] == 'localhost') {
- define('HOST', 'localhost');
- define('USER', 'root');
- define('PASS', $db_pass);
- define('DB', 'palindromes');
-} else {
- define('HOST', 'cs2440.joshashton.dev');
- define('USER', 'root');
- define('PASS', $db_pass);
- define('DB', 'palindromes');
-}
-
-// Connect to the DB
-$conn = mysqli_connect(HOST, USER, PASS, DB);
-
-// Write a DB query
-$sql = 'SELECT * FROM palindrome;';
-
-// Run DB query
-$results = mysqli_query($conn, $sql);
-
-// Loop through data
-while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)) {
- echo $row['phrase'] . '
';
-};
-?>
diff --git a/db-start/js/index.js b/db-start/js/index.js
deleted file mode 100644
index e69de29..0000000
diff --git a/db-start/pal.sql b/db-start/pal.sql
deleted file mode 100644
index b66479c..0000000
--- a/db-start/pal.sql
+++ /dev/null
@@ -1,15 +0,0 @@
--------------------------- copy and paste to your local mysql server -------------------------------
-drop database if exists palindromes;
-create database palindromes;
-use palindromes;
-create table palindrome (id int auto_increment primary key, phrase varchar(255));
-insert into palindrome (phrase) values ('race car'), ('bob'), ('senile felines'), ('stack cats');
-select * from palindrome;
-----------------------------------------------------------------------------------------------------
-
-
----------------------------- copy and paste to your remote server ----------------------------------
-create table palindrome (id int auto_increment primary key, phrase varchar(255));
-insert into palindrome (phrase) values ('race car'), ('bob'), ('senile felines'), ('stack cats');
-select * from palindrome;
-----------------------------------------------------------------------------------------------------
diff --git a/db-start/composer.json b/poll/composer.json
similarity index 77%
rename from db-start/composer.json
rename to poll/composer.json
index 8224d85..a0c3658 100644
--- a/db-start/composer.json
+++ b/poll/composer.json
@@ -1,8 +1,8 @@
{
- "name": "violet/db-start",
+ "name": "violet/poll",
"autoload": {
"psr-4": {
- "Violet\\DbStart\\": "src/"
+ "Violet\\Poll\\": "src/"
}
},
"authors": [
diff --git a/db-start/css/.gitkeep b/poll/css/.gitkeep
similarity index 100%
rename from db-start/css/.gitkeep
rename to poll/css/.gitkeep
diff --git a/poll/css/styles.css b/poll/css/styles.css
new file mode 100644
index 0000000..9cd0445
--- /dev/null
+++ b/poll/css/styles.css
@@ -0,0 +1,125 @@
+* {
+ margin: 0;
+ padding: 0;
+}
+
+body {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+
+ background-color: #bbedbe;
+}
+
+h1 {
+ font-size: 6vw;
+}
+
+h3 {
+ font-size: 3vw;
+}
+
+p {
+ font-size: 1vw;
+}
+
+h1,
+h3,
+p,
+input {
+ color: #0e3610;
+}
+
+form {
+ display: grid;
+ grid-template-columns: 50% 50%;
+ width: 60%;
+
+ border-radius: 18px;
+
+ background-color: #26942D;
+ padding: 1vw;
+}
+
+.option {
+ text-align: center;
+ padding: 1vw;
+}
+
+.option label:hover {
+ background-color: green;
+ color: #f1fbf2;
+}
+
+label {
+ background-color: #f1fbf2;
+ color: #0e3610;
+ display: inline-block;
+ width: 100%;
+ font-size: 2vw;
+ cursor: pointer;
+
+ border-radius: 18px;
+}
+
+input[type="radio"] {
+ display: none;
+}
+
+.option label.checked {
+ color: #f1fbf2;
+ background-color: #0e3610;
+}
+
+button {
+ /* Button Shape */
+ grid-column: span 2;
+ padding: 1vw;
+ border: none;
+ border-radius: 18px;
+
+ /* Font */
+ color: white;
+ font-size: 1vw;
+ font-weight: 600;
+
+ /* Transition for hover */
+ transition-duration: 500ms;
+
+ background-color: #1c6b20;
+}
+
+button:hover {
+ background-color: #0e3610;
+ color: #f1fbf2;
+}
+
+.chart {
+ background-color: #f1fbf2;
+ border-radius: 18px;
+ padding: 1vw;
+ width: 80%;
+ display: grid;
+ grid-template-columns: 10% 90%;
+}
+
+.chart-label {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ margin-right: 10px;
+ text-align: right;
+}
+
+.bar {
+ padding: 1vw 0 1vw 0;
+ margin: 10px 0 10px 0;
+ background-color: #0e3610;
+}
+
+.bar-label {
+ margin-left: 10px;
+ color: #f1fbf2;
+ font-weight: 800;
+}
diff --git a/db-start/img/.gitkeep b/poll/img/.gitkeep
similarity index 100%
rename from db-start/img/.gitkeep
rename to poll/img/.gitkeep
diff --git a/db-start/includes/.gitkeep b/poll/includes/.gitkeep
similarity index 100%
rename from db-start/includes/.gitkeep
rename to poll/includes/.gitkeep
diff --git a/poll/index.php b/poll/index.php
new file mode 100644
index 0000000..126ae91
--- /dev/null
+++ b/poll/index.php
@@ -0,0 +1,132 @@
+safeLoad();
+
+// Use environment variables for the database password and IP address.
+$db_pass = $_ENV['DATABASE_PASSWORD'];
+$ip_addr = $_ENV['IP_ADDRESS'];
+
+// Make some constants
+if ($_SERVER['HTTP_HOST'] == 'localhost') {
+ define('HOST', 'localhost');
+ define('USER', 'root');
+ define('PASS', $db_pass);
+ define('DB', 'poll');
+} else {
+ define('HOST', $ip_addr);
+ define('USER', 'root');
+ define('PASS', $db_pass);
+ define('DB', 'poll');
+}
+
+$poll_options = [
+ 'Atom',
+ 'Brackets',
+ 'Eclipse',
+ 'Emacs',
+ 'Gedit',
+ 'IntelliJ',
+ 'Nano',
+ 'NetBeans',
+ 'NeoVim',
+ 'Notepad++',
+ 'Sublime',
+ 'Visual Studio',
+ 'Visual Studio Code',
+ 'XCode',
+];
+
+if (isset($_POST['option'])) {
+ setcookie('form_submitted', 'true', time() + 3600, '/'); // Expires in 1 hour (adjust as needed)
+}
+?>
+
+
+
+
+
' . $row['option'] . '
'; + echo ''; + } + echo ''; +} +?> diff --git a/db-start/js/.gitkeep b/poll/js/.gitkeep similarity index 100% rename from db-start/js/.gitkeep rename to poll/js/.gitkeep diff --git a/poll/js/index.js b/poll/js/index.js new file mode 100644 index 0000000..43f66d1 --- /dev/null +++ b/poll/js/index.js @@ -0,0 +1,17 @@ +const radioButtons = document.querySelectorAll('input[type="radio"]'); + +radioButtons.forEach(radio => { + radio.addEventListener('change', () => { + // Remove 'checked' class from all labels + radioButtons.forEach(otherRadio => { + otherRadio.parentNode.classList.remove('checked'); // parentNode gets the label + console.log('removed checked'); + }); + + // Add 'checked' class to the currently selected label + if (radio.checked) { + radio.parentNode.classList.add('checked'); + console.log('added checked'); + } + }); +});