Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
SSL-ACTX committed May 27, 2024
1 parent 7ed5e24 commit fec3f77
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 10 deletions.
43 changes: 42 additions & 1 deletion backend/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,48 @@ function write_verification_data($file, $data) {

$mail->isHTML(true);
$mail->Subject = 'OTP Verification';
$mail->Body = 'Your OTP is: ' . $otp;
$mail->Body = '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OTP Verification</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
.email-container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.otp {
font-size: 24px;
font-weight: bold;
color: #007bff;
}
</style>
</head>
<body style="background-color: #f8f9fa; font-family: Arial, sans-serif;">
<div class="email-container mt-5 p-4">
<h2 class="text-center text-primary">OTP Verification</h2>
<p class="text-muted">Use the following OTP to complete your verification process. This OTP is valid for a limited time only.</p>
<div class="text-center my-4">
<span class="otp">' . $otp . '</span>
</div>
<p class="text-muted">If you did not request this OTP, please ignore this email or contact support if you have any concerns.</p>
<div class="text-center mt-4">
<a href="https://yourwebsite.com" class="btn btn-primary">Visit Our Website</a>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>';


$mail->send();
header("Location: otp_verification.php");
Expand Down
2 changes: 1 addition & 1 deletion backend/verification_data.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Sei777":1716847982}
{"Sei777":1716847982,"Kali Jen":1716848223,"rudigerchelsea5":1716848685,"Seiji":1716848873}
55 changes: 47 additions & 8 deletions backend/vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,61 @@

$mail->isHTML(true);
$mail->Subject = 'Your Voting Receipt';
$email_body = '<h1>Your Vote Receipt</h1>';
$email_body .= '<p>Thank you for voting. Here are your choices:</p><ul>';

$email_body = '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Voting Receipt</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
.email-container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.vote-list {
list-style-type: none;
padding: 0;
}
.vote-list li {
margin-bottom: 10px;
}
</style>
</head>
<body style="background-color: #f8f9fa; font-family: Arial, sans-serif;">
<div class="email-container mt-5 p-4">
<h1 class="text-center text-primary">Your Vote Receipt</h1>
<p class="text-muted">Thank you for voting. Here are your choices:</p>
<ul class="vote-list">';

foreach ($votes as $vote) {
$position = $vote['position'];
$candidate_id = $vote['candidate_id'];

$candidate_sql = "SELECT name FROM candidates WHERE id='$candidate_id'";
$candidate_result = $conn->query($candidate_sql);
$candidate_name = $candidate_result->fetch_assoc()['name'];

$email_body .= "<li><b>$position:</b> $candidate_name</li>";
$email_body .= "<li><strong>$position:</strong> $candidate_name</li>";
}

$email_body .= '</ul><p>Date and Time of Voting: ' . date("Y-m-d H:i:s") . '</p>';
$mail->Body = $email_body;

$email_body .= '
</ul>
<p class="text-muted">Date and Time of Voting: ' . date("Y-m-d H:i:s") . '</p>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>';

$mail->Body = $email_body;

$mail->send();
$notification = 'Votes submitted successfully! A receipt has been sent to your email.';
Expand Down

0 comments on commit fec3f77

Please sign in to comment.