<?php
/**
 * Referral System
 * https://webenginecms.org/
 * 
 * @version 1.0.0
 * @author Lautaro Angelico <http://lautaroangelico.com/>
 * @copyright (c) 2013-2019 Lautaro Angelico, All Rights Reserved
 * @build 3d220b662522c313f5980cd685842c3d
 */

if(isLoggedIn()) redirect();

echo '<div class="page-title"><span>'.lang('referralsystem_title').'</span></div>';

try {
	
	// check referral player
	if(!check_value($_GET['player'])) redirect();
	
	// clear referral cookie
	unset($_COOKIE['referral']);
	
	// set referral cookie
	setcookie('referral', $_GET['player'], time()+86400, "/");
	
	// redirect home
	redirect();
	
} catch(Exception $ex) {
	message('error', $ex->getMessage());
}