PHP Code:
if (md5($str) == $usrpass)
That wouldn't work. You'd have to make $usrpass a global variable or make it in your function's input.
.. and for $Cvalue, I think it's more or less the same thing. You need to make it a global variable for it to be used outside of the function.
The next code you posted just md5()'s the text and doesn't do anything with it.