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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.