Drumlegend Posted March 9, 2012 Share Posted March 9, 2012 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 Quote Link to comment Share on other sites More sharing options...
xyph Posted March 9, 2012 Share Posted March 9, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.