inserting certain chars into db
Posted: Sun Jul 11, 2004 3:05 am
OK my problem is I want to securly encrypt and decrypt md5 passwords:
So i look on php.net and find this function to encrypt it
which works fine... it encrypts the password and returns something like this: à Έ)È×….g
Notice in the function I use both echo $sifra and $pass to ensure they are being set properly... heres is the problem.. furthur down in my code i have the following:
and it insets it properly to my knowledge.....
but for example i entered my password as: dadsfdfadsfdasdafafdfads (which returns à Ü
So i look on php.net and find this function to encrypt it
Code: Select all
<?php
function crypt_md5($msg,$heslo)
{
$key=$heslo;$sifra="";
$key1=binmd5($key);
while($msg)
{
$m=substr($msg,0,16);
$msg=substr($msg,16);
$sifra.=bytexor($m,$key1,16);
$key1=binmd5($key.$key1.$m);
}
echo "\n";
$pass = $sifra;
echo $sifra."<br><br>";
echo $pass;
}
?>Notice in the function I use both echo $sifra and $pass to ensure they are being set properly... heres is the problem.. furthur down in my code i have the following:
Code: Select all
<?php
crypt_md5($pass,$key);
@mysql_query("INSERT INTO users SET user='$user',pass='$pass',datejoined='$datejoined',email='$email',access='0'");
?>but for example i entered my password as: dadsfdfadsfdasdafafdfads (which returns à Ü