This assignment is a PHP-based task management system w# Task Scheduler This assignment is a PHP-based task management system where users can add tasks to a common list and subscribe to receive hourly email reminders for pending tasks.
- Add new tasks to the common list
- Duplicate tasks should not be added.
- Mark tasks as complete/incomplete
- Delete tasks
- Store tasks in
tasks.txt
- Users can subscribe with their email
- Email verification process:
- System generates a unique 6-digit verification code
- Sends verification email with activation link
- Link contains email and verification code
- User clicks link to verify subscription
- System moves email from pending to verified subscribers
- Store subscribers in
subscribers.txt - Store pending verifications in
pending_subscriptions.txt
- CRON job runs every hour
- Sends emails to verified subscribers
- Only includes pending tasks in reminders
- Includes unsubscribe link in emails
- Unsubscribe process:
- Every email includes an unsubscribe link
- Link contains encoded email address
- One-click unsubscribe removes email from subscribers
You must implement the following functions in functions.php:
function addTask($task_name) {
// Add a new task to the list
}
function getAllTasks() {
// Get all tasks from tasks.txt
}
function markTaskAsCompleted($task_id, $is_completed) {
// Mark/unmark a task as complete
}
function deleteTask($task_id) {
// Delete a task from the list
}
function generateVerificationCode() {
// Generate a 6-digit verification code
}
function subscribeEmail($email) {
// Add email to pending subscriptions and send verification
}
function verifySubscription($email, $code) {
// Verify email subscription
}
function unsubscribeEmail($email) {
// Remove email from subscribers list
}
function sendTaskReminders() {
// Sends task reminders to all subscribers
// Internally calls sendTaskEmail() for each subscriber
}
function sendTaskEmail( $email, $pending_tasks ) {
// Sends a task reminder email to a subscriber with pending tasks.
}functions.php(Core functions)index.php(Main interface)verify.php(Email verification handler)unsubscribe.php(Unsubscribe handler)cron.php(Reminder sender)setup_cron.sh(CRON job setup)tasks.txt(Task storage)subscribers.txt(Verified subscribers)pending_subscriptions.txt(Pending verifications)
π You must implement a CRON job that runs cron.php every 1 hour.
π Do not just write instructionsβprovide an actual setup_cron.sh script inside src/.
π Your script should automatically configure the CRON job on execution.
setup_cron.sh(Must configure the CRON job)cron.php(Must handle sending GitHub updates via email)
- The
setup_cron.shscript should register a CRON job that executescron.phpevery 1 hour. - The CRON job must be automatically added when the script runs.
- The
cron.phpfile should actually fetch pending tasks and send emails to subscribed users.
β
The email content must be in HTML format (not JSON).
β
Use PHP's mail() function for sending emails.
β
Each email should include an unsubscribe link.
β
Store subscribers email in subscribers.txt (Do not use a database).
β
Store pending verifications in pending_subscriptions.txt (Do not use a database).
β
Each email should include an unsubscribe link.
π« Hardcoding verification codes.
π« Using a database (use subscribers.txt).
π« Modifying anything outside the src/ directory.
π« Changing function names.
π« Not implementing a working CRON job.
π« Not formatting emails as HTML.
π« Using 3rd party libraries, only pure PHP is allowed.
- Add task input must have
name="task-name"andid="task-name" - Add task button must have
id="add-task"
<input type="text" name="task-name" id="task-name" placeholder="Enter new task" required>
<button type="submit" id="add-task">Add Task</button>- Task list must have
class="task-list". - Task item in that list must have
class="task-item - Task item must have have a checkbox
<input type="checkbox" class="task-status" >so user can mark it done. - Once task item is completed add class
completed.<li class="task-item completed"> - Task item should have a delete action with
class="delete-task".
<ul class="tasks-list">
<li class="task-item">
<input type="checkbox" class="task-status">
<button class="delete-task">Delete</button>
</li>
</ul>- The email input field must have
name="email". - The submit button must have
id="submit-email".
<input type="email" name="email" required />
<button id="submit-email">Submit</button>- Subject:
Verify subscription to Task Planner - Body Format:
<p>Click the link below to verify your subscription to Task Planner:</p>
';
<p><a id="verification-link" href="{verification_link}">Verify Subscription</a></p>- Sender: no-reply@example.com
- Subject:
Task Planner - Pending Tasks Reminder - Body Format:
<h2>Pending Tasks Reminder</h2>
<p>Here are the current pending tasks:</p>
<ul>
<li>Task 1</li>
<li>Task 2</li>
</ul>
<p><a id="unsubscribe-link" href="{unsubscribe_link}">Unsubscribe from notifications</a></p>here users can add tasks to a common list and subscribe to receive hourly email reminders for pending tasks.
- Add new tasks to the common list
- Duplicate tasks should not be added.
- Mark tasks as complete/incomplete
- Delete tasks
- Store tasks in
tasks.txt
- Users can subscribe with their email
- Email verification process:
- System generates a unique 6-digit verification code
- Sends verification email with activation link
- Link contains email and verification code
- User clicks link to verify subscription
- System moves email from pending to verified subscribers
- Store subscribers in
subscribers.txt - Store pending verifications in
pending_subscriptions.txt
- CRON job runs every hour
- Sends emails to verified subscribers
- Only includes pending tasks in reminders
- Includes unsubscribe link in emails
- Unsubscribe process:
- Every email includes an unsubscribe link
- Link contains encoded email address
- One-click unsubscribe removes email from subscribers
You must implement the following functions in functions.php:
function addTask($task_name) {
// Add a new task to the list
}
function getAllTasks() {
// Get all tasks from tasks.txt
}
function markTaskAsCompleted($task_id, $is_completed) {
// Mark/unmark a task as complete
}
function deleteTask($task_id) {
// Delete a task from the list
}
function generateVerificationCode() {
// Generate a 6-digit verification code
}
function subscribeEmail($email) {
// Add email to pending subscriptions and send verification
}
function verifySubscription($email, $code) {
// Verify email subscription
}
function unsubscribeEmail($email) {
// Remove email from subscribers list
}
function sendTaskReminders() {
// Sends task reminders to all subscribers
// Internally calls sendTaskEmail() for each subscriber
}
function sendTaskEmail( $email, $pending_tasks ) {
// Sends a task reminder email to a subscriber with pending tasks.
}functions.php(Core functions)index.php(Main interface)verify.php(Email verification handler)unsubscribe.php(Unsubscribe handler)cron.php(Reminder sender)setup_cron.sh(CRON job setup)tasks.txt(Task storage)subscribers.txt(Verified subscribers)pending_subscriptions.txt(Pending verifications)
π You must implement a CRON job that runs cron.php every 1 hour.
π Do not just write instructionsβprovide an actual setup_cron.sh script inside src/.
π Your script should automatically configure the CRON job on execution.
setup_cron.sh(Must configure the CRON job)cron.php(Must handle sending GitHub updates via email)
- The
setup_cron.shscript should register a CRON job that executescron.phpevery 1 hour. - The CRON job must be automatically added when the script runs.
- The
cron.phpfile should actually fetch pending tasks and send emails to subscribed users.
β
The email content must be in HTML format (not JSON).
β
Use PHP's mail() function for sending emails.
β
Each email should include an unsubscribe link.
β
Store subscribers email in subscribers.txt (Do not use a database).
β
Store pending verifications in pending_subscriptions.txt (Do not use a database).
β
Each email should include an unsubscribe link.
π« Hardcoding verification codes.
π« Using a database (use subscribers.txt).
π« Modifying anything outside the src/ directory.
π« Changing function names.
π« Not implementing a working CRON job.
π« Not formatting emails as HTML.
π« Using 3rd party libraries, only pure PHP is allowed.
- Add task input must have
name="task-name"andid="task-name" - Add task button must have
id="add-task"
<input type="text" name="task-name" id="task-name" placeholder="Enter new task" required>
<button type="submit" id="add-task">Add Task</button>- Task list must have
class="task-list". - Task item in that list must have
class="task-item - Task item must have have a checkbox
<input type="checkbox" class="task-status" >so user can mark it done. - Once task item is completed add class
completed.<li class="task-item completed"> - Task item should have a delete action with
class="delete-task".
<ul class="tasks-list">
<li class="task-item">
<input type="checkbox" class="task-status">
<button class="delete-task">Delete</button>
</li>
</ul>- The email input field must have
name="email". - The submit button must have
id="submit-email".
<input type="email" name="email" required />
<button id="submit-email">Submit</button>- Subject:
Verify subscription to Task Planner - Body Format:
<p>Click the link below to verify your subscription to Task Planner:</p>
';
<p><a id="verification-link" href="{verification_link}">Verify Subscription</a></p>- Sender: no-reply@example.com
- Subject:
Task Planner - Pending Tasks Reminder - Body Format:
<h2>Pending Tasks Reminder</h2>
<p>Here are the current pending tasks:</p>
<ul>
<li>Task 1</li>
<li>Task 2</li>
</ul>
<p><a id="unsubscribe-link" href="{unsubscribe_link}">Unsubscribe from notifications</a></p>