Jump to content
MakeWebGames

Recommended Posts

Posted

Yes, a user with a dynamic IP keeps referring a user without his permission and he's gaining countless crystals from it and I would like to disable referrals on just his account, is there any way I can do this?

Posted

Re: Disable referrals on a user

tomo-I would suggest just opening up your register.php

go to the line that adds crystals to the referer when the user signs up.

add a simple check

if($referers userid == 514)

blah

else

add crystals

 

where 514 is the ID # of the person you wish to stop.

Posted

Re: Disable referrals on a user

Ok, this didn't work but there's no doubt I'm doing it wrong, could someone tell me exactly what to put and where to put it?

 

$_POST['ref'] = abs((int) $_POST['ref']);
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$q=mysql_query("SELECT * FROM users WHERE lastip='$ip' AND userid={$_POST['ref']}",$c);
if(mysql_num_rows($q))
{
die("No creating referral multies. Bad dog.");
}
if($_POST['ref']) {
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ref']}",$c);
$r=mysql_fetch_array($q);
}
mysql_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) 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')", $c);
$i=mysql_insert_id($c);
mysql_query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)", $c);

if($_POST['ref']) {
require "global_func.php";
mysql_query("UPDATE users SET crystals=crystals+100 WHERE userid={$_POST['ref']}",$c);
event_add($_POST['ref'],"For refering $username to the game, you have earnt 100 valuable crystals!",$c);
mysql_query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$ip')", $c);
}
Posted

Re: Disable referrals on a user

why not just...

Find

mysql_query("UPDATE users SET crystals=crystals+100 WHERE userid={$_POST['ref']}",$c);
event_add($_POST['ref'],"For refering $username to the game, you have earnt 100 valuable crystals!",$c);

 

replace with

if(!$_POST['ref']==IDOFTHEUSERYOURDONTWANTTOBEABLETOREFERGOESHERE)

{

mysql_query("UPDATE users SET crystals=crystals+100 WHERE userid={$_POST['ref']}",$c);

event_add($_POST['ref'],"For refering $username to the game, you have earnt 100 valuable crystals!",$c);

}

else

{

event_add($_POST['ref'],"for being a noob and smelling like toast, i hereby banish you from recruiting among the morons you sleep with at night",$c);

}

something like that i would imagine

Posted

Re: Disable referrals on a user

 

if($_POST['ref']!=IDOFTHEUSERYOURDONTWANTTOBEABLETOREFERGOESHERE)
{
mysql_query("UPDATE users SET crystals=crystals+100 WHERE userid={$_POST['ref']}",$c);
event_add($_POST['ref'],"For refering $username to the game, you have earnt 100 valuable crystals!",$c);
}
else
{
event_add($_POST['ref'],"for being a noob and smelling like toast, i hereby banish you from recruiting among the morons you sleep with at night",$c);
}
Posted

Re: Disable referrals on a user

Works perfectly, thank you.

If I want to add more than one, can I just seperate the ID's with commas, like 1, 23, 56, 87, 9 etc

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