This script allows you to create a poll with multiple-choice options and an expiration date. The poll results are stored in a SQLite database and can be viewed using the results.php script. Prerequisites:
1.PHP 7.0 or higher
2.SQLite 3
3.A Google reCaptcha account (https://www.google.com/recaptcha/)
Basic steps include:
-
Clone the repo.
-
Create new SQLite database and name it poll.db.
-
Create a new table in the database named 'poll_votes" with the following structure:
CREATE TABLE poll_votes (option_id INTEGER); ALTER TABLE poll_votes ADD COLUMN ip_address TEXT;
-
Create a text file named poll_options.txt and add the expiry date of the poll and the poll options to the file. The expiry date should be the first line of the file, followed by the poll options. Each poll option should be on a new line.
For example:
02/01/2023
Option 1
Option 2
Option 3
-
Create a text file named question.txt and add the poll question to the file.
-
Create a new PHP file named recaptcha_keys.php and add the following code to the file, replacing YOUR_SECRET_KEY and YOUR_SITE_KEY with your own reCaptcha secret and site key:
<?php $recaptcha_secret = 'YOUR_SECRET_KEY'; $recaptcha_site_key = 'YOUR_SITE_KEY'; ?>
-
Upload all files to your hosting provider. Ensure poll.db is writable by the web server.
The reset.sh script is how you can clear the database rows when you start a new poll.