추천인 기능 적용한 홈페이지에서 추천인 단계별로 추출하기 정보
추천인 기능 적용한 홈페이지에서 추천인 단계별로 추출하기본문
제목 그대로 추천인들을 단계별로 보여주는 팁입니다.
아래 소스를 member_group.php란 이름으로 그누보드 폴더에 올립니다.
혹시 다른 폴더에 올릴 경우
▶ echo "<a href='$g4[path]/member_group.php'><b>:: 내 그룹</b></a>";
▶ echo "<td><a href='$g4[path]/member_group.php?mbrecommend=$profile[mb_id]'><span class='Rnum'>($rowRnum[Rnum])</span></a>";
▶ echo "<td><a href='$g4[path]/member_group.php?mbrecommend=$profile2[mb_id]'><span class='Rnum'>($rowRnum2[Rnum2])</span></a>";
요 3군데의 링크를 수정하세요.
<?
include_once("./_common.php");
include_once("./_head.php");
if (!$member[mb_id]) {
alert("회원만 볼 수 있습니다.");
} else { //회원만 보게...
?>
<style type="text/css">
<!--
.small {font-family:돋움;font-size:8pt;}
.Rnum { font-family:돋움;font-size:8pt;color:coral;font-weight:bold; }
-->
</style>
<?
echo "<div style='margin:0 0 10 0;'>";
echo "<a href='$g4[path]/member_group.php'><b>:: 내 그룹</b></a>";
if ($mbrecommend) {
$profileRc = get_member("$mbrecommend");
echo " >> <b>$profileRc[mb_name]</b>($profileRc[mb_nick], $profileRc[mb_id])님의 하위그룹입니다.";
}
echo "<p>※ <span class='Rnum'>(숫자)</span>를 클릭하면 하위그룹으로 이동합니다. (현재 페이지당 2대까지 보임)";
echo "<table width=100% cellpadding=2 cellspacing=1 border=0 bgcolor=#bbbbbb>";
echo "<colgroup><colgroup><colgroup><colgroup><colgroup><colgroup width=50><colgroup width=50>";
echo "<tr bgcolor=#dddddd align=center><td width=10><td class='small'>아이디<td class='small'>이름<td><td class='small'>연락처";
echo "<td class='small'>최종접속<td class='small'>가입날짜";
if ($mbrecommend == "") { $memberid = $member[mb_id]; } else { $memberid = $mbrecommend; }
$sql = " select
mb_id, mb_name, mb_email, mb_homepage, mb_open, mb_recommend from $g4[member_table]
where mb_recommend = '$memberid' and mb_level >= '2' order by mb_datetime desc ";
$result = sql_query($sql);
if(@mysql_num_rows($result)>0) {
for ($i=0,$j=1; $row=mysql_fetch_array($result); $i++,$j++) {
$tmp_id = $row[mb_id];
$profile = get_member("$tmp_id");
$sqlRnum = "select count(*) as Rnum from $g4[member_table] where mb_recommend = '$tmp_id' and mb_level >= '2'";
$rowRnum = sql_fetch($sqlRnum);
echo "<tr bgcolor=#eeeeee align=center>";
echo "<td class='small'>$j";
echo "<td class='small'>$profile[mb_id]";
echo "<td><b>$profile[mb_name]</b>($profile[mb_nick])";
if ($profile[mb_level] >= 4) { echo "<span style='color:red;'>★</span>"; }
echo "<td><a href='$g4[path]/member_group.php?mbrecommend=$profile[mb_id]'><span class='Rnum'>($rowRnum[Rnum])</span></a>";
echo "<td class='small'>";
if ($profile[mb_hp]) { echo "$profile[mb_hp]"; }
if ($profile[mb_tel]) { echo "<br />$profile[mb_tel]"; }
if ($profile[mb_email]) { echo "<br />$profile[mb_email]"; }
echo "<td class='small'>$profile[mb_today_login]";
echo "<td class='small'>$profile[mb_datetime]";
$sql2 = "select
mb_id, mb_name, mb_email, mb_homepage, mb_open, mb_recommend from $g4[member_table]
where mb_recommend = '$tmp_id' and mb_level >= '2' order by mb_datetime desc ";
$result2 = sql_query($sql2);
if(@mysql_num_rows($result2)>0) {
echo "<tr><td colspan=10 style='padding:5 5 10 5;background:#ffffff;'>";
echo "<table width=98% cellpadding=2 cellspacing=1 border=0 bgcolor=#cccccc align=right>";
echo "<colgroup><colgroup><colgroup><colgroup><colgroup><colgroup width=80><colgroup width=80>";
echo "<tr bgcolor=#dddddd align=center><td width=10><td class='small'>아이디<td class='small'>이름<td><td class='small'>연락처";
echo "<td class='small'>최종접속<td class='small'>가입날짜";
for ($k=0,$l=1; $row2=mysql_fetch_array($result2); $k++,$l++) {
$tmp2_id = $row2[mb_id];
$profile2 = get_member("$tmp2_id");
$sqlRnum2 = "select count(*) as Rnum2 from $g4[member_table] where mb_recommend = '$tmp2_id' and mb_level >= '2'";
$rowRnum2 = sql_fetch($sqlRnum2);
echo "<tr bgcolor=#eeeeee align=center>";
echo "<td class='small'>$l";
echo "<td class='small'>$profile2[mb_id]";
echo "<td><b>$profile2[mb_name]</b>($profile2[mb_nick])";
if ($profile2[mb_level] >= 4) { echo "<span style='color:red;'>★</span>"; }
echo "<td><a href='$g4[path]/member_group.php?mbrecommend=$profile2[mb_id]'><span class='Rnum'>($rowRnum2[Rnum2])</span></a>";
echo "<td class='small'>";
if ($profile2[mb_hp]) { echo "$profile2[mb_hp]"; }
if ($profile2[mb_tel]) { echo "<br />$profile2[mb_tel]"; }
if ($profile2[mb_email]) { echo "<br />$profile2[mb_email]"; }
echo "<td class='small'>$profile2[mb_today_login]";
echo "<td class='small'>$profile2[mb_datetime]";
}
echo "</table>";
}
} }
echo "</table>";
echo "</div>";
} //회원만 보게...
include_once("./_tail.php");
?>
5