newttster Posted February 22, 2013 Share Posted February 22, 2013 (edited) I've looked and as far as I have seen ... no one has solved this yet. Is there anyone that has figured out how to get the referals to work? This is the code that I have for all the referal stuff. register.php info $_POST['ref'] = (isset($_POST['ref']) && is_numeric($_POST['ref'])) ? abs(intval($_POST['ref'])) : ''; $IP = $db->escape($_SERVER['REMOTE_ADDR']); if ($_POST['ref'] > 0) { $q = $db->query("SELECT `lastip` FROM `users` WHERE `userid` = {$_POST['ref']}"); if ($db->num_rows($q) == 0) { echo "Referrer does not exist.<br /> > <a href='register.php'>Back</a>"; exit; } $rem_IP = $db->fetch_row($q); if ($rem_IP == $_SERVER['REMOTE_ADDR']) { echo "No creating referral multies.<br /> > <a href='register.php'>Back</a>"; exit; } } if ($_POST['ref']) { $db->query("UPDATE `users` SET `crystals` = `crystals` + 200 WHERE `userid` = {$_POST['ref']}"); event_add($_POST['ref'], "For refering $username to the game, you have earned 200 valuable crystals!", $c); $e_rip = $db->escape($rem_IP); $db->query("INSERT INTO `referals` VALUES(NULL, {$_POST['ref']}, $i, unix_timestamp(), '{$e_rip}', '$IP')"); } <input type=hidden name=ref value=' <?php $_GET['REF'] = abs((int) $_GET['REF']); if($_GET['REF']) { print $_GET['REF']; } ?> ' /> And yes ... on the explore.php file it is set up as http://www.XXXXX/register.php?REF=# Edited February 24, 2013 by newttster Quote Link to comment Share on other sites More sharing options...
Bennyh789 Posted February 22, 2013 Share Posted February 22, 2013 Ive got a working copy mate will dig it out later and post here Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted February 22, 2013 Share Posted February 22, 2013 I believe its case sensitive. In one query you have ref and in another you have REF try making them the same but I am not 100% certain Quote Link to comment Share on other sites More sharing options...
sniko Posted February 22, 2013 Share Posted February 22, 2013 I believe its case sensitive. In one query you have ref and in another you have REF try making them the same but I am not 100% certain You're correct. @OP Change: $_POST['ref'] = (isset($_POST['ref']) && is_numeric($_POST['ref'])) ? abs(intval($_POST['ref'])) : ''; To $_POST['ref'] = (isset($_POST['REF']) && is_numeric($_POST['REF'])) ? abs(intval($_POST['REF'])) : ''; Quote Link to comment Share on other sites More sharing options...
Djkanna Posted February 23, 2013 Share Posted February 23, 2013 You're correct. @OP Change: $_POST['ref'] = (isset($_POST['ref']) && is_numeric($_POST['ref'])) ? abs(intval($_POST['ref'])) : ''; To $_POST['ref'] = (isset($_POST['REF']) && is_numeric($_POST['REF'])) ? abs(intval($_POST['REF'])) : ''; The form is lowercase only the the GET is upper-case in line with what the referral URL is. Quote Link to comment Share on other sites More sharing options...
newttster Posted February 24, 2013 Author Share Posted February 24, 2013 I'll be honest ... I've tried changing them all to REF ... changing them to ref ... a mix of both and nothing has worked. This is one thing that has been driving me nuts about the register.php file. The one thing that I don't understand is how the $_POST['ref'] is supposed to be getting the information from the $_GET['REF']. Quote Link to comment Share on other sites More sharing options...
newttster Posted February 24, 2013 Author Share Posted February 24, 2013 (edited) Gotcha. I just saw that and it makes sense. Was so caught up in the REF / ref that I didn't pay attention to the name. *facepalms* No ... nothing is inserted into the db, there is no event stating that so and so signed up with their referal.Nothing is awarded to the referrer. Nothing. The rest of the register.php file works correctly. Even the promo code works fine. Edited February 24, 2013 by newttster Quote Link to comment Share on other sites More sharing options...
newttster Posted February 24, 2013 Author Share Posted February 24, 2013 Sent. And thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.