Ejemplo n.º 1
0
function addUser($conn)
{
    // ajout de l'adresse avec retour id
    // ajout utilisaeur avec id adresse
    $idville = is_numeric($_POST['ville']) ? (int) $_POST['ville'] : 0;
    $numrue = is_numeric($_POST['num']) ? (int) $_POST['num'] : 0;
    $nomrue = trim($_POST["adr"]);
    $idadresse = (int) Utilisateur::addAdress($conn, $idville, $numrue, $nomrue);
    //int
    $nom = trim($_POST["nom"]);
    //chaine
    $prenom = trim($_POST["prenom"]);
    //chaine
    $mail = trim($_POST["mail"]);
    //chaine
    $tel = is_numeric($_POST['tel']) ? (int) $_POST['tel'] : 0;
    //int
    $password = trim($_POST["pass"]);
    //chaine
    $estouvert = 1;
    //int
    $idsysuser = 0;
    //int
    $user = Utilisateur::addUser($conn, $idadresse, $nom, $prenom, $mail, $tel, $password, $estouvert, $idsysuser);
    if ($user != null) {
        $est_co = Utilisateur::connexion($conn, $mail, $password);
        if ($est_co) {
            $req = "select IDUTILISATEUR from utilisateur WHERE MAIL = '{$mail}';";
            $result = odbc_exec($conn, $req);
            $id = odbc_result($result, 1);
            $req = "select IDSYSUSER from utilisateur WHERE MAIL = '{$mail}';";
            $result = odbc_exec($conn, $req);
            $sysuser = odbc_result($result, 1);
            // while(odbc_fetch_row($result)){
            //   $id = odbc_result($result, 1);
            $_SESSION['idsysuser'] = $sysuser;
            $_SESSION['utilisateur'] = $id;
        } else {
            echo 'nan';
        }
    }
}
Ejemplo n.º 2
0
include 'connexion.php';
include 'repository.php';
include 'navbar.php';
if (isset($_POST['add'])) {
    $titre = trim($_POST['titre']);
    $type = is_numeric($_POST['type']) ? (int) $_POST['type'] : 0;
    $numApp = is_numeric($_POST['numApp']) ? (int) $_POST['numApp'] : 0;
    $ville = is_numeric($_POST['ville']) ? (int) $_POST['ville'] : 0;
    $numRue = is_numeric($_POST['numRue']) ? (int) $_POST['numRue'] : 0;
    $adr = trim($_POST['adr']);
    $loyer = is_numeric($_POST['loyer']) ? (int) $_POST['loyer'] : 0;
    $surface = is_numeric($_POST['surface']) ? (int) $_POST['surface'] : 0;
    $desc = trim($_POST['desc']);
    $photo = trim($_POST['photo']);
    $annee = date('Y');
    $idadresse = (int) Utilisateur::addAdress($conn, $ville, $numRue, $adr);
    $loy = "INSERT INTO loyer(MONTANT, ANNEE) VALUES ({$loyer}, {$annee})";
    $resLoy = odbc_exec($conn, $loy);
    $idLoy = (int) odbc_exec($conn, "SELECT @" . "@IDENTITY AS Ident");
    $app = "INSERT INTO appartement(IDTYPE, IDLOYER, IDUTILISATEUR, IDADRESSE, NUMAPPARTEMENT, SURFACE, URLPHOTO, ESTDISPONIBLE, ESTVALIDE) \n\t\t\tVALUES ({$type}, {$idLoy}, 1, {$idadresse}, {$numApp}, {$surface}, '{$photo}', 0, 0)";
    $resApp = odbc_exec($conn, $app);
    $idApp = (int) odbc_exec($conn, "SELECT @" . "@IDENTITY AS Ident");
    $descTitre = "INSERT INTO description(IDAPPARTEMENT, NOMDESCRIPTION, VAL) VALUES ({$idApp}, 'titre', '{$titre}')";
    $resDescTitre = odbc_exec($conn, $loy);
    $descTitre = "INSERT INTO description(IDAPPARTEMENT, NOMDESCRIPTION, VAL) VALUES ({$idApp}, 'description', '{$desc}')";
    $resDescTitre = odbc_exec($conn, $loy);
}
echo <<<END
\t\t\t<!DOCTYPE html>
\t\t\t<head>
\t\t\t  <meta charset="utf-8">
Ejemplo n.º 3
0
include '../connexion.php';
include '../repository.php';
if (isset($_POST["id"])) {
    $id = $_POST["id"];
    if ($_POST["etat"] == "Ouvert") {
        $req = update_user_etat(0, $id);
    } else {
        $req = update_user_etat(1, $id);
    }
    $result = odbc_exec($conn, $req);
}
if (isset($_POST['ins_emp'])) {
    $idville = is_numeric($_POST['ville']) ? (int) $_POST['ville'] : 0;
    $numrue = is_numeric($_POST['num']) ? (int) $_POST['num'] : 0;
    $nomrue = trim($_POST["adr"]);
    $idadresse = (int) Utilisateur::addAdress($conn, $idville, $numrue, $nomrue);
    //int
    $nom = trim($_POST["nom"]);
    //chaine
    $prenom = trim($_POST["prenom"]);
    //chaine
    $mail = trim($_POST["mail"]);
    //chaine
    $tel = is_numeric($_POST['tel']) ? (int) $_POST['tel'] : 0;
    //int
    $password = trim($_POST["pass"]);
    //chaine
    $estouvert = 1;
    //int
    $idsysuser = 3;
    //int