I have a referral system which im trying to setup properly but have been working on it for 2 days straight now and cant find a solution, help will be greatly appreciated, all PHP files will be below. Thanks in advance!
When I click on a referral link, it redirects me to the register page, I then sign up and sometimes it will redirect to the me.php page and sometimes it will freeze with white screen on register_submit.php, but the problem is it dosnt update the database with the referral points so i can sign up using a referral link and it wont add the referral point to my account.
r.php (This processes the link before redirecting to the register page, example referral link, http://habbz.servequake.com/r.php?user=Test)
register_submit.php (Redirects to me page after registering)PHP Code:<?php/* #################################################################### \|| |||| TwinkieCMS - Use of this software is strictly prohibited. *#|| # Copyright (C) 2014 lD@vidl. *#||---------------------------------------------------------------------*#||---------------------------------------------------------------------*#|| Script pensado para la gestión de retroservers Habbo. *#|| Tanto el script como los autores del mismo no tienen ningún tipo *#|| de asociación con Habbo y/o Sulake Oy Corp. Por lo tanto, estos no *#|| se hacen responsables del uso que el usuario le dé. *#|| ||\ ################################################################### */ob_start(); require_once 'inc/core.php'; $user->logged('no');
function base58_decode($num) { $alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'; $len = strlen($num); $decoded = 0; $multi = 1; for ($i = $len - 1; $i >= 0; $i--) { $decoded += $multi * strpos($alphabet, $num[$i]); $multi = $multi * strlen($alphabet); } return $decoded; } $remote_ip = USER_IP; $sql = $db->query("SELECT * FROM users WHERE ip_last = '".$remote_ip."'");
if($sql->num_rows > 0) { header("Location: " . PATH . "/register.php"); exit; } else { if (isset($_GET['id'])){ $decoded = base58_decode($_GET['id']) or die(header("Location: ". PATH ."/")); $_SESSION['refer'] = $user->filtertext($decoded); $_SESSION['refer_type'] = "id"; } if (isset($_GET['user'])){ $_SESSION['refer'] = $user->filtertext($_GET['user']); $_SESSION['refer_type'] = "username"; } header("Location: ". PATH ."/register.php"); exit; }ob_end_flush(); ?>
Part of functions.php (Rewards the referral with a refer point)PHP Code:<?php/* #################################################################### \|| |||| TwinkieCMS - Use of this software is strictly prohibited. *#|| # Copyright (C) 2014 lD@vidl. *#||---------------------------------------------------------------------*#||---------------------------------------------------------------------*#|| Script pensado para la gestión de retroservers Habbo. *#|| Tanto el script como los autores del mismo no tienen ningún tipo *#|| de asociación con Habbo y/o Sulake Oy Corp. Por lo tanto, estos no *#|| se hacen responsables del uso que el usuario le dé. *#|| ||\ ################################################################### */ob_start(); require_once 'inc/core.php'; if($user->register_now()) { header("Location: ".PATH."/me.php"); exit; } else { header("Location: ".PATH."/register.php?username=".$_POST['reg_username']."&rememberme=false&focus=login-username&login-password"); exit; }ob_end_flush(); ?>
If you want to have a closer look at these files I will provide the download link for the CMS.PHP Code:}else{ $password3 = $this->HoloHash($password, $user); $this->AddUser($user, $mail, $password3, '', '', $avatarimage); $_SESSION['username'] = $user; $_SESSION['password'] = $password3; if(!empty($_SESSION['refer'])){ $execute = $db->query("UPDATE users SET refer_count = refer_count + '1' WHERE username = '".$this->filtertext($_SESSION['refer'])."' LIMIT 1"); } header("LOCATION: ". PATH ."/me.php"); return true; }
Cms: https://mega.co.nz/#!tYAFTaLK!BdhgYh...Bcf04-vC9-t5IU
Please help me find the solution to fix the problem, Thank You!!!!![]()





