-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-process.php
More file actions
26 lines (22 loc) · 931 Bytes
/
edit-process.php
File metadata and controls
26 lines (22 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
session_start();
$id = isset($_POST['id']) ? $_POST['id'] : '';
$package_name = isset($_POST['package-name']) ? trim($_POST['package-name']) : '';
$category = isset($_POST['category']) ? trim($_POST['category']) : '';
$source = isset($_POST['source']) ? trim($_POST['source']) : '';
$notes = isset($_POST['notes']) ? trim($_POST['notes']) : '';
if ($package_name === '' || $source === '') {
header("Location: /edit.php?id={$id}&error=missing_fields");
exit;
}
foreach ($_SESSION['packages'] as $k => $package) {
if ($package['id'] === $id) {
$_SESSION['packages'][$k]['package-name'] = htmlspecialchars($package_name);
$_SESSION['packages'][$k]['category'] = htmlspecialchars($category);
$_SESSION['packages'][$k]['source'] = htmlspecialchars($source);
$_SESSION['packages'][$k]['notes'] = htmlspecialchars($notes);
break;
}
}
header('Location: /index.php');
exit;