ignite Posted March 27, 2007 Share Posted March 27, 2007 It seems im having abit of a problems with referals. For everyone new player that signs up i get and event saying thanks for refering so and so this happens even low i haven't referred them. Here is the code in register.php $_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, 'Male', 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+2 WHERE userid={$_POST['ref']}",$c); event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c); mysql_query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$ip')", $c); Can someone tell me what im doing wrong ? Ps: i think this is the right place to post this but if it's not im sorry. Quote Link to comment Share on other sites More sharing options...
ignite Posted March 27, 2007 Author Share Posted March 27, 2007 Re: Help with referals. Hmm It still doesn't add a referal to the user who refered the player or no event. Quote Link to comment Share on other sites More sharing options...
tittlemouse Posted March 27, 2007 Share Posted March 27, 2007 Re: Help with referals. mines works so why dont i just put in my code. Quote Link to comment Share on other sites More sharing options...
ignite Posted March 27, 2007 Author Share Posted March 27, 2007 Re: Help with referals. Ok, suits me but im wondering if the fault is some were else. Quote Link to comment Share on other sites More sharing options...
tittlemouse Posted March 29, 2007 Share Posted March 29, 2007 Re: Help with referals. here u go <?php /* MCCodes Lite register.php Rev 1.0.0 Copyright © 2006 Dabomstew This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ session_start(); print "<html> <head> <title>Your Game Name</title> <style> body { font-family:Verdana;font-size:9pt;color: black; background-color:#C3C3C3; scrollbar-base-color: #005B70; scrollbar-arrow-color: #F3960B; scrollbar-DarkShadow-Color: #000000; } a:visited,a:active,a:hover,a:link { color: black;text-decoration: none; } table,tr,td { font-size:9pt; } img { border:none; } </style> </head> <body> "; $ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; if(file_exists('ipbans/'.$ip)) { die("<font color=red size=+1>Your IP has been banned, there is no way around this.</font></body></html>"); } require "mysql.php"; global $c; if($_POST['username']) { $sm=100; if($_POST['promo'] == "Your Promo Code Here") { $sm+=100; } $username=$_POST['username']; $username=str_replace(array("<", ">"), array("<", ">"), $username); $q=mysql_query("SELECT * FROM users WHERE username='{$username}'",$c); if(mysql_num_rows($q)) { print "Username already in use. Choose another."; } else if($_POST['password'] != $_POST['cpassword']) { print "The passwords did not match, go back and try again."; } else { $_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, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, lastip) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, 'Male', unix_timestamp(), '{$_POST['email']}', '$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+2 WHERE userid={$_POST['ref']}",$c); event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c); mysql_query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$ip')", $c); } print "You have signed up, enjoy the game. > Login"; } } else { print "<h3>Your Game Name Registration</h3>"; print "<form action=register.php method=post>Username: <input type=text name=username> Password: <input type=password name=password> Confirm Password: <input type=password name=cpassword> Email: <input type=text name=email> Promo Code: <input type=text name=promo> <input type=hidden name=ref value='"; if($_GET['REF']) { print $_GET['REF']; } print "'> <input type=submit value=Submit></form> > Go Back"; } print "</body></html>"; ?> give me +1 for help lol just kidding Quote Link to comment Share on other sites More sharing options...
ignite Posted March 29, 2007 Author Share Posted March 29, 2007 Re: Help with referals. Still don't work :? Quote Link to comment Share on other sites More sharing options...
ignite Posted March 30, 2007 Author Share Posted March 30, 2007 Re: Help with referals. bump Quote Link to comment Share on other sites More sharing options...
tittlemouse Posted April 1, 2007 Share Posted April 1, 2007 Re: Help with referals. ok. it works on mine. Quote Link to comment Share on other sites More sharing options...
twist_killer Posted April 1, 2007 Share Posted April 1, 2007 Re: Help with referals. is your game lite v1 or v2? Quote Link to comment Share on other sites More sharing options...
tittlemouse Posted April 1, 2007 Share Posted April 1, 2007 Re: Help with referals. i have 3 games 1 lite 1 v1 and 1 v2 Quote Link to comment Share on other sites More sharing options...
ignite Posted April 3, 2007 Author Share Posted April 3, 2007 Re: Help with referals. V1 Quote Link to comment Share on other sites More sharing options...
-Matt- Posted April 4, 2007 Share Posted April 4, 2007 Re: Help with referals. are u allowed 2 sare v1 on here Quote Link to comment Share on other sites More sharing options...
ignite Posted April 12, 2007 Author Share Posted April 12, 2007 Re: Help with referals. Bump Quote Link to comment Share on other sites More sharing options...
bamaman Posted June 7, 2007 Share Posted June 7, 2007 Re: Help with referals. ok now what is the code to add someones referal code to one of the pages (sorry am a noobie) 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.