I've created a page called My Profile that displays all a user's information from the database when they log in. Problem is, I used md5 encryption on the password & now when I display it in a user's profile they see the encrypted password too. I want them to see their original password but nothing seems to be working. Here's my code for displaying the user's info:
<?php
$con = mysqli_connect("localhost","root","","tttwitch");
// Check connection
if (mysqli_connect_error())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "SELECT * FROM users WHERE username='".$_SESSION['CurrentUser']."' ";
$mydata = mysqli_query($con, $sql);
echo "<table border=1>
<tr>
<th>Username</th>
<th>Password</th>
<th>Email</th>
<th>First Name</th>
<th>Last Name</th>
<th>Telephone</th>
<th>Address</th>
<th>Sex</th>
<th>Date of Birth</th>
</tr>";
while($record = mysqli_fetch_array($mydata)) {
echo "<tr>";
echo "<td>" . $record['username'] . "</td>";
echo "<td>" . $record['psw'] . "</td>";
echo "<td>" . $record['email'] . "</td>";
echo "<td>" . $record['fname'] . "</td>";
echo "<td>" . $record['lname'] . "</td>";
echo "<td>" . $record['telephone'] . "</td>";
echo "<td>" . $record['address'] . "</td>";
echo "<td>" . $record['sex'] . "</td>";
echo "<td>" . $record['dateofbirth'] . "</td>";
}
echo "</table>";
mysqli_close($con);
?>