<?php
session_start();
include("include/config.php");
require_once "include/Database_functions.php";

$sqlObj=new sqlclass();
	
		$q = strtolower($_GET["q"]);
		if (!$q) return;
		
		if($_SESSION['typename'] == 'SuperAdmin')
		{
			$sql = "select * from cf_reseller where res_name LIKE '$q%'";
		}
		else
		{
			$userids = $_SESSION['admin_id'];
			$sq_user=mysql_query("select * from cf_user_clientid where user_id = '$userids'");
			$rw = mysql_fetch_array($sq_user);	
			
			$sq_clientcode=mysql_query("select * from cf_client where client_newcode = '".$rw['client_code']."'");
			$rw1 = mysql_fetch_array($sq_clientcode);					
			
			
			$sql = "select * from cf_reseller where res_name LIKE '$q%' and client_subid = '".$rw1['client_sub_id']."'";
			//$rw2 = mysql_fetch_array($sq_subcode);					
			
		}
		$rsd = mysql_query($sql);
		while($rs = mysql_fetch_array($rsd)) {
			$cname = $rs['res_name'];
			echo "$cname\n";
		}
	



?>