public function get() { $newUser = new users(); $saveUser = new users(); $deleteUser = new users(); $userTables = new users(); if (isset($_GET["firstname"]) && $_GET["firstname"] != '' && isset($_GET["lastname"]) && $_GET["lastname"] != '' && isset($_GET["email"]) && $_GET["email"] != '') { $newUser->addUser($_GET["firstname"], $_GET["lastname"], $_GET["email"]); } if ($_GET["save"] === "true") { $saveUser->updateUser($_GET["email"], $_GET["firstname"], $_GET["lastname"]); } elseif ($_GET["delete"] === "true") { $deleteUser->deleteUser($_GET["email"]); } echo ' <head> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { padding: 15px; } </style> </head> <body> <table style="width:100%"> <tr> <td>Firstname</td> <td>Lastname</td> <td>Email</td> </tr>'; $userTables->userTable(); echo ' </table> </body> '; }
/** * Функция обновления данных пользователя * * @param (array) $arrData - массив данных для обновления (key: name field => val: value field) * @param (string) $strWhere - строка, условие для запроса * * @return bool */ public function updateUser($arrData, $strWhere = false) { return parent::updateUser($arrData, $strWhere); }
include "src/common/header.php"; ?> </div> <div id="main"> <div class="col"> <h2>Mon Compte</h2> <?php $users = new users(); if (isset($_POST['submit'])) { $prenom = ucfirst(strtolower($_POST['prenom'])); $nom = strtoupper($_POST['nom']); $mail = strtolower($_POST['mail']); $login = strtolower($_POST['login']); $password = $_POST['password']; $users->updateUser($idSession, $nom, $prenom, $mail, $login, $password); echo "Compte modifié<br>"; } $user = $users->getUser($idSession); ?> <form method="post"> <table> <tr><td colspan="2">Nouveau utilisateur</td></tr> <tr> <td>Mail : </td> <td><input type="text" name="mail" value="<?php echo $user->getMail(); ?> "/></td> </tr> <tr>
$pic_name = $rowUser['pic_path']; if (trim($name) != "" and trim($ext) != "" and trim($roomNo) != "0") { if (isset($oldpassword)) { if ($validate->checkNotNull($oldpassword) and $validate->checkNotNull($newpassword)) { if ($validate->checkEqual(md5($oldpassword), $serverpass)) { $password = md5($newpassword); } } } if (isset($_FILES["myfile"])) { if ($validate->checkImage()) { unlink("uploads/users/" . $rowUser['pic_path']); $pic_name = time() . "_" . $_FILES["myfile"]["name"]; move_uploaded_file($_FILES["myfile"]["tmp_name"], "uploads/users/" . $pic_name); } $putValue = $users->updateUser($name, $ext, $roomNo, $pic_name, $password, $u_id); if ($putValue) { header("location:editUser.php?edit=" . $u_id . "&Done"); } else { echo "Some Thing Wrong happen please Try Again Later"; } } } else { ?> <p class="alert alert-danger w text-center"> <?php echo "Please Complete Your Data First"; ?> </p> <?php }