prepare("select * from `glpi_read_policy` where user_id = ? and document = 'newsletter'"); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { return true; } return false; } $currentuserid = $_SESSION["glpiID"]; $exist = checkIfExist($currentuserid); if($exist && $_GET["readyes"] == 1) { Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php"); } function update_policy_read($id) { global $DB; $stmt = $DB->prepare("INSERT INTO `glpi_read_policy` (`user_id`, `read`,`document`) VALUES (?,1,'newsletter')"); $stmt->bind_param("i", $id); $stmt->execute(); $lastId = $DB->insert_id(); return $lastId; } if (isset($_GET["readyes"])) { if ($_GET["readyes"] == 1) { $lastId = update_policy_read($currentuserid); if (isset($lastId)) { Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php"); } } } // One shot $path = "N2"; $switch = "N1"; if(isset($_GET["edition"])){ if($_GET["edition"] == "N1" or $_GET["edition"] == "N2"){ $path = $_GET["edition"]; if($_GET["edition"] == "N1" ){ $switch = "N2"; }else{ $switch = "N1"; } }else{ die(); } }else{ die(); } $pdfPath = '../file_upload/newsletter/Newsletter ONE WAY SOPHAL N2.pdf'; $outputDir = '../file_upload/newsletter'; echo "
".$switch."
"; echo '
'; $files = scandir('../file_upload/newsletter/'.$path); $count = sizeof($files); echo'
'; $is_front = TRUE; $i=2; while ($i < $count) { echo'
Img '.($i).'
'; if($count%2 != 0 && $i+2 > $count){ echo'
Img 2
'; }else{ echo'
Img '.($i+1).'
'; } if($count%2 == 0 && $i+2 >= $count){ echo'
Img 2
'; } $i+=2; } echo''; ?>