} else { if ($dat1 != $dat11) { exit("6"); } else { if ($dat2 != $dat22) { exit("7"); } else { $email = tp('email'); if (empty($email)) { if (!addlocation($nextid, tp('nom'), tp('responsable'), tp('adresse'), tp('tel'), "", tp('villa'), tp('dated'), tp('datef'), tp('montant'), tp('depot'), tp('pjid'), $cycle_name)) { exit("2"); } else { $db->Query("update villa set statut=2 where id=" . tp('villa')); exit("1"); } } else { if (!addlocation($nextid, tp('nom'), tp('responsable'), tp('adresse'), tp('tel'), $email, tp('villa'), tp('dated'), tp('datef'), tp('montant'), tp('depot'), tp('pjid'), $cycle_name)) { exit("2"); } } } } } } } } else { exit("3"); } } else { view::load('gestionvilla', 'addcontrat'); }
<?php if (tp('verif') == 1) { global $db; $nextid = getnextidtable('contrat_location_villa'); //Check if id corespond nom $datedebut = new DateTime(tp('date_debut')); $datefin = new DateTime(tp('date_fin')); if ($datedebut >= $datefin) { exit("0"); } model::load('recette', 'addlocation'); if (!addlocation($nextid, tp('nom'), tp('adresse'), tp('pjid'), tp('tel'), tp('email'), tp('villa'), tp('date_debut'), tp('date_fin'), tp('type_paiement'), tp('montant_location'), tp('agarantie_location'))) { exit("1"); } else { exit("2"); } } else { view::load('recette', 'addlocation'); }