Your IP : 18.189.182.15


Current Path : /home/lentoinv/covisclubinternational.com/profile/js/
Upload File :
Current File : //home/lentoinv/covisclubinternational.com/profile/js/username2.php

<?php

$db = new mysqli("localhost","root","","covismlm");

function userToId($user, $col='id')
    {
        global $db;
        $que = $db->query("SELECT * FROM user WHERE user = '$user' ") or die(mysqli_error());
        $ro = mysqli_fetch_array($que);
        return $ro[$col];
    }

        function userName($id,$col = '')
    {
        global $db ;

        $que = $db->query("SELECT * FROM user WHERE id = '$id' ") or die(mysqli_error());
        $ro = mysqli_fetch_array($que);
        if (!empty($col)) {
            return $ro[$col];
        } else {
            return htmlspecialchars($ro['firstname'] . ' ' . $ro['lastname']);
        }
    }

if(isset($_GET['val'])){
	$search = $_GET['val'];
	$search2 = userToId($search);
	$entry = '';
	$sql = $db->query("SELECT * FROM globeuser WHERE id='$search2' LIMIT 1");
	if($search == ''){
		$entry = 0;
	}
	elseif($search == '0'){
		$entry = '';
	}
	elseif($sql->num_rows < 1){
		$entry = 1;
	}
	else {
		$row = $sql->fetch_assoc();

		$entry = strlen($search2)<5 ? '' : '<button class="btn btn-primary float-md-right" name="JoinGmatrix" value="'.$row['sn'].'"> JOIN GLOBAL MATRIX OF: '.strtoupper(userName($search2)).'</button>';
	}

	echo $entry;
}


mysqli_close($db);
?>

?>