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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
<?php
include( "config_server.php" );
$id=$_POST['edit_id'];
$codeconsultant=$_POST['edit_codeconsultant'];
$nom=$_POST['edit_nom'];
$prenom=$_POST['edit_prenom'];
$adresse=$_POST['edit_adresse'];
$localite=$_POST['localite'];
$telephone=$_POST['edit_telephone'];
$gsm=$_POST['edit_gsm'];
$email=$_POST['edit_email'];
$dateentree=$_POST['edit_dateentree'];
$echeance=$_POST['edit_echeance'];
$accesforum=$_POST['edit_accesforum'];
$questions=$_POST['edit_questions'];
// extraction nom
$nom_extract=substr("$nom", 0,3);
// extraction prenom
$prenom_extract=substr("$prenom", 0,3);
// nbre aléatoire
$aleat= rand(100000, 999999);
// concatenation du login
$login=$nom_extract.$prenom_extract.$aleat;
// création du code d'affiliation
$codeaffiliation="lh-";
// mot de passe aléatoire
//Générer une chaine de caractère unique et aléatoire pour le mot de passe
function random($car) {
$string = "";
$chaine = "abcdefghijklmnpqrstuvwxy0123456789";
srand((double)microtime()*1000000);
for($i=0; $i<$car; $i++) {
$string .= $chaine[rand()%strlen($chaine)];
}
return $string;
}
$pass_md5 = random(8); // Génère une chaine de longueur 8
// création du code d'affiliation
$requete = "insert into clients values('$id','$codeaffiliation','$codeconsultant','$nom','$prenom','$adresse','$localite','$telephone','$gsm','$email','$login','$pass_md5',now(),'$echeance','$accesforum','$questions')";
mysql_query($requete);
echo "Vos données ont été envoyées !";
// fermeture de la connexion vers Mysql
mysql_close();
?> |
Partager