Mystical Posted November 2, 2011 Share Posted November 2, 2011 I have been looking at this code for days and still cant figure out why it isn't working. There are a few other posts on here about the same thing but it seems no one has figured it it out yet. Any one know where to start to fix this? I'm almost blind man.... Seems like it never gets sent to the database. The event is not being sent either obviously. I' m freaking lost.... Pretty sure it is something simple but it eludes me. else { $_POST['ref'] = abs((int) $_POST['ref']); $IP = $db->escape($_SERVER['REMOTE_ADDR']); $q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}"); if($db->num_rows($q)) { die("No creating referral multies. Bad dog.<br /> ><a href='register.php'>Back</a>"); } if($_POST['ref']) { $q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}"); $r=$db->fetch_row($q); } $db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)"); if($_POST['ref']) { require "global_func.php"; $db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}"); event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c); $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); } Quote Link to comment Share on other sites More sharing options...
vermilion Posted November 2, 2011 Share Posted November 2, 2011 I have been looking at this code for days and still cant figure out why it isn't working. There are a few other posts on here about the same thing but it seems no one has figured it it out yet. Any one know where to start to fix this? I'm almost blind man.... Seems like it never gets sent to the database. The event is not being sent either obviously. I' m freaking lost.... Pretty sure it is something simple but it eludes me. else { $_POST['ref'] = abs((int) $_POST['ref']); $IP = $db->escape($_SERVER['REMOTE_ADDR']); $q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}"); if($db->num_rows($q)) { die("No creating referral multies. Bad dog.<br /> ><a href='register.php'>Back</a>"); } if($_POST['ref']) { $q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}"); $r=$db->fetch_row($q); } $db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)"); if($_POST['ref']) { require "global_func.php"; $db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}"); event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c); $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); } try removing require "global_func.php"; Quote Link to comment Share on other sites More sharing options...
gurpreet Posted November 2, 2011 Share Posted November 2, 2011 This may sound stupid, but have you made sure your register page sends a $_POST['ref'] and not something like $_POST['referal'] Quote Link to comment Share on other sites More sharing options...
Mystical Posted November 2, 2011 Author Share Posted November 2, 2011 This may sound stupid, but have you made sure your register page sends a $_POST['ref'] and not something like $_POST['referal'] They all send a $_POST['ref'] ....... Still nothing....Thanks for giving me somewhere to look. Quote Link to comment Share on other sites More sharing options...
Mystical Posted November 2, 2011 Author Share Posted November 2, 2011 That does not do anything at all... Still does not work. I think it is possessed man. I am about ready to say the heck with referrals. I knew I was in trouble with this file when I saw this..."you have earnt" I figure if the folks that made this engine cant use proper English not much else is going to work right. I wasn't far off. It is earned..... Thanks for trying to help me vermilion. Much appreciated. Side note : I give myself credit for using the word "heck" because that sure isn't what I was thinking ;) Quote Link to comment Share on other sites More sharing options...
gurpreet Posted November 2, 2011 Share Posted November 2, 2011 So did you find out the problem? Quote Link to comment Share on other sites More sharing options...
Mystical Posted November 3, 2011 Author Share Posted November 3, 2011 So did you find out the problem? Not at all. Still does not work and it probably never will. Oh well....such is life. Quote Link to comment Share on other sites More sharing options...
Smokey Posted January 21, 2012 Share Posted January 21, 2012 Down towards the bottom you should see $_POST['REF'] four times, i changed the REF's to lower case and my referrals started working, idk if this is the same issue but it worked for me. 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.