Another way to go about doing this is when you display the record(s). For example on my website I have a CMS for my web page(s) and I do this ->
if (isset($_SESSION['user']) && ($_SESSION['user']->security_level === 'sysop' || $_SESSION['user']->id === $this->row->user_id)) {
echo '<div class="system">' . "\n";
echo '<a class="edit" href="edit/' . urlencode($this->row->id) . '">Edit</a>' . "\n";
echo '<a class="delete" href="delete_page.php?id=' . urlencode($this->row->id) . '">Delete</a>' . "\n";
echo "</div>\n";
}
then on top of my edit page (edit.php) I have the following
<?php
require_once '../private/initialize.php';
use Library\CMS\CMS;
protected_page();
$cms = new CMS();
if (isset($_GET['id']) && filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
$id = filter_var($_GET['id']);
$result = $cms->readId($id);
} elseif (isset($_GET['id'])) {
header("Location: members_page.php");
exit();
}
like I said this is just one way of doing it.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.