Hi Shaun,
I've tried to do this in the actionhooks.php without any success. Please advise. Below is the code that I used.
function actionhook_ClientSignup($vars) {
# This function runs when a new client is added
# $vars["ClientID"]
# $vars["FirstName"]
# $vars["LastName"]
# $vars["CompanyName"]
# $vars["Email"]
# $vars["Address1"]
# $vars["Address2"]
# $vars["City"]
# $vars["State"]
# $vars["Postcode"]
# $vars["Country"]
# $vars["PhoneNumber"]
# $vars["Password"]
$uid = $vars['ClientID'];
$total = 0;
$even = 1;
while ($uid > 0) {
$val = ($uid % 10) * (++$even%2? 1 : 2);
if ($val > 10)
$val = ((int)($val / 10)) + $val % 10;
if ($val == 10)
$val = 1;
$total += $val;
$uid /= 10;
}
$ret = 10 - ($total % 10);
if ($ret >= 10)
$ret = 0;
$bpayid = $uid . $ret;
$sql = new mysqli('localhost', 'mdwh_scripte', 'nfX4wsT6j', 'mdwh_myacc');
$sql->query('INSERT INTO tblcustomfieldsvalues VALUES (3, $uid, $bpayid)');
}