Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 239
0 Users 2 Guests Online
Forum Index » PHP + MySQL » Referal System help :)
Posted on Tuesday 18th November 200 at 04:51 PM
jambomb
templates/default/images/noavatar.png's Avatar
Junior Member
Okay i have been trying to make a referal system for my site but its just not working!!

this is my referer code so far in the register php script!

Code


////////////// REFERER!!!! /////////////

if(isset($_GET['r'])){

$reff = addslashes($_GET['r']);
$getRef =mysql_query("SELECT * FROM `members` WHERE `username` = '$reff'");


$ref = mysql_fetch_array($getRef);



$giveReferer1 = mysql_query("UPDATE `members` SET `cash` = 'cash + 10000' WHERE `username` = '$ref' ") or die(mysql_error());
$giveReferer2 = mysql_query("UPDATE `members` SET `respect` = 'respect + 1000' WHERE `username` = '$ref' ") or die(mysql_error());

$to = "$ref";
$subject = "Friend Signed Up!";
$msg = "
Hello $ref

Your friend $username has just signed up and so you have received your $10,000 cash and a extra 1,000 Respect!

Thank you!

www.Crime-Network.com

";
$date = date("l jS F Y h:i A");
$newpm = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('$ref','BOT','$date','$subject','$msg');") or die(mysql_error());

}
/////////////////// END REFERER!!!! //////////////////




It seems fine to me but it just doesnt send the email or adds the cash to the r player


thanks for any help!!
Posted on Tuesday 18th November 200 at 05:03 PM
jambomb
templates/default/images/noavatar.png's Avatar
Junior Member
Okay i tryd this link but doesnt work...

http://www.crime-network.com/index.php?r=MotherFuK

but it needs to be under ?register but if i try this link

http://www.crime-network.com/index.php?register&r=MotherFuK

it just says fields left blank click here to try again

any help ??
Posted on Tuesday 18th November 200 at 05:48 PM
setsukemizuhara
templates/default/images/noavatar.png's Avatar
Newbie
Change:
Code
$newpm = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('$ref','BOT','$date','$subject','$msg');") or die(mysql_error());


To:
Code

$newpm = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('$ref','BOT','$date','$subject','$msg')") or die(mysql_error());
Posted on Tuesday 18th November 200 at 07:29 PM
Dava
templates/default/images/noavatar.png's Avatar
Active Member
jambomb send me your register.php
Posted on Tuesday 18th November 200 at 07:31 PM
Dava
templates/default/images/noavatar.png's Avatar
Active Member
here is a simple ref script just done quickly

Code

<?php
session_start(); //Start session
include("config.php"); //Include config file

if ($_GET[r]){
$reff = htmlspecialchars(strip_tags($_GET[r])); //friend
$to = "$reff";
$getref = mysql_query("SELECT * FROM `members` WHERE `username` = '$reff'");
$ref = mysql_fetch_array($getref);
$date = date("l jS F Y h:i A");
$subject = "Friends Request";
$from = "BOT";
$content = "Hello $ref[username]

Your friend $username has just signed up and so you have received your $10,000 cash and a extra 1,000 Respect!

Thank you!

www.Crime-Network.com";

$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $content . "')") or die(mysql_error()); //insert into the table!
$givecash = mysql_query("UPDATE `members` SET cash=cash+10000 WHERE `username` = '$ref[username]'");
$giverespect = mysql_query("UPDATE `members` SET respect=respect+10000 WHERE `username` = '$ref[username]'");

}
?>
Posted on Monday 2nd February 2009 at 04:16 PM
ShadowMage
templates/default/images/noavatar.png's Avatar
Senior Member
You will want to add IP Address checks to make sure they are not cheating.
Posted on Tuesday 17th March 2009 at 12:42 AM
afroxav
templates/default/images/noavatar.png's Avatar
Newbie
and you can both add cash and respect in the same sql query, using the AND keyword.