コード例 #1
0
ファイル: new_user.php プロジェクト: Groupe666/Lincs2i
<?php

require_once "conf/top.php";
include_once 'models/class.Droit.php';
include_once 'models/class.Promo.php';
$user = new User($userid);
$username = $user->toStringUsername();
$promo = new Promo();
$promo_list = $promo->getAll();
$droit = new Droit();
$droit_list = $droit->getAll();
$mail = new Mail();
echo $twig->render("new_user.html.twig", array("user" => array('name' => $username), "promo" => $promo_list, "droit" => $droit_list));
if (isset($_REQUEST['submit'])) {
    if (isset($_REQUEST['nom']) && isset($_REQUEST['prenom']) && isset($_REQUEST['email']) && isset($_REQUEST['droit'])) {
        $db = Database::getInstance();
        $prenom = $_REQUEST['prenom'];
        $nom = $_REQUEST['nom'];
        $email = $_REQUEST['email'];
        $droit = $_REQUEST['droit'];
        if ($_REQUEST['password'] != '') {
            $password = password_hash($_REQUEST['password'], PASSWORD_DEFAULT);
        } else {
            $rand = $user->generer_mot_de_passe();
            $password = password_hash($rand, PASSWORD_DEFAULT);
            $subject = "LinCS2i - vos identifiants";
            $message = "Bonjour " . $prenom . ", Voici votre mot de passe : " . $rand . "";
            $mail->sendmail($email, $subject, $message);
        }
        if ($droit == 1 || $droit == 2) {
            $user->new_user($password, $prenom, $nom, $droit);
コード例 #2
0
ファイル: profile.php プロジェクト: Groupe666/Lincs2i
<?php

require_once "conf/top.php";
include_once 'models/class.Droit.php';
$id = $_SESSION['user_session'];
$user = new User($id);
$droit = new Droit($user->getID_Droit());
$mail = new Mail($id);
$username = $user->toStringUsername();
$usermail = $mail->returnMail($id);
echo $twig->render("profile.html.twig", array("user" => $username, "mail" => $usermail, "profil" => $droit->_toString()));