function getConvoi($id) { $queryMYSQL = new QueryMYSQL(); $query = "select * from CONVOI where `ID_JOUEUR`={$id};"; $res = $queryMYSQL->select_n($query); return $res; }
function setNewConvoi() { $queryMYSQL = new QueryMYSQL(); $user = unserialize($_SESSION['user']); $idUser = $user->id; $timestamp = time(); $date = date('Y-m-d H:i:s'); $query = "insert into CONVOI (`ID_JOUEUR`, `TYPE`, `DATE_DEPART`, `DEPART`) VALUES ({$idUser}, " . $_POST['typeConvoi'] . ", '" . $date . "', {$timestamp})"; $queryMYSQL->query($query); //On garde un historique $queryMYSQL->setHistory($query, $user->name); }
function HistorySpec($query) { $util = new Util(); $myDateToday = $util->dateTodaySQL(); $queryMYSQL = new QueryMYSQL(); //cherche le dernier groupe $queryMaxGroup = "select max(GROUPE) `maxGROUPE` from HISTORIQUE"; echo $queryMaxGroup . "<br/>"; $arrayMax = $queryMYSQL->select_n($queryMaxGroup); $groupe = $arrayMax[0]["maxGROUPE"]; $groupe = $groupe + 1; $queryHistory = "insert into HISTORIQUE (GROUPE,VARIABLE,login,date_modif) values ({$groupe},\"{$query}\",'" . $_SESSION['login'] . "','{$myDateToday}')"; //echo $queryHistory."<br/>"; $queryMYSQL->query($queryHistory); }
function testVal($login, $mdp) { if ($login != "" || $login != null) { //echo "login non vide<br/>"; if ($mdp != "" || $mdp != null) { //echo "mdp non vide<br/>"; $test = true; } else { //echo "mdp vide<br/>"; $test = false; $this->msgError['mdp'] = "Il faut rentrer un mot de passe."; } } else { //echo "login vide<br/>"; $test = false; $this->msgError['login'] = "******"; } if ($test == true) { //On va chercher dans la base l'utilisateur $queryMYSQL = new QueryMYSQL(); $query = "select * from UTILISATEUR where LOGIN='******';"; $res = $queryMYSQL->select_n($query); if (count($res) == 1) { //Si on trouve un login //print_r($res); if ($res[0]['PASSWORD'] == sha1($mdp)) { //Si le mot de passe est le même $_SESSION['group'] = $res[0]['GROUP']; $_SESSION['login'] = $res[0]['LOGIN']; $myJoueur = new Joueur(); $_SESSION['user'] = serialize($myJoueur); $date = date('Y-m-d H:i:s'); $query = "update UTILISATEUR set LAST_LOGIN='******' where LOGIN='******';"; $queryMYSQL->query($query); //On garde un historique //$queryMYSQL->setHistory($query, $login); return true; } else { $this->msgError['mdp'] = "Le mot de passe n'est pas bon."; return false; } } else { $this->msgError['login'] = "******"; return false; } } }