Blasteh
big tits
Hi,
I'm trying to get a referral system working, but for some reason, it wont add +1 to the users referral count.
I'm not sure where it's going wrong, but everytime a user registers and types in the referrer, it's supposed to +1 to the refs field in `users`.
I'm trying to get a referral system working, but for some reason, it wont add +1 to the users referral count.
PHP:
if($template->form->reg_referrer != null)
{
if(!$this->nameTaken($template->form->reg_referrer))
{
$template->form->error = 'The referrer does not exist.';
return;
}
else
{
$getReferrerIP = mysqli_fetch_array(dbquery("SELECT ip_last FROM users WHERE username = '". $template->form->reg_referrer ."'"));
if($getReferrerIP['ip_last'] == $_SERVER['REMOTE_ADDR'])
{
$template->form->error = 'You cannot refer someone on the same IP.';
}
else
{
$engine->query("UPDATE users SET refs = refs + 1 WHERE username = '". $template->form->reg_referrer . "' LIMIT 1");
}
}
}
I'm not sure where it's going wrong, but everytime a user registers and types in the referrer, it's supposed to +1 to the refs field in `users`.