Hello,
I have some problems with the md5 functions.
I have the following code to check if a activation code is correct
//Check if activation or registration
if(isset($_GET['username'])) {
echo "username set <br>";
if(isset($_GET['email'])) {
echo "email set <br>";
if(isset($_GET['actcode'])) {
echo "actcode set <br>";
$actuser = $_GET['username'];
$actcode = $_GET['actcode'];
$actmail = $_GET['email'];
include("" . $absolute_path . "/usersystem/Config/dbconnect.inc.php");
$query = "SELECT * FROM " . $tblpref . "members WHERE username='" . $actuser . "';";
$getdata = mysql_query($query);
while($row = mysql_fetch_array($getdata)) {
$dbpass = $row['password'];
$dbemail = $row['email'];
$activated = $row['activated'];
}
if($activated == 0) {
$dbactcode = $dbpass;
echo $dbactcode;
echo "<br>";
echo $actcode;
if($dbactcode == $actcode) {
$query = "INSERT INTO " . $tblpref . "members (activated) VALUES (1)";
$putdata = mysql_query($query);
echo "<center><font color=\"green\"><strong>Your account has been activated!</strong></font><br><br> You may <a href=\"" . $site_url . "/index.php?site=members&area=login\">login</a> now.";
$query = "SELECT * FROM " . $tblpref . "emailtemplates WHERE name='welcomeemail';";
$getdata = mysql_query($query);
while($row = mysql_fetch_array($getdata)) {
$subject = $row['subject'];
$signature = $row['signature'];
$message = $row['message'];
$message .= "\n\n\n" . $signature . "";
$from = $row['from'];
}
mail($actmail, $subject, $message, "FROM: " . $from . "");
exit();
} else {
echo "<font color=\"red\"><strong><center>Error: The activation code is invalid!</center></strong></font>";
exit();
}
} else {
echo "<font color=\"red\"><strong><center>Error: The account has already been activated!</center></strong></font>";
exit();
}
} else {
echo "<font color=\"red\"><strong><center>Error: The activation code is invalid!</center></strong></font>";
exit();
}
} else {
echo "<font color=\"red\"><strong><center>Error: The activation code is invalid!</center></strong></font>";
exit();
}
}
But the manually md5 encrypted password and the one from the database always differ in the last 2 digits.
For example exactly the same password looks in the Database like this:
7815696ecbf1c96e6894b779456d33
And created with the md5() function
7815696ecbf1c96e6894b779456d330e
Does somebody know why this is happening?