mirror of https://github.com/tildeclub/poll.git
first commit
This commit is contained in:
parent
c9d5419ac6
commit
60e6d851f6
|
@ -0,0 +1 @@
|
||||||
|
recaptcha_keys.php
|
|
@ -1,6 +1,9 @@
|
||||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
// Include the secret and site key from a separate file
|
||||||
|
require 'recaptcha_keys.php';
|
||||||
|
|
||||||
|
|
||||||
// Connect to the SQLite database
|
// Connect to the SQLite database
|
||||||
$db = new PDO('sqlite:poll.db');
|
$db = new PDO('sqlite:poll.db');
|
||||||
|
@ -30,9 +33,10 @@ echo "<h1>$question</h1>";
|
||||||
// Check if the form has been submitted
|
// Check if the form has been submitted
|
||||||
if (isset($_POST['submit'])) {
|
if (isset($_POST['submit'])) {
|
||||||
// Form has been submitted
|
// Form has been submitted
|
||||||
|
|
||||||
// Verify the reCaptcha response
|
// Verify the reCaptcha response
|
||||||
$url = 'https://www.google.com/recaptcha/api/siteverify';
|
$url = 'https://www.google.com/recaptcha/api/siteverify';
|
||||||
$data = array('secret' => '6LdClsMjAAAAAEaoHxGRckp38hNpZJRU8oR8MNzf', 'response' => $_POST['g-recaptcha-response']);
|
$data = array('secret' => $recaptcha_secret, 'response' => $_POST['g-recaptcha-response']);
|
||||||
$options = array(
|
$options = array(
|
||||||
'http' => array(
|
'http' => array(
|
||||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||||
|
@ -65,7 +69,7 @@ foreach ($poll_options as $id => $option) {
|
||||||
echo "<input type='radio' name='option' value='$id'> $option<br>";
|
echo "<input type='radio' name='option' value='$id'> $option<br>";
|
||||||
}
|
}
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
echo "<div class='g-recaptcha' data-sitekey='6LdClsMjAAAAAF38bS2qAPTERQQRMnEQVFYeCRou'></div>";
|
echo "<div class='g-recaptcha' data-sitekey='$recaptcha_site_key'></div>";
|
||||||
echo "<input type='hidden' name='expiry_date' value='02/01/2023'>";
|
echo "<input type='hidden' name='expiry_date' value='02/01/2023'>";
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
echo "<input type='submit' name='submit' value='Vote'>";
|
echo "<input type='submit' name='submit' value='Vote'>";
|
||||||
|
|
Loading…
Reference in New Issue