Joywork/ajax/toChecked.php

40 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
if($_SESSION['id'] && $_GET['id']) {
if (strpos($_GET['id'], "|") !== false) {
$ids = explode("|", $_GET['id']);
if (count($ids) > 0) {
foreach ($ids as $id) {
if ($_GET['st'] == 0) {
$mas = array();
foreach ($_SESSION['checked'] as $ts) {
if ($ts !== $id) {
$mas[] = $ts;
}
}
$_SESSION['checked'] = $mas;
}
if ($_GET['st'] == 1) {
$_SESSION['checked'][] = $id;
}
}
}
} else {
if ($_GET['st'] == 0) {
$mas = array();
foreach ($_SESSION['checked'] as $ts) {
if ($ts != $_GET['id']) {
$mas[] = $ts;
}
}
$_SESSION['checked'] = $mas;
}
if ($_GET['st'] == 1) {
$_SESSION['checked'][] = $_GET['id'];
}
}
}