PHP Classes

PHP MLM Binary Tree: Build multi-level marketing tree from member forms

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (6)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 69%Total: 1,600 This week: 1All time: 2,459 This week: 560Up
Version License PHP version Categories
mlm-binary-tree 3.0Freely Distributable5.4PHP 5, Databases, Content management
Description 

Author

This class can build a multi-level marketing tree from member forms.

It can generate HTML for forms to login or register a new user to create or update the profile data of members that will form a MLM binary tree.

The class can display the hierarchy of MLM member nodes with links to update or delete members.

The member profiles are stored in a MySQL database accessed using MySQLi.

Innovation Award
PHP Programming Innovation award nominee
February 2016
Number 3
Multi-level marketing is process that rewards a hierarchy of people that participate in the marketing of products, as well people that bring new people to the network that also help marketing those products.

This class allows users to build and edit a tree of people stored in a database of a multi-level marketing business. It also can display the tree of people on a Web page, so you can easily see which member brought other members.

Manuel Lemos
Picture of Vishv Sahdev
  Performance   Level  
Name: Vishv Sahdev <contact>
Classes: 13 packages by
Country: India India
Age: 52
All time rank: 51530 in India India
Week rank: 106 Up8 in India India Up
Innovation award
Innovation award
Nominee: 7x

Recommendations

MLM Tree Create
How to create Multi level Marketing Tree?

Example

<?
session_start
();
include
"mlmtree3.php"; // class file
//-------------------------Database Init
$user='';
$password='';
$dbname='';

if(
$_SERVER['REMOTE_ADDR'] == '::1' || $_SERVER['REMOTE_ADDR'] == '127.0.0.1' )
$mlm= new newmlmtree('localhost',$user,$password,$dbname) ;
else
$mlm= new newmlmtree('localhost',$user,$password,$dbname) ;
$op=array();

//---------------------------Left Bar

if($mlm->_lc()){
$op['leftcontent'] = '<li class="list-group-item"><a href="?q='.$mlm->encode('q=showtree').'" >Binary Tree</a></li>';
$op['leftcontent'] .= '<li class="list-group-item"><a href="?q='.$mlm->encode('q=profile').'" >Profile</a></li>';
$op['leftcontent'] .= '<li class="list-group-item"><a href="?q='.$mlm->encode('q=logout').'" >LogOUT</a></li>';
$lc=true;
$op['maincontent']='<div class="alert alert-success" role="alert">Welcome Member Area !</div>';
}
else
{
$lc=false;
$op['leftcontent']='<li class="list-group-item"><a href="?q='.$mlm->encode('q=login').'" >LogIN</a></li>';
$op['leftcontent'] .= '<li class="list-group-item"><a href="?q='.$mlm->encode('q=newmember').'" >New Member</a></li>';
$op['maincontent']='<div class="alert alert-warning" role="alert">Welcome!</div>';
}

//-------------------------Query

if(isset($_GET['q'])){
$ps=$mlm->decode($_GET['q']);
if(
mb_detect_encoding($ps, 'UTF-8', true))
parse_str($ps);
else
$op['maincontent'] .= '<div class="alert alert-info" role="alert">404 File Not Found</div>';
}



//--------------route------------------------------
if(isset($_POST['ok']) && $_POST['ok'] == 'New Member')
$op['maincontent'] .= $mlm->_newMember($_POST,$mlm->tablemlm);
elseif(isset(
$_POST['ok']) && $_POST['ok'] == 'Profile')
$op['maincontent'] .= $mlm->_profile($_POST,$mlm->tablereg);
elseif(isset(
$_POST['ok']) && $_POST['ok'] == 'Update')
$op['maincontent'] .= $mlm->_updateMember($_POST);
elseif(isset(
$_POST['ok']) && $_POST['ok'] == 'Delete')
$op['maincontent'] .= $mlm->_DeleteMember($_POST);
elseif(isset(
$_POST['ok']) && $_POST['ok'] == 'Login')
$op['maincontent'] .= $mlm->_login($_POST,$mlm->tablemlm);
elseif(isset(
$q) && $q == 'newmember')
{
$op['maincontent'] .= $mlm->newMember(isset($_POST) ? $_POST : '' );
}
elseif(isset(
$q) && $q == 'showtree' && $lc)
{
    if(isset(
$add)){
   
$_POST['remail']=$add;
   
$op['maincontent'] .= $mlm->newMember(isset($_POST) ? $_POST : '' );
    }
    elseif(isset(
$edit)){
       
$r=$mlm->fpid($edit,'Update');
   
$op['maincontent'] .= $mlm->newMemberUPdate(!empty($r) ? $r : '' );
    }
    elseif(isset(
$del)){
           
$r=$mlm->fpid($del,'Delete');
   
$op['maincontent'] .= $mlm->newMember(!empty($r) ? $r : '' );
    }
   
   
$op['footer'] = isset($email) ? $mlm->showtree($email) : $mlm->showtree();
$op['maincontent'] .="<div id='chart_div'>";
}
elseif(isset(
$q) && $q == 'login')
{
$op['maincontent'] .= $mlm->login(isset($_POST) ? $_POST : '' );
}
elseif(isset(
$q) && $q == 'profile' && $lc)
{
$op['maincontent'] .= $mlm->profile(isset($_POST) ? $_POST : '' );
}
elseif(isset(
$q) && $q == 'logout' && $lc)
{
$op['maincontent'] .= $mlm->logout();
}

//---------------------------------------------

if(is_file("./template/form-template.html")){
            echo
$mlm->render_temp("./template/form-template.html",$op);
    }


  Files folder image Files  
File Role Description
Files folder imagetemplate (2 files)
Plain text file mlmexample.php Example example file
Plain text file mlmtree3.php Class mlm tree class
Plain text file sql.sql Data sql table create

  Files folder image Files  /  template  
File Role Description
  Plain text file form-template.html Aux. template file
  Plain text file mlm_chart.html Aux. template mlm chart

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,600
This week:1
All time:2,459
This week:560Up
User Ratings User Comments (2)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:69%StarStarStarStar
Rank:350
 
No documentation of how it can used in laravel
5 years ago (Fred Rwagatenga)
60%StarStarStarStar
very bad code lot of errors
5 years ago (Attaullah Khan)
0%Star