-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplete_task.php
More file actions
22 lines (22 loc) · 921 Bytes
/
complete_task.php
File metadata and controls
22 lines (22 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
$selected_lang = $_GET['lang'] ?? $_SESSION['lang'] ?? 'en';
header("Location: authenticate.php?lang=" . urlencode($selected_lang));
exit;
}
require "config.php";
$available_langs = ['en' => 'English', 'ru' => 'Русский', 'es' => 'Español', 'de' => 'Deutsch', 'pt' => 'Português', 'tr' => 'Türkçe', 'zh-CN' => '中文', 'uz' => 'Oʻzbekcha', 'fa' => 'فارسی', 'ar' => 'العربية'];
$selected_lang = $_GET['lang'] ?? $_SESSION['lang'] ?? 'en';
if (!array_key_exists($selected_lang, $available_langs)) {
$selected_lang = 'en';
}
$_SESSION['lang'] = $selected_lang;
$task_id = $_GET['id'] ?? 0;
if ($task_id) {
$stmt = $pdo->prepare("UPDATE tasks SET status = 'completed' WHERE id = :id");
$stmt->execute(['id' => $task_id]);
}
header("Location: index.php?lang=" . urlencode($selected_lang));
exit;
?>