Hi Zen Cart Pros

I am currently trying to build a front end website which uses the same customer log-in details as the Zen Cart instillation I have. I need a customer to be able to log in to the site using their existing account details.

My PHP is OK (ish) but I am very much still learning and cannot seem to reproduce the md5 and $salt combination that Zen Cart uses. So far I have this as a validation script...

Code:
$eMail = $_POST['eMail'];
$passWord = $_POST['passWord'];

$salt = substr(md5($passWord), 0, 2);

$passWord2 = md5($salt . $passWord) . ':' . $salt;

echo $passWord2;
This is only copied from another forum and when echoed does not produce what I see in the zen_customers table.

Any ideas please?