function sanitize_string($str) { if (isConnectMySql()) { if (get_magic_quotes_gpc()) { $sanitize = mysqli_real_escape_string($_SESSION["link"], stripslashes($str)); } else { $sanitize = mysqli_real_escape_string($_SESSION["link"], $str); } return $sanitize; } }
function setParameters() { if (isConnectMySql()) { $sql = 'update projetGL_user_parameters set autoAlert = ' . $this->_autoAlert . ', receiveMail = ' . $this->_receiveMail . ', receiveAlert = ' . $this->_receiveAlert . ', defaultRole = ' . $this->_defaultRole . ', where userId = ' . sanitize_string($this->_idUser) . ';'; if ($_SESSION["link"]->query($sql) === true) { return true; } else { return false; } } else { return false; } }
public function remove() { if (isConnectMySql()) { $sql = 'update projetGL_contact set etat = 2 where personne = ' . $this->_personne->getId() . ';'; return $_SESSION["link"]->query($sql); } else { return false; } }
public function delete() { if (isConnectMySql()) { $sqlTache = 'update projetGL_tache set etat = 2 where id = ' . sanitize_string($this->_id) . ';'; return $_SESSION["link"]->query($sqlTache); } else { return false; } }
public function create() { if (isConnectMySql()) { $sql = 'INSERT INTO projetGL_projet(nom, description, uniteTemps, avancement, client, responsable, etat) VALUES("' . sanitize_string($this->_nom) . '", "' . sanitize_string($this->_description) . '", 1, 0, ' . sanitize_string($this->_client->getId()) . ', ' . sanitize_string($this->_responsable->getId()) . ', 1);'; if ($_SESSION["link"]->query($sql) == true) { return $_SESSION["link"]->insert_id; } else { return false; } } else { return false; } }
public function create() { if (isConnectMySql()) { $sql = 'INSERT INTO projetGL_client(nom, adresse, etat) VALUES("' . sanitize_string($this->_nom) . '", "' . sanitize_string($this->_adresse) . '", 1);'; if ($_SESSION["link"]->query($sql) === true) { return $_SESSION["link"]->insert_id; } return -1; } else { return -1; } }
public function getListActiveUserByRole($idRole) { if (isConnectMySql()) { $sql = 'select p.id, p.nom, p.prenom from projetGL_role r join projetGL_personne_role pr on r.id = pr.role join projetGL_personne p on p.id = pr.personne join projetGL_user u on u.personne = p.id where r.id = ' . sanitize_string($idRole) . ' and p.id <> 1 and p.id <> ' . sanitize_string($this->getId()) . ' and u.etat = 1;'; $result = $_SESSION["link"]->query($sql); if ($result->num_rows == 0) { return null; } else { $i = 0; while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $retVal[$i]["id"] = $row["id"]; $retVal[$i]["nom"] = $row["nom"]; $retVal[$i]["prenom"] = $row["prenom"]; $i++; } return $retVal; } } else { return null; } }