*/ // Initialisation de la session si elle n'existe pas encore if (!isset($_SESSION)) { session_start(); } include_once '../model/queries.php'; include_once 'password_functions.php'; // Si on a reçu les données d'un formulaire et qu'elles ne sont pas vident if (isset($_POST['UserName']) && isset($_POST['Password']) && !empty($_POST['UserName']) && !empty($_POST['Password'])) { // On les récupère $username = $_POST['UserName']; $password = $_POST['Password']; // À REMPLACER UNE FOIS QUE LA FONCTION SERA AUSSI UTILISÉE DANS LA CRÉATION DU COMPTE : getCryptedPassword($_POST['Password']); $_SESSION['username'] = $username; // On teste si les informations sont valides if (verification($username, $password)) { unset($_SESSION['username']); $_SESSION['username_usager'] = $username; $_SESSION['connected'] = true; header('Location: ../view/view_index.php'); } else { // Sinon on avertit l'utilisateur $_SESSION['connection_info'] = "Nom d'utilisateur ou mot de passe invalide."; header('Location: ../view/view_login.php'); } } else { $_SESSION['connection_info'] = "Un ou plusieurs champs sont vident."; header('Location: ../view/view_login.php'); } function verification($username, $password) {
//delete one server or all if ($_POST["supp"]) { if ($_POST["supp"] != "ALL") { $verif[0]['sql'] = "select fileid from download_enable,devices\n\t\t\t\twhere download_enable.id=devices.ivalue\n\t\t\t\tand download_enable.SERVER_ID=" . $_POST["supp"]; $verif[0]['condition'] = 'EXIST'; $verif[0]['MSG_ERROR'] = $l->g(689) . " " . $l->g(687); $ok = verification($verif); if (isset($ok)) { mysqli_query($_SESSION['OCS']["writeServer"], "delete from download_enable where SERVER_ID=" . $_POST["supp"]); mysqli_query($_SESSION['OCS']["writeServer"], "delete from download_servers where hardware_id=" . $_POST["supp"]); } } elseif ($_POST["supp"] == "ALL") { $verif[0]['sql'] = "select fileid from download_enable,devices\n\t\t\t\twhere download_enable.id=devices.ivalue\n\t\t\t\tand GROUP_ID=" . $systemid; $verif[0]['condition'] = 'EXIST'; $verif[0]['MSG_ERROR'] = $l->g(688) . " " . $l->g(690); $ok = verification($verif); if (isset($ok)) { mysqli_query($_SESSION['OCS']["writeServer"], "delete from download_enable where GROUP_ID=" . $systemid); $sql = "delete from download_servers where GROUP_ID = " . $systemid; mysqli_query($_SESSION['OCS']["writeServer"], $sql); } } } //Modif server's machine if (isset($_POST['Valid_modif']) and isset($_POST['modif']) and $_POST['modif'] != "") { $default_values = look_config_default_values(array('DOWNLOAD_SERVER_URI', 'DOWNLOAD_SERVER_DOCROOT')); if (trim($_POST['URL']) == "") { $_POST['URL'] = $default_values['tvalue']['DOWNLOAD_SERVER_URI']; } if (trim($_POST['REP_STORE']) == "") { $_POST['REP_STORE'] = $default_values['tvalue']['DOWNLOAD_SERVER_DOCROOT'];
{ global $host, $login, $password, $base; $db = mysql_connect($host, $login, $password); mysql_select_db($base, $db); } function verification() { global $logine, $motdepasse; $sql = "SELECT autorisation FROM acces WHERE login = {$logine} AND motdp = {$motdepasse}"; $req = mysql_query($sql); $data = mysql_fetch_row($req); if (!$data) { header('Location: noaccess.html'); exit; } if ($data[0] == 0) { echo "acces refusé\n"; header('Location: noaccess.html'); exit; } else { echo "acces autorisé\n"; header('Location: mamaison.php'); exit; } print_r($data); mysql_free_result($req); mysql_close(); } connexion(); verification();
echo "<div class='err'><p>Возникли следующие ошибки:</p>"; foreach ($err as $key => $value) { echo "<p>{$value}</p>"; } echo "</div>"; } else { echo "<script>\$('#flat-form').hide('200'); \$('#menu_list').append('<li><a href=\"/users/{$login}\"><i class=\"fa fa-user\"></i>Профиль</a></li>');</script>"; } } elseif ($_REQUEST['action'] == "user_restore") { if (isset($_POST['email'])) { $email = $_POST['email']; if ($email == '') { unset($email); } } $email = verification($email); if (empty($email)) { $err[] = "Нам нехватает данных"; } else { } if (count($err) > 0) { echo "<div class='err'><p>Возникли следующие ошибки:</p>"; foreach ($err as $key => $value) { echo "<p>{$value}</p>"; } echo "</div>"; } } } else { header('Location: /main', true, 303); }