Hi. Let me present you this system. Gives to any user unique link (by username). When someone click on it gives between 1 and 3 credits for webshop. Works only on muweb 0.8
vote.php put it in modules folder.
link.php in modules again.PHP Code:<center>
<?php
include "conreal.php";
$id = stripslashes($_GET['id']);
$id = str_replace("drop", "", $id);
$id = str_replace(";", "", $id);
$id = str_replace("shutdown", "", $id);
$id = str_replace("UPDATE", "", $id);
if (eregi("[^a-zA-Z0-9_-]", $id))
{
echo "Asshole.";
}
else
{
if ($_POST['click'])
{
echo "<font color='#FFFFFF'>";
$time = time();
$time1 = time() - 86400;
$ip = $_SERVER['REMOTE_ADDR'];
$s = mssql_num_rows(mssql_query("SELECT * from MEMB_INFO where memb___id='$id'"));
if ($s == "1")
{
$query = mssql_query("SELECT * from items WHERE ip='$ip' and userid='$id' and vreme>$time1 ORDER by vreme DESC");
$broi = mssql_num_rows($query);
if ($broi == "0")
{
$rand = rand(1,3);
$insert = mssql_query("INSERT INTO items (vreme, userid , ip ) VALUES('$time','$id','$ip')");
$update = mssql_query("Update MEMB_CREDITS set credits = credits+$rand WHERE memb___id='$id'");
echo "You successful vote for $id and he get $rand credits!";
}
else
{
echo "You are already vote. You can vote again after 24 hours.";
}
echo "</font>";
}
else
{
echo "This user doesn't exist!";
}
}
else
{
?>
<form action="http://watch-bg.info/en/index.php?op=vote&id=<?= $id ?>" method="post">
<input type="submit" value="Vote for <?= $id ?>" name="click">
</form>
<?php
}
}
?>
</center>
topreferal.php ... modules/PHP Code:<center><font color='#FFFFFF'>
<?php
include "conreal.php";
if ($_SESSION['user']==TRUE)
{
$user=$_SESSION['user'];
echo "
Разпространявайте линка си за кредити в webshop-а.<br> Твоят линк е:
<br><br><a href='$yoursite/index.php?op=vote&id=".$user."'>$yoursite/index.php?op=vote&id=".$user."</a>";
}
?>
</font></center>
conreal.php in main directoryPHP Code:<?php
include "conreal.php";
$query = mssql_query("SELECT DISTINCT TOP 100 (userid), broi from items order by broi desc");
while ($a = $fetch = mssql_fetch_array($query)) {
$id = $a['userid'];
$getname = mssql_query("SELECT * from MEMB_INFO where memb___id='$id'");
$fatch = mssql_fetch_array($getname);
$username = $fatch['memb___id'];
$broi = mssql_num_rows(mssql_query("SELECT * from items where userid='$id'"));
$up = mssql_query("UPDATE items SET broi='$broi' WHERE userid='$id'");
$username = $fatch['memb___id'];
echo '
' . $username . '-' . $broi . '<br>
';
}
?>
PHP Code:<?php
$conn=mssql_connect('localhost','sa','password');
$selected=mssql_select_db('MuOnline', $conn);
$yoursite="http://Yoursite"; // Your website without /! Example http://referalsystem.com
?>
Query Analizerin MuOnline database MuOnlineCode:CREATE TABLE [items] ( [vreme] [int] NULL , [userid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [ip] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [broi] [int] NULL ) ON [PRIMARY] GO
And... made new link which goes to http://mysite.com/index.php?op=link
Credits: NewGuy





