Пример #1
0
//et set de l'objet user u fur et à mesure
$validLastName = filter_input(INPUT_POST, 'lastName', FILTER_SANITIZE_STRING);
$student->setNom($validLastName);
$validFisrtName = filter_input(INPUT_POST, 'firstName', FILTER_SANITIZE_STRING);
$student->setPrenom($validFisrtName);
$myregex = "~^[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}\$~";
$validBirthDate = filter_input(INPUT_POST, 'birthDate', FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => $myregex)));
$student->setDateNaissance($validBirthDate);
$validAddress = filter_input(INPUT_POST, 'address', FILTER_SANITIZE_STRING);
$student->setAdresse($validAddress);
$validEmail = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING);
$student->setMail($validEmail);
$student->setType(4);
//place l'user type à 4 (correspond à l'id de student)
//Insertion du student dans la table user
$validInsertion = UserDAL::insertOnDuplicate($student);
if ($validInsertion != null) {
    echo "Insertion Etudiant OK";
} else {
    echo "ECHEC insertion Etudiant, good luck";
}
//Gestion des module selectionner
$unModule = $_POST['module'];
if (empty($unModule)) {
    echo "You didn't select any module.";
}
$N = count($unModule);
$module = new Module();
$moduleId = 0;
for ($i = 0; $i < $N; $i++) {
    $moduleId = (int) $unModule[$i];
Пример #2
0
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once '../../model/class/User.php';
require_once '../../model/DAL/UserDAL.php';
//Création de l'user à insèrer
$user = new User();
//Vérifie ce qui est renvoyer par le POST de /view/phtml/user_create.php
//et set de l'objet user u fur et à mesure
$validLastName = filter_input(INPUT_POST, 'lastName', FILTER_SANITIZE_STRING);
$user->setNom($validLastName);
$validFisrtName = filter_input(INPUT_POST, 'firstName', FILTER_SANITIZE_STRING);
$user->setPrenom($validFisrtName);
$myregex = "~^[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}\$~";
$validBirthDate = filter_input(INPUT_POST, 'birthDate', FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => $myregex)));
$user->setDateNaissance($validBirthDate);
$validAddress = filter_input(INPUT_POST, 'address', FILTER_SANITIZE_STRING);
$user->setAdresse($validAddress);
$validEmail = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING);
$user->setMail($validEmail);
$validUserTypeId = filter_input(INPUT_POST, 'userType', FILTER_SANITIZE_NUMBER_INT);
$user->setType($validUserTypeId);
//Insertion de l'user dans la table
$validInsertion = UserDAL::insertOnDuplicate($user);
if ($validInsertion != null) {
    echo "Insertion OK";
} else {
    echo "ECHEC insertion, good luck";
}
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=../../?page=user_list&modification=success">';
Пример #3
0
<?php

require_once '../model/DAL/UserDAL.php';
UserDAL::insertOnDuplicate(new User());