1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
function webform_insert($node) {
global $user;
// Correctly set the submission limits.
if ($_POST['enforce_limit'] === 'no') {
$node->submit_limit = '-1';
$node->submit_interval = '157784630'; // 5 years, close enough to 'ever'.
}
// Insert the Webform.
db_query("INSERT INTO {webform} (nid, confirmation, redirect_post, submit_limit, submit_interval, email, email_from_name, email_from_address, email_subject, additional_validate, additional_submit) VALUES (%d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s')", $node->nid, $node->confirmation, $node->redirect_post, $node->submit_limit, $node->submit_interval, $node->email, $node->email_from_name, $node->email_from_address, $node->email_subject, $node->additional_validate, $node->additional_submit);
//Mon code
$verif = db_query("SELECT COUNT (mail AS user_mail) FROM {users} WHERE user_mail = ".$node->email_from_name);
if($verif==0){
echo 'nouvo';
$nouvo = db_query("INSERT INTO {users} (name, pass, mail, init) VALUES ('$prenom', '$mail', '$mail', '$mail')");
$destinataire= $mail;
$sujet = "Votre compte à été créé";
$headers = "From: Infosite <info@infosite.fr>\r\n";
$headers .="MIME-version: 1.0\r\n";
$headers .='Content-Type: text/html; charset="UTF-8"'."\n";
$message= "Bienvenue sur le site Infosite.fr. Votre compte est désormais actif. Pour vous connecter utilisez votre prénom comme login et votre e-mail comme mot de passe. Vous pourrez ensuite modifier ces donnée dans votre profil.";
mail($destinataire, $sujet, $message, $headers);
}
//////--------------------
// Insert the components into the database.
if (is_array($node->webformcomponents) && !empty($node->webformcomponents)) {
foreach ($node->webformcomponents as $cid => $component) {
db_query("INSERT INTO {webform_component} (nid, cid, pid, form_key, name, type, value, extra, mandatory, weight) VALUES (%d, %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d)",
$node->nid, $cid, $component['parent'], $component['form_key'], $component['name'], $component['type'], $component['value'], serialize($component['extra']), ($component['mandatory'] ? 1 : 0), $component['weight']
);
}
}
} |
Partager