<?
// 기본 설정 로딩
require_once 'config.php';
require_once 'function.php';
require_once 'lib.php';

//HTML 시작

?>
<!-- Start Base -->


<?
//if ($_GET[page]=='default'){$option='limit 0,5';} else { $option='';}

switch ($_GET[name]) {
    case '송충호':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '김효영':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
        break;
    #1팀
    case '신인철':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '박요한':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '이지승':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '조준희':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '김대영':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    #2팀
    case '김용민':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '이풍호':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '강부중':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '김은혁':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '김영석':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) ";
        break;
    #기타
    case '고병남':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '최진호':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '영업' and read_check not like ('%,$_GET[name]%')) ";
        break;
    #알바
    case '류축복':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '박소영':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '이민제':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
        break;
    case '류은총':$option2 = "or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) ";
        break;
/*
#기타
case '김효영': $option2="or receiver like '영업'";break;
#1팀
case '신인철': $option2="or receiver like '1팀' or receiver like '팀장' or receiver like '네트워크'";break;
case '박요한': $option2="or receiver like '1팀' or receiver like '영업' or receiver like '네트워크'";break;
case '이지승': $option2="or receiver like '1팀' or receiver like '시스템'";break;
case '조준희': $option2="or receiver like '1팀' or receiver like '네트워크'";break;
case '김대영': $option2="or receiver like '1팀' or receiver like '네트워크'";break;
#2팀
case '김용민': $option2="or receiver like '2팀' or receiver like '팀장' or receiver like '시스템'";break;
case '이풍호': $option2="or receiver like '2팀' or receiver like '네트워크'";break;
case '강부중': $option2="or receiver like '2팀' or receiver like '네트워크'";break;
case '김은혁': $option2="or receiver like '2팀' or receiver like '영업' or receiver like '네트워크'";break;
case '김영석': $option2="or receiver like '2팀' or receiver like '시스템'";break;
#기타
case '고병남': $option2="or receiver like '영업' or receiver like '팀장'";break;
case '최진호': $option2="or receiver like '영업'";break;
#알바
case '류축복': $option2="or receiver like '알바'";break;
case '박소영': $option2="or receiver like '알바'";break;
case '이민제': $option2="or receiver like '알바'";break;
case '류은총': $option2="or receiver like '알바'";break;
 */
    default:$option2 = '';
        break;
}

//$query="select * from commentdb where (receiver like '$_GET[name]' and read_check like '0') or (receiver like '2팀'and read_check not like ('%,$_GET[name]%')) or (receiver like '팀장'and read_check not like ('%,$_GET[name]%')) or (receiver like '시스템'and read_check not like ('%,$_GET[name]%')) or (receiver like '전체' and read_check not like ('%,$_GET[name]%')) or (receiver like '알바' and read_check not like ('%,$_GET[name]%')) or (receiver like '네트워크' and read_check not like ('%,$_GET[name]%')) or (receiver like '1팀' and read_check not like ('%,$_GET[name]%')) order by num desc";
$query = "select * from commentdb where (receiver like '$_GET[name]' and read_check like '0') $option2 order by num desc";
$total = mysql_num_rows(mysql_query($query, $db_connect));
$total == "0" ? $newicon = "" : $newicon = "<img src=/new-icon.gif border=0>";
$result = @mysql_query($query, $db_connect) or die($db_q_error);

?>
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                <i class="fa fa-envelope fa-fw"></i>  <i class="fa fa-caret-down"></i><?=$newicon?>
            </a>
<ul class="dropdown-menu dropdown-messages">
<?
for ($i = 0; $i < $total; $i++) {
    $data = mysql_fetch_assoc($result);
    ?>
                <li>
                    <a href="#">
                        <div>
                            <strong><?=$data[ID]?></strong>
                            <span class="pull-right text-muted">
                                <em><?=$data[write_date]?></em>
                            </span>
                        </div>
                        <div><a href="http://<?=$_SERVER['HTTP_HOST']?>:6752/commentList.cm#receive"><?=nl2br($data[content])?></a></div>
                    </a>
                </li>
                <li class="divider"></li>
<?}?>
                <li>
                    <a class="text-center" href="#">
                        <strong><a href="http://<?=$_SERVER['HTTP_HOST']?>:6752/commentList.cm#receive">Read All Messages</a></strong>
                        <i class="fa fa-angle-right"></i>
                    </a>
                </li>
            </ul>




<!-- End Container -->
<?
//DB닫기
mysql_close($db_connect);
?>
<!--<div id='exec_time'><?=sprintf('%0.3f', getmicrotime() - $MK_start)?> sec</div>-->
