<?php
session_start();
include('config/koneksi2.php');

$username=$_SESSION['username'];
$akses=mysql_query("select id_level_brand from tab_user where username='$username'");
$akses1=mysql_fetch_array($akses);
$level=$akses1[id_level_brand];

$akses4=mysql_query("select id_level_brand_pa from tab_user where username='$username'");
$akses5=mysql_fetch_array($akses4);
$level2=$akses5[id_level_brand_pa];
$propinsi=$_GET['tipe'];
if($propinsi == "")
{
	$brand = mysql_query("SELECT distinct brand FROM bs_stok order by sortbrand ASC");
}
else
{
if($propinsi=='BIKE' or $propinsi=='FRAME AND FORK')
{
	$brand = mysql_query("SELECT distinct brand FROM bs_stok WHERE tipe ='$propinsi' and brand NOT IN (SELECT nama_brand from grup_brand where id_level_brand='$level') and status !='0' order by sortbrand ASC");
}
else
{
	$brand = mysql_query("SELECT distinct brand FROM bs_stok WHERE tipe ='$propinsi' and brand NOT IN (SELECT nama_brand from grup_brand_pa where id_level_brand_pa='$level2') and status !='0' order by sortbrand ASC");
}
}
echo"<option value=\"\" selected>ALL BRAND</option>";
while($k = mysql_fetch_array($brand)){
    echo "<option value=\"".$k['brand']."\">".$k['brand']."</option>\n";
}
?>
