Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-14-2011, 11:08 PM   PM User | #1
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
php-md5 encyption-mysql

When a user registers on my site, I encrypt their data using md5, now I want to welcome the user with some of their stats,

firstname
lastname

But when I retrieve their data from the db, it appear as a md5 hash string
How can I un-md5 data when I retrieve it from the db
Code:
<?php session_start(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Account Dashboard</title>
</head>
<body>
<?php
include('dbsettings.php');

$con = mysql_connect("$host","$user","$password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("$db_name", $con);

$result = mysql_query("SELECT * FROM $tbl_name");

while($row = mysql_fetch_array($result))
  {
  echo $row['firstname'] . " " . $row['lastname'];
  echo "<br />";
  }

mysql_close($con);
?>
<a href="logout.php"> Log Out </a>
</body>
</html>
amcf1992 is offline   Reply With Quote
Old 09-14-2011, 11:21 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
MD5 is a hashing algorithm, not an encryption algorithm, so you cannot reverse it. Its also an insecure one at that.
The only thing you should be hashing is a password, and I'd recommend using sha256 or sha512 for that at the moment.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
authentication, md5, mysql, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:02 PM.


Advertisement
Log in to turn off these ads.