Skip to content

Commit

Permalink
email form test post ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrturner committed Feb 27, 2024
1 parent 1a55a4c commit ccf000e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 35 deletions.
7 changes: 4 additions & 3 deletions site/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ function generateRelationsJson()
* all config options: https://getkirby.com/docs/reference/system/options
*/
return [
'debug' => true,
// 'debug' => false,
// 'debug' => true,
'debug' => false,
'panel' => [
'install' => true
],
Expand All @@ -87,10 +87,11 @@ function generateRelationsJson()
'email' => [
'transport' => [
'type' => 'smtp',
//'host' => 'smtp.company.com',
// 'host' => 'smtp.company.com',
'host' => 'cp-wc01.per01.ds.network',
'port' => 465,
'security' => true,
'auth' => true,
'username' => 'admin@ae.tonelist.com.au',
'password' => "Dn;in'}47CAd,pk"
]
Expand Down
36 changes: 4 additions & 32 deletions site/controllers/accessibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,15 @@

// valid data, send email
} else {
$host = 'localhost';
$username = 'atcomau1_ae24';
$password = 'kk6aGGh7GrRdmCU';
$database = 'atcomau1_audible_edge_2024';
$table = "accessibility_requests";

$conn = mysqli_connect($host, $username, $password, $database);

// Check connection
if ($conn === false) {
die("Error: could not connect. " . mysqli_connect_error());
}


// Prepare and bind
$stmt = $conn->prepare("INSERT INTO $table (name, pronouns, email, phone, text) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("sssss", $data['name'], $data['pronouns'], $data['email'], $data['phone'], $data['text']);


// $sql = "INSERT INTO $table (name, phone, date_added) VALUES ('$name', '$number', '$dateAdded');";

// if (mysqli_query($conn, $sql)) {
// echo '<div class="form-container"><p class="form-text">Records successfully added!</p><p class="form-text">Welcome to the Audible Edge text line.</p></div>';
// } else {
// echo '<div class="form-container"><p class="form-text">ERROR: Unable to execute $sql.</p></div>' . mysqli_error($conn);
// }

// $stmt->close();
// $conn->close();
mysqli_close($conn);

try {
$kirby->email([
'template' => 'email',
'from' => 'info@tonelist.com.au',
// 'from' => 'info@tonelist.com.au',
'from' => 'admin@ae.tonelist.com.au',
'replyTo' => $data['email'],
'to' => 'info@tonelist.com.au',
// 'to' => 'info@tonelist.com.au',
'to' => 'alexrturner@gmail.com',
'subject' => esc($data['name']) . ' (' . esc($data['pronouns']) . ') sent you an accessibility request via the AE website.',
'data' => [
'text' => esc($data['text']),
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions site/templates/z_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,39 @@
</form>
<?php endif ?>
</section>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = ($_POST["name"]);
$pronouns = ($_POST["pronouns"]);
$phone = ($_POST["phone"]);
$email = ($_POST["email"]);
$submitted_at = date('Y-m-d H:i:s');

// Database connection parameters
$host = 'localhost';
$username = 'atcomau1_ae24';
$password = 'kk6aGGh7GrRdmCU';
$database = 'atcomau1_audible_edge_2024';
$usertable = "users";

$conn = mysqli_connect($host, $username, $password, $database);

// Check connection
if ($conn === false) {
die("Error: could not connect. " . mysqli_connect_error());
}

$sql = "INSERT INTO $usertable (name, pronouns, email, phone, text, submitted_at) VALUES ('$name', '$pronouns', '$email', '$phone', '$text', '$submitted_at');";

if (mysqli_query($conn, $sql)) {
echo '<div class="form-container"><p class="form-text">Records successfully added!</p><p class="form-text">Welcome to the Audible Edge text line.</p></div>';
} else {
echo '<div class="form-container"><p class="form-text">ERROR: Unable to execute $sql.</p></div>' . mysqli_error($conn);
}

mysqli_close($conn);
}
?>
</main>


Expand Down

0 comments on commit ccf000e

Please sign in to comment.