get_results("SELECT * FROM `{$wpdb->prefix}typeSubjects`"); $requestIsInProgressMessage = ''; if (isset($_POST['theform'])) { switch ($_POST['theform']) { case 'request': global $wpdb; $theData = $wpdb->get_results("SELECT count(id) as nbr FROM {$wpdb->prefix}students where email = '" . $_POST['email'] . "'"); $theData1 = $wpdb->get_results("SELECT count(id) as nbr FROM {$wpdb->prefix}requests where email = '" . $_POST['email'] . "'"); if ($theData[0]->nbr == 0 && $theData1[0]->nbr == 0) { if ($_FILES['customFileImage']['tmp_name'] != '') { $path_img = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), 'content') + 8) . 'plugins/khattab-plugin/images/' . $_FILES["customFileImage"]["name"]; move_uploaded_file($_FILES['customFileImage']['tmp_name'], $path_img); } else { $path_img = ''; } if ($_FILES['customFileImage']['tmp_name'] != '') { $path_cv = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), 'content') + 8) . 'plugins/khattab-plugin/images/' . $_FILES["customFileCV"]["name"]; move_uploaded_file($_FILES['customFileCV']['tmp_name'], $path_cv); } else { $path_cv = ''; } $table = $wpdb->prefix . 'requests'; if ($_POST['customControlAutosizing'] == 'on') { $data = array( 'FR_ID_typeSubject' => $_POST['type'], 'email' => $_POST['email'], 'message' => str_replace("\'", "'", $_POST['message']), 'image' => $path_img, 'cv' => $path_cv, 'identity' => $_POST['identity'] ); $format = array('%d', '%s', '%s', '%s', '%s', '%s'); $wpdb->insert($table, $data, $format); } else { $data = array( 'FR_ID_typeSubject' => $_POST['type'], 'email' => $_POST['email'], 'proposition' => str_replace("\'", "'", $_POST['proposition']), 'message' => str_replace("\'", "'", $_POST['message']), 'image' => $path_img, 'cv' => $path_cv, 'identity' => $_POST['identity'] ); $format = array('%d', '%s', '%s', '%s', '%s', '%s', '%s'); $wpdb->insert($table, $data, $format); } $theCV = $_SERVER['SERVER_NAME'] . substr($path_cv, 26, strlen($path_cv)); $theImage = $_SERVER['SERVER_NAME'] . substr($path_img, 26, strlen($path_img)); $levelChoosed = $wpdb->get_results("SELECT title FROM `{$wpdb->prefix}typeSubjects` where id = " . $_POST['type']); $to = "akhattab@uae.ac.ma"; $subject = "Demande d'encadrement"; $message = "

" . str_replace("\'", "'", $_POST['message']) . "

Proposition de sujet de mémoire: " . str_replace("\'", "'", $_POST['proposition']) . "

Email: " . $_POST['email'] . "

Niveau: " . $levelChoosed[0]->title . "

"; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: <' . $_POST["email"] . '>' . "\r\n"; $headers .= 'Cc: akhattab@uae.ac.ma' . "\r\n"; mail($to, $subject, $message, $headers); $requestIsInProgressMessage = "Votre demande a bien été envoyée. Vous recevrez un email de confirmation de votre demande dès qu'elle sera acceptée par votre professeur."; } else { $emailExist = 'Cet email existe déjà'; } break; case 'confirmed': $confirms = $wpdb->get_results("SELECT count(id) as nbr,id,FR_ID_typeSubject,complete,FR_ID_Subject,email FROM {$wpdb->prefix}students where email = '" . $_POST['email_confirmed'] . "'"); $subjects = $wpdb->get_results("SELECT title,id FROM {$wpdb->prefix}subjects where id not in (SELECT `FR_ID_Subject` FROM `{$wpdb->prefix}students`) and FR_ID_typeSubject = " . $confirms[0]->FR_ID_typeSubject); $subjectsReserved = $wpdb->get_results("SELECT s.id,s.title FROM {$wpdb->prefix}students st inner join {$wpdb->prefix}subjects s on s.id = st.FR_ID_Subject"); if ($confirms[0]->nbr != 0) { if ($confirms[0]->complete == 0) { $displayTab = 'none'; $displayContent = 'none'; $contentNumber = 'first'; $confirmedEmail = true; } if ($confirms[0]->complete == 1) { header("Location: " . $_SERVER['SERVER_NAME'] . "/fichier-dinscription/?studentID=" . $confirms[0]->id); } } else { $displayTab = 'none'; $displayContent = 'none'; $contentNumber = 'first'; $message = "Désolé, votre email n'a pas encore été ajouté à la base de données.\r\n Veuillez au préalable envoyer une demande d'inscription en mémoire sur la rubrique inscription."; } break; default: $first_name; $last_name; $phone; $identity; $cin; $email; $cv; for ($i = 0; $i < intval($_POST['index_form']) + 1; $i++) { $first_name .= '{ "first_name":"' . $_POST['first_name' . $i] . '" },'; $last_name .= '{ "last_name":"' . $_POST['last_name' . $i] . '" },'; $phone .= '{ "phone":"' . $_POST['phone' . $i] . '" },'; $identity .= '{ "identity":"' . $_POST['student_number' . $i] . '" },'; $cin .= '{ "cin":"' . $_POST['cin' . $i] . '" },'; $email .= '{ "email":"' . $_POST['student_email' . $i] . '" },'; $path_cv = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), 'content') + 8) . 'plugins/khattab-plugin/images/' . $_FILES["custom_confirmatedFileCV" . $i]["name"]; move_uploaded_file($_FILES['custom_confirmatedFileCV' . $i]['tmp_name'], $path_cv); $cv .= '{ "cv":"' . $path_cv . '" },'; } global $wpdb; $table_name = $wpdb->prefix . 'students'; $subjectId; if ($_POST['FR_ID_Subject'] != '') { $subjectId = $_POST['FR_ID_Subject']; } else { $subjectId = $_POST['subject']; } $data_array = array( 'identity' => '[' . substr($identity, 0, strlen($identity) - 1) . ']', 'FR_ID_Subject' => $subjectId, 'first_name' => '[' . substr($first_name, 0, strlen($first_name) - 1) . ']', 'last_name' => '[' . substr($last_name, 0, strlen($last_name) - 1) . ']', 'phone' => '[' . substr($phone, 0, strlen($phone) - 1) . ']', 'cin' => '[' . substr($cin, 0, strlen($cin) - 1) . ']', 'email' => '[' . substr($email, 0, strlen($email) - 1) . ']', 'cv' => '[' . substr($cv, 0, strlen($cv) - 1) . ']', 'complete' => 1 ); $data_where = array('id' => $_POST["student_id"]); $wpdb->update($table_name, $data_array, $data_where); $to = "akhattab@uae.ac.ma"; $subject = "Fichier d’inscription"; $message = "

Bonjour,

Une inscription au mémoire vient d'être achevée.

Email: ".$_POST["student_email"]."

Cliquez ici pour générer le fichier d'inscription

Cordialement.

"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From: <'.$_POST["student_email"].'>' . "\r\n"; $headers .= 'Cc: akhattab@uae.ac.ma' . "\r\n"; mail($to, $subject, $message, $headers); header("Location: " . $_SERVER['SERVER_NAME'] . "/fichier-dinscription/?studentID=" . $_POST["student_id"]); break; } } get_header(); ?>

Inscription mémoire

  • Le champ "niveau" est obligatoire
    Le champ "Apogée" est obligatoire
    Le champ "Veuillez inscrire ici votre proposition de sujet de mémoire" est obligatoire
    Le champ "Votre demande d'encadrement" est obligatoire

    Les champs (*) sont obligatoires


  • Le champ "Sujet" est obligatoire
    Info étudiant 1:
    Le champ "Nom" est obligatoire
    Le champ "Prénom" est obligatoire
    Le champ "CV" est obligatoire
    Le champ "Apogée" est obligatoire
    Le champ "Cin" est obligatoire


    Les champs (*) sont obligatoires