Try out this code (create a reflinx.php in wp-content/plugins/ folder):
<?php
define ('REFERAL_STRING', 'id');
define ('DELIMITER', '=');
define ('SEARCHREFCODE', 'xxxx');
define ('DEFAULTREFCODE', '0');
// variables 2 work with cookies
define ('COOKIE_PREFIX', 'RefLinXid');
$expire...