viktor
01-13-2012, 04:33 PM
I'm pulling a password from a database, which was encrypted with MD5. So, my $pass is the variable with MD5 password string.
I'm trying to do a simple, popup alert to check the password to show a hidden DIV. But, I'm not too familiar with MD5 and I know that javascript does not have that function, so I tried converting it to PHP. It doesn't work, so I wanted to get some help on getting it fixed (if possible) or approaching it from a different perspective. The problem is I still have to deal with MD5.
<?php
echo "<script type=\"text/javascript\">";
echo "function rdfShow(obj){";
echo "var ".$popup." = prompt(\"What's the password?\", \"\");";
$hash = md5($_GET["popup"]);
echo "if(\"".$hash."\" === \"".$pass."\")";
echo "document.getElementById(obj).style.display = 'block';";
echo "else";
echo "alert('Wrong password!');";
echo "}";
echo "</script>";
?>
Thanks, a lot for any help.
I'm trying to do a simple, popup alert to check the password to show a hidden DIV. But, I'm not too familiar with MD5 and I know that javascript does not have that function, so I tried converting it to PHP. It doesn't work, so I wanted to get some help on getting it fixed (if possible) or approaching it from a different perspective. The problem is I still have to deal with MD5.
<?php
echo "<script type=\"text/javascript\">";
echo "function rdfShow(obj){";
echo "var ".$popup." = prompt(\"What's the password?\", \"\");";
$hash = md5($_GET["popup"]);
echo "if(\"".$hash."\" === \"".$pass."\")";
echo "document.getElementById(obj).style.display = 'block';";
echo "else";
echo "alert('Wrong password!');";
echo "}";
echo "</script>";
?>
Thanks, a lot for any help.