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

//HTML 시작

?>
<!-- Start Base -->
<div id='base'>
<!-- Start Container -->
<div id='container'>



<?
//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]' $option2 or receiver like '전체' and read_check like '0' order by num desc";
//$query2="select * from commentdb where receiver like '$_GET[name]' or receiver like '2팀' or receiver like '팀장' or receiver like '시스템' or receiver like '전체' and read_check like '0' order by num desc";
//$query2="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";
$query2 = "select * from commentdb where (receiver like '$_GET[name]' and read_check like '0') $option2 order by num desc";
$total = mysql_num_rows(mysql_query($query2, $db_connect));
$total == "0" ? $newicon = "" : $newicon = "<img src=/new-icon.gif border=0><object width=0 height=0 data=\"/jarvis_email.mp3\" type=\"audio/mpeg\"></object>"
//if (isset($_SERVER['HTTP_REFERER']) && preg_match('@^[^/]+://[^/]+@', $_SERVER['HTTP_REFERER'], $match)) {}
//    var_dump($match[0]);

?>
<?
/*
preg_match('@^(?:[url]http://)?([/url][^/]+)@i',"http://www.php.net/index.html", $matches);
$host = $matches[1];

preg_match('/[^.]+\.[^.]+$/', $host, $matches);
echo "domain name is: {$matches[0]}\n";

extract(parse_url($_SERVER['HTTP_REFERER']));

echo $scheme .'://'. $host;
 */
//echo $_GET['HTTP_HOST'];
?>


<div class="row">
    <div class="col-lg-3 col-md-6">
        <div class="panel panel-primary" onclick="location.href='/commentList.cm#receive';" style="cursor: pointer;">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-3">
                        <i class="fa fa-comments fa-5x"></i>
                    </div>
                    <div class="col-xs-9 text-right">
                        <div class="huge"><?=$newicon?><font color=white><?=$total?></font></div>
                        <div>새 쪽지 알림</div>
                    </div>
                </div>
            </div>
            <a href="#">
                <div class="panel-footer">
                    <span class="pull-left">자세히보기</span>
                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                    <div class="clearfix"></div>
                </div>
            </a>
        </div>
    </div>

<?
$day7_server_query = "select service_status,service_open_date,service_line from servicedb where service_open_date > DATE_ADD(now(), INTERVAL -7 DAY) and service_status = 'o' and service_line not in ('test','substitution')";
$day7_server = mysql_num_rows(mysql_query($day7_server_query, $db_connect));
?>

    <div class="col-lg-3 col-md-6">
        <div class="panel panel-yellow" onclick="location.href='/serviceList.sev';" style="cursor: pointer;">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-3">
                        <i class="fa fa-plus-square-o fa-5x"></i>
                    </div>
                    <div class="col-xs-9 text-right">
                        <div class="huge"><?=$day7_server?></div>
                        <div>최근 7일간 신규서버 대수</div>
                    </div>
                </div>
            </div>
            <a href="#">
                <div class="panel-footer">
                    <span class="pull-left">자세히보기</span>
                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                    <div class="clearfix"></div>
                </div>
            </a>
        </div>
    </div>


    <div class="col-lg-3 col-md-6">
        <div class="panel panel-green">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-3">
                        <i class="fa fa-tasks fa-5x"></i>
                    </div>
                    <div class="col-xs-9 text-right">
                        <div class="huge">0</div>
                        <div>요청업무 알림</div>
                    </div>
                </div>
            </div>
            <a href="#">
                <div class="panel-footer">
                    <span class="pull-left">자세히보기</span>
                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                    <div class="clearfix"></div>
                </div>
            </a>
        </div>
    </div>


<?
$deposit_server_query = "select client_code,service_status,service_payment_date,service_line from servicedb where service_payment_date < now() and service_status = 'o' and service_line not in ('test','substitution') and client_code not in ('C116','C012','C219','')";
$deposit_server = mysql_num_rows(mysql_query($deposit_server_query, $db_connect));
?>

    <div class="col-lg-3 col-md-6">
        <div class="panel panel-red" onclick="location.href='/IdcDepositNonPaymentListMK.dep';" style="cursor: pointer;">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-3">
                        <i class="fa fa-support fa-5x"></i>
                    </div>
                    <div class="col-xs-9 text-right">
                        <div class="huge"><?=$deposit_server?></div>
                        <div>금일 기준 미납 서버</div>
                    </div>
                </div>
            </div>
            <a href="#">
                <div class="panel-footer">
                    <span class="pull-left">자세히보기</span>
                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                    <div class="clearfix"></div>
                </div>
            </a>
        </div>
    </div>
</div>










</div>
<!-- End Container -->
<!-- Start Footer -->
<div id='footer'></div>
<!-- End Footer -->
</div>
<!-- End Base -->
<?
//DB닫기
mysql_close($db_connect);
?>
