Jump to content
MakeWebGames

Recommended Posts

Posted

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')");
}
Posted
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";

Posted
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.

Posted

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 ;)

  • 2 months later...
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...