<?php
	include_once('../config.php');   
	 
    if(!isset($_SESSION['userid']))
    { 
        header("Location: ../login");
        die;
    } 
	
        $userid = $_SESSION['userid'];
        $search = $userid;
        function tree_data($userid)
        {
        global $con;
        $data = array();
        $query = mysqli_query($con,"select * from tree where userid='$userid'");
        $result = mysqli_fetch_array($query);
        $data['left'] = $result['left'];
        $data['right'] = $result['right'];
        $data['leftcount'] = $result['leftcount'];
        $data['rightcount'] = $result['rightcount'];
        return $data;
        }
        ?>
        <?php 
        if(isset($_GET['search-id'])){
        $search_id = mysqli_real_escape_string($con,$_GET['search-id']);
        if($search_id!=""){
        $query_check = mysqli_query($con,"select * from user where cuurentId='$search_id'");
        if(mysqli_num_rows($query_check)>0)
        {
        $search = $search_id;
        }
        else{
        echo '<script>alert("Access Denied");window.location.assign("tree.php");</script>';
        }
        }
        else{
        echo '<script>alert("Access Denied");window.location.assign("tree.php");</script>';
        } 
        }
        

      
include_once("../view/dashboard/tree.php");
?>
