function newSession($db, $ip, $login, $client) { $rc = delSession($db, false, $ip); $newID = uniqid(rand()); $id = md5($newID); $sql = "INSERT INTO auth.session (id,mtime,ip_address) VALUES ('{$id}',now(),'{$ip}')"; $rc = $db->query($sql); $sql = "INSERT INTO auth.session_content (session_id,sess_key,sess_value) VALUES ("; $sqll = "'{$id}','login','{$login}')"; $sqlc = "'{$id}','client_id','{$client}')"; $rc = $db->query($sql . $sqll); $rc = $db->query($sql . $sqlc); return $id; }
// do not show the interface } $buttons = ""; if (isset($_REQUEST['new'])) { $new = true; } else { $new = false; } if (isset($_REQUEST['edit']) || $new) { $edit = true; } else { $edit = false; } $del = isset($_REQUEST['del']); if (isset($_REQUEST['Session'])) { if (!$del || !delSession($_REQUEST['Session'])) { $Session = readSession($_REQUEST['Session']); } else { $Session = false; } // delete was a succes! } else { if ($new) { $Session = new Session(); } else { $Session = false; } } if ($Session) { writeHead("<TITLE>Session - VIRO - ADL Prototype</TITLE>" . ($edit ? '<SCRIPT type="text/javascript" src="edit.js"></SCRIPT>' : '<SCRIPT type="text/javascript" src="navigate.js"></SCRIPT>') . "\n"); if ($edit) {
} } } $i = 0; header("Location: ./index.php?a=37&mesno=14"); } } break; } } } } } // Si le bouton supprimé est posté if ($m == 4) { if (FALSE == delSession($idsession)) { header("Location: ./index.php?a=37&mesno=0"); } else { //supprimer les relations user concernées $result = getSessionUser($idsession, 0); $nb = mysqli_num_rows($result); if ($nb > 0) { for ($i = 0; $i <= $nb; $i++) { $row = mysqli_fetch_array($result); delUserSession($idsession, $row["id_user"]); } } //supprimer les relations user concernées en liste d'attente aussi ! $result2 = getSessionUser($idsession, 2); $nb2 = mysqli_num_rows($result2); if ($nb2 > 0) {