<?php
require_once __DIR__.'/../includes/functions.php';
header('Content-Type: application/json');
try{ verify_csrf(); $id=(int)($_POST['id']??0); $uid=(int)($_SESSION['user_id']??0); $aid=(int)($_SESSION['admin_id']??0); if($id && table_exists('mj_notifications')){ if($uid) q('UPDATE mj_notifications SET is_read=1 WHERE id=? AND user_id=?',[$id,$uid]); elseif($aid) q('UPDATE mj_notifications SET is_read=1 WHERE id=? AND admin_id=?',[$id,$aid]); } echo json_encode(['ok'=>true]); }catch(Throwable $e){ echo json_encode(['ok'=>false]); }
