I know that my english is bad! Don`t tell me that ... I don`t care.. =))
Because is Christmas, I want to share a script :D
This script is used to reffer users :D ....
EX: the users that register using http://sitename.mob?id=1 will appear to be reffered by user that has id 1 ...
SQL:
Add to your users table (EX: ibwf_users, wapdesire_users ...) a new row called shad2
... This script is made by me ... so don`t take credit for it ...
Because is Christmas, I want to share a script :D
This script is used to reffer users :D ....
EX: the users that register using http://sitename.mob?id=1 will appear to be reffered by user that has id 1 ...
SQL:
Add to your users table (EX: ibwf_users, wapdesire_users ...) a new row called shad2
PHP Code:
####################
# index.php
####################
# $action=""
$shad0w= $_GET["id"];
$user = getnick_uid($shad0w);
// Optional ...
if ($user!="")
{
echo "<br/>You were invited to this site by <b> $user</b><br/>";
}
// register link
echo "<a href=\"register.php?id=$shad0w\">Register</a><br/>";
####################
# core.php
####################
# function registerform($ef)
// put this on the top of the function
$shad0w= $_GET["id"];
// REPLACE:
// $rform .= "<go href=\"register.php\" method=\"post\">";
// WITH:
$rform .= "<go href=\"register.php?id=$shad0w\" method=\"post\">";
####################
# register.php
####################
// on the top of the page , under $uid = $_POST["uid"]; , $pwd = $_POST["pwd"]; blah blah blah ...
$shad0w= $_GET["id"];
// Register succesfull (The page shown when you finished registration :D)
// replace users_table with your users table (EX: ibwf_users, wapdesire_users ...)
mysql_query("UPDATE users_table SET shad2='".$shad0w."' WHERE name='".$uid."'");
####################
# user profile
####################
$shad0w = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lib3rtymrc_users WHERE shad2='".$who."'"));
echo "Reffered users: <b><a href=\"index.php?action=shad0w&sid=$sid&who=$who\">$shad0w[0]</a></b><br/>";
####################
# index.php
####################
// replace users_table with your users table (EX: ibwf_users, wapdesire_users ...)
else if($action=="shad0w")
{
$who = $_GET["who"];
$uid = getuid_sid($sid);
addonline(getuid_sid($sid),"Reffered users","");
echo "<card id=\"main\" title=\"Reffered users\">";
echo "<p align=\"left\">";
echo mysql_error();
if($page=="" || $page<=0)$page=1;
$castigatori = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users_table WHERE shad2='".$who."'"));
$num_items = $castigatori[0];
$items_per_page= 20;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$adusi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users_table WHERE shad2='".$who."'"));
$nume = getnick_uid($who);
echo "<small>Users reffered by $nume :</small><br/>";
$sql = "SELECT id, regdate FROM users_table WHERE shad2='".$who."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
$items = mysql_query($sql);
while ($item = mysql_fetch_array($items))
{
$cou++;
$user = getnick_uid($item[0]);
$datainregistrare = "".date(d,$item[1]).".".date(m,$item[1]).".".date(y,$item[1])."";
$couw = $cou+($page-1)*$items_per_page;
$lnk = "<small>$couw)<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$user</a> ($datainregistrare)</small>";
echo "$lnk<br/>";
}
#pagini
if($page>1)
{
$ppage = $page-1;
echo "<small>«<a href=\"index.php?action=shad0w&who=$who&page=$ppage&sid=$sid&view=$view\">PREV</a></small><br/> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<small>»<a href=\"index.php?action=shad0w&who=$who&page=$npage&sid=$sid&view=$view\">NEXT</a></small>";
}
if($num_pages>2)
{
echo "<br/>$page/$num_pages<br/>";
$rets = "Jump la pagina:<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[go]";
$rets .= "<go href=\"index.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
if ($adusi[0] == 0)
{
echo "No reffered users.<br/>";
}
echo "</p><p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\">Main page</a>";
echo "<br/><br/>(c) Shad0w 2009";
echo "</p>";
echo "</card>";
}
Comment