Jump to content

Help with referal code


GetReady

Recommended Posts

Hi, I'm currently using the code below as a referral system and it isn't submitting the referrer into the database, can anyone spot why or possibly explain what is wrong with the coding, Many Thanks.

 

<?

session_start(); 

 

if (!(isset($_SESSION["real_name"])))

{

//echo "I'm not logged in";

header('Location: login.php');

}

else

{

echo "";

}

 

 

?>

 

 

 

<html>

<head>

<title>Site name here</title></head>

    <link REL="stylesheet" TYPE="text/css" HREF="main.css">

 

<script language=javascript src=Menus.js></script>

 

<body background="wallpaper.jpg">

<center>

<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

 

<TR>

 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">

<?php include("leftmenu.php");?>

</TD>

 

    <td width="100%" valign="top"> <br>

 

 

<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=75%>

<tr>

<td align="center" colspan="5" class="header">Referal Link</td>

</tr>

<tr>

<td colspan="5">

http://www.sitenamehere.com/Register.php?referrer=<? echo "$username"; ?>

</td>

</tr>

<tr>

<td align="center" colspan="1" class="header">Username</td>

<td align="center" colspan="1" class="header">Total Referrals</td>

<td align="center" colspan="1" class="header">Referral Points</td>

</tr>

<?

$sql="SELECT * FROM users WHERE username='$username' LIMIT 1";

$result=mysql_query($sql);

 

while($rows=mysql_fetch_array($result)){ // Start looping table row

 

?>

<tr>

<td align="center" colspan="1"><a href="viewprofile.php?viewuser=<? echo $rows['username']; ?>"><? echo $rows['username']; ?></a></td>

<td align="center" colspan="1"><? echo $rows['referals']; ?></td>

<td align="center" colspan="1"><? echo $rows['referpoints']; ?></td>

</tr>

<? } ?>

<tr>

<td align="center" colspan="5" class="header">Referal Top 15</td>

</tr>

<tr>

<td align="center" colspan="1" class="header">Username</td>

<td align="center" colspan="1" class="header">Total Referrals</td>

<td align="center" colspan="1" class="header">Referral Points</td>

</tr>

<?

$sql="SELECT * FROM users WHERE referals >0 AND userlevel <10 ORDER by referpoints DESC LIMIT 15";

$result=mysql_query($sql);

 

while($rows=mysql_fetch_array($result)){ // Start looping table row

 

?>

<tr>

<td align="center" colspan="1"><a href="viewprofile.php?viewuser=<? echo $rows['username']; ?>"><? echo $rows['username']; ?></a></td>

<td align="center" colspan="1"><? echo $rows['referals']; ?></td>

<td align="center" colspan="1"><? echo $rows['referpoints']; ?></td>

</tr>

<? } ?>

</table>

 

 

<br><br>

 

 

</td>

 

 

 

    <TD width="150" valign="top">

<?php include("rightmenu.php");?>

</TD>

 

</TR>

 

 

</table>

 

</center>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/186213-help-with-referal-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.