Intéger md5 dans son mot de passe

bouchraM Messages postés 7 Date d'inscription lundi 29 novembre 2010 Statut Membre Dernière intervention 12 juin 2011 - 9 juin 2011 à 16:46
inwebo Messages postés 380 Date d'inscription lundi 12 novembre 2007 Statut Membre Dernière intervention 23 octobre 2014 - 10 juin 2011 à 00:42
slt

je voudrais savoir comment intéger la clé md5 dans mon mot de passe lors de l'inscription ..merci

voila le code sans md5 ^^ vous aller comprend a se que j'ai fais ??


<?php require_once('../Connections/conex.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue "", $theNotDefinedValue "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO panier (Cliente_mail) VALUES (%s)",
GetSQLValueString($_POST['gg'], "text"));

mysql_select_db($database_conex, $conex);
$Result1 = mysql_query($insertSQL, $conex) or die(mysql_error());

$insertGoTo = "account/index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['mail'])) {
$loginUsername=$_POST['mail'];
$password=$_POST['mdp'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "login.php";
$MM_redirectLoginFailed = "login_failed.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conex, $conex);

$LoginRS__query=sprintf("SELECT e_mail, Mot_de_passe FROM client WHERE e_mail=%s AND Mot_de_passe=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $conex) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>

<?php if (!isset($_SESSION['MM_Username'])) {?>
<form ACTION="<?php echo $loginFormAction; ?>" id="conect" name="conect" method="POST">
<label>E_mail

</label>

<label>Mot de passe

</label>
<label>

</label>
</form>

3 réponses

inwebo Messages postés 380 Date d'inscription lundi 12 novembre 2007 Statut Membre Dernière intervention 23 octobre 2014
9 juin 2011 à 18:44
Bonjour,

Une simple fonction de base de php nommée md5() à mon avis.


________________________________________
( $toBe || !$toBe ) = $this->Question();
0
bouchraM Messages postés 7 Date d'inscription lundi 29 novembre 2010 Statut Membre Dernière intervention 12 juin 2011
9 juin 2011 à 19:43
je le sais tres bien sa mais comment l'intéger dans se code ?? j'ai pas su help
0
inwebo Messages postés 380 Date d'inscription lundi 12 novembre 2007 Statut Membre Dernière intervention 23 octobre 2014
10 juin 2011 à 00:42
Bonjour,

Tu n'as pas compris quoi ?

intéger la clé md5 dans mon mot de passe lors de l'inscription ..merci


C'est là que la logique intervient et la réflexion. Tu veux hasher ton mot de passe c'est bien cela ? La question est : Quand est il enregistré en BDD ?


________________________________________
( $toBe || !$toBe ) = $this->Question();
0
Rejoignez-nous