Jump to content

MD5 Encrypting


Drumlegend

Recommended Posts

So I am trying to encrypt my web form and I have no idea where I put MD5 and where do I put it in MSQLADM

 

<?php

session_start();

include "common.php";

$message = $_GET['message'];

//COLLECT POST data

$formValue=array();

foreach ($_POST as $key => $value) {

$formValue[$key] = strip_tags($value);

 

//Lets register some POST Backs

//This will allow us to repopulate form fields in the future if needed

$_SESSION['post_vars'][$key] = $value;

}//close for loop

 

 

$myform = $_GET['CreateRecord'];

 

 

if($myform==1){

 

//echo "test";

 

 

 

//Check for empty fields

if($formValue['FirstName']=="" ||

$formValue['Surname']=="" ||

$formValue['UserName']=="" ||

$formValue['Email']=="" ||

$formValue['PassWord']=="" ){

 

 

$message = "missing form data, please check" ;

header("Location: register.php?message=$message");

 

}else{

//Carry on with routine

 

DBConnect();

$Link = mysql_connect($Host, $User, $Password);

//$agentID = $_SESSION['userID'];

$agentID = "1";

$Query = "INSERT INTO $Table_2 VALUES ('0',

'".mysql_escape_string($formValue["FirstName"])."',

'".mysql_escape_string($formValue["Surname"])."',

'".mysql_escape_string($formValue["UserName"])."',

'".mysql_escape_string($formValue["Email"])."',

'".mysql_escape_string($formValue["PassWord"])."')";

 

 

if(mysql_db_query ($DBName, $Query, $Link)){

$message = "Successfully Registered!";

header("Location: login.php?message=$message");

}else{

$message = "Error Inserting!";

header("Location: register.php?message=$message");

}//close db query conditional

}//close form validation conditional

}//close form submit conditional

 

?>

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/258592-md5-encrypting/
Share on other sites

Check out the article in my signature. MD5 was never meant for password hashing, it's just been something convenient for us to use.

 

To answer your question, you want to use the value returned from md5 within your query. This could be as simple as $password = md5($password);. Keep in mind, you'll have to perform the same operation when attempting to log in the user.

Link to comment
https://forums.phpfreaks.com/topic/258592-md5-encrypting/#findComment-1325543
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.