-
Analyzing your requirements and generating your website…
-
- Loading…
-
-
= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.
-
This page will update automatically as the plan is implemented.
-
Runtime: PHP = htmlspecialchars($phpVersion) ?> — UTC = htmlspecialchars($now) ?>
+
+
+
+
+
+ = htmlspecialchars($message_map[$message]['text']) ?>
-
-
- Page updated: = htmlspecialchars($now) ?> (UTC)
-
-
-
+
+
+
+
Get anything done, today.
+
The best place to find quick help for your daily tasks.
+
Post a Task
+
+
+
Available Tasks
+
+
+
+
+
+
No tasks found matching your criteria. Try broadening your search!
+
+
+
+
= htmlspecialchars($task['title']) ?>
+
+
$= htmlspecialchars((string)$task['payout']) ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..5085fd5
--- /dev/null
+++ b/login.php
@@ -0,0 +1,57 @@
+prepare("SELECT * FROM users WHERE email = ?");
+ $stmt->execute([$email]);
+ $user = $stmt->fetch();
+
+ if ($user && password_verify($password, $user['password'])) {
+ $_SESSION['user_id'] = $user['id'];
+ $_SESSION['user_name'] = $user['full_name'];
+ header("Location: index.php");
+ exit;
+ } else {
+ $error = 'Invalid email or password.';
+ }
+ } catch (PDOException $e) {
+ $error = "Database error: " . $e->getMessage();
+ }
+ }
+}
+?>
+
+
+
+
Login
+
+
Don't have an account? Sign up
+
+
+
+
\ No newline at end of file
diff --git a/logout.php b/logout.php
new file mode 100644
index 0000000..766a593
--- /dev/null
+++ b/logout.php
@@ -0,0 +1,6 @@
+prepare('SELECT * FROM tasks WHERE id = :task_id AND user_id = :user_id');
+ $stmt->execute([':task_id' => $taskId, ':user_id' => $userId]);
+ $task = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$task) {
+ // If the user does not own this task, redirect them
+ header("Location: manage-tasks.php?message=access_denied");
+ exit();
+ }
+} catch (PDOException $e) {
+ die("Database error: Could not verify task ownership.");
+}
+
+// Handle POST request to update application status
+if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['application_id']) && isset($_POST['action'])) {
+ $applicationId = $_POST['application_id'];
+ $action = $_POST['action'];
+
+ try {
+ $pdo->beginTransaction();
+
+ if ($action === 'accept') {
+ // 1. Set this application to 'accepted'
+ $stmt = $pdo->prepare('UPDATE applications SET status = 'accepted' WHERE id = :application_id AND task_id = :task_id');
+ $stmt->execute([':application_id' => $applicationId, ':task_id' => $taskId]);
+
+ // 2. Set the task status to 'assigned'
+ $stmt = $pdo->prepare('UPDATE tasks SET status = 'assigned' WHERE id = :task_id');
+ $stmt->execute([':task_id' => $taskId]);
+
+ // 3. Set all other pending applications for this task to 'rejected'
+ $stmt = $pdo->prepare('UPDATE applications SET status = 'rejected' WHERE task_id = :task_id AND id != :application_id AND status = 'pending'');
+ $stmt->execute([':task_id' => $taskId, ':application_id' => $applicationId]);
+
+ $message = 'Application accepted! The task is now assigned.';
+ $message_type = 'success';
+
+ } elseif ($action === 'reject') {
+ // Just reject this single application
+ $stmt = $pdo->prepare('UPDATE applications SET status = 'rejected' WHERE id = :application_id AND task_id = :task_id');
+ $stmt->execute([':application_id' => $applicationId, ':task_id' => $taskId]);
+ $message = 'Application rejected.';
+ $message_type = 'info';
+ }
+
+ $pdo->commit();
+ header("Location: manage-task.php?id=$taskId&message=" . urlencode($message) . "&type=" . $message_type);
+ exit();
+
+ } catch (PDOException $e) {
+ $pdo->rollBack();
+ // Log error instead of dying in production
+ die("Database error: Could not update application status. " . $e->getMessage());
+ }
+}
+
+
+// Fetch all applications for this task
+try {
+ $stmt = $pdo->prepare(
+ 'SELECT a.id, a.status, u.username, u.email
+ FROM applications a
+ JOIN users u ON a.user_id = u.id
+ WHERE a.task_id = :task_id
+ ORDER BY a.created_at DESC'
+ );
+ $stmt->execute([':task_id' => $taskId]);
+ $applications = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ die("Database error: Could not retrieve applications.");
+}
+
+
+$pageTitle = "Manage Task: " . htmlspecialchars($task['title']);
+include 'shared/header.php';
+?>
+
+
+
+
+
+
+
+
+
+
Applicants
+
+
There are no applicants for this task yet.
+
+
+
+
+
+
+ ()
+
+
+ Status:
+
+
+
+
This applicant was awarded the task.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manage-tasks.php b/manage-tasks.php
new file mode 100644
index 0000000..02dac87
--- /dev/null
+++ b/manage-tasks.php
@@ -0,0 +1,56 @@
+prepare(
+ 'SELECT id, title, description, status, created_at
+ FROM tasks
+ WHERE user_id = :user_id
+ ORDER BY created_at DESC'
+ );
+ $stmt->bindParam(':user_id', $userId, PDO::PARAM_INT);
+ $stmt->execute();
+ $tasks = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ die("Database error: Could not retrieve your tasks.");
+}
+
+$pageTitle = "Manage Your Tasks";
+include 'shared/header.php';
+?>
+
+
+
+
diff --git a/my-applications.php b/my-applications.php
new file mode 100644
index 0000000..0dd3620
--- /dev/null
+++ b/my-applications.php
@@ -0,0 +1,58 @@
+prepare(
+ 'SELECT t.title, t.description, a.status, u.username AS poster_username
+ FROM applications a
+ JOIN tasks t ON a.task_id = t.id
+ JOIN users u ON t.user_id = u.id
+ WHERE a.user_id = :user_id
+ ORDER BY a.created_at DESC'
+ );
+ $stmt->bindParam(':user_id', $userId, PDO::PARAM_INT);
+ $stmt->execute();
+ $applications = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ // In a real application, you would log this error
+ die("Database error: Could not retrieve your applications.");
+}
+
+$pageTitle = "My Applications";
+include 'shared/header.php';
+?>
+
+
+
+
+
+
You have not applied for any tasks yet.
+
+
+
+
+
+
Posted by:
+
+
+ Status:
+
+
+
+
+
+
+
+
diff --git a/post-task.php b/post-task.php
new file mode 100644
index 0000000..9b3416b
--- /dev/null
+++ b/post-task.php
@@ -0,0 +1,62 @@
+prepare("INSERT INTO tasks (user_id, title, description, category, location, payout) VALUES (?, ?, ?, ?, ?, ?)");
+ $stmt->execute([$user_id, $title, $description, $category, $location, $payout]);
+ header('Location: index.php');
+ exit();
+ } catch (PDOException $e) {
+ $error = "Database error: " . $e->getMessage();
+ }
+ }
+}
+?>
+
+
+
+
diff --git a/profile.php b/profile.php
new file mode 100644
index 0000000..dc35e54
--- /dev/null
+++ b/profile.php
@@ -0,0 +1,101 @@
+prepare('SELECT id, full_name, email, created_at FROM users WHERE id = :id');
+ $stmt->execute([':id' => $profileId]);
+ $profileUser = $stmt->fetch(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ die("Database error: Could not retrieve user profile.");
+}
+
+if (!$profileUser) {
+ // Handle user not found
+ header("Location: index.php?message=user_not_found");
+ exit();
+}
+
+// Fetch tasks posted by the user
+try {
+ $stmt = $pdo->prepare('SELECT * FROM tasks WHERE user_id = :user_id ORDER BY created_at DESC');
+ $stmt->execute([':user_id' => $profileId]);
+ $postedTasks = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ die("Database error: Could not retrieve posted tasks.");
+}
+
+// Fetch tasks the user has completed (i.e., their application was accepted)
+try {
+ $stmt = $pdo->prepare(
+ 'SELECT t.* FROM tasks t JOIN applications a ON t.id = a.task_id WHERE a.user_id = :user_id AND a.status = \'accepted\' ORDER BY t.created_at DESC'
+ );
+ $stmt->execute([':user_id' => $profileId]);
+ $completedTasks = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ die("Database error: Could not retrieve completed tasks.");
+}
+
+$pageTitle = htmlspecialchars($profileUser['full_name']) . "'s Profile";
+include 'shared/header.php';
+?>
+
+
+
+
+
+
+
Posted Tasks
+
+
has not posted any tasks yet.
+
+
+
+
+
+
Status:
+
Payout: $
+
+
+
+
+
+
+
+
Completed Tasks
+
+
has not completed any tasks yet.
+
+
+
+
+
+
Status:
+
Payout: $
+
+
+
+
+
+
+
+
diff --git a/shared/footer.php b/shared/footer.php
new file mode 100644
index 0000000..3f65f6c
--- /dev/null
+++ b/shared/footer.php
@@ -0,0 +1,6 @@
+
+
+