// 기본 설정 로딩
require_once('config.php');
require_once('function.php');
require_once('lib.php');
//HTML 시작
$chiba_vpn="select count(*) as mkcount from servicedb where service_line = 'vpn' and service_status = 'o' and Client_Code = '$_GET[client_code]'";
$chivpn = @mysql_query($chiba_vpn , $db_connect) or die($db_q_error);
$datachivpn=mysql_fetch_assoc($chivpn);
$chiba_query="select
(select count(*) from servicedb where service_line = 'normal' and service_status = 'o' and service_sw between 'C00%' and 'C49%' and Client_Code = '$_GET[client_code]') as chiba_01_normal,
(select count(*) from servicedb where service_line = 'defence' and service_status = 'o' and service_sw between 'C00%' and 'C49%' and Client_Code = '$_GET[client_code]') as chiba_01_defence,
(select count(*) from servicedb where service_line = 'solo' and service_status = 'o' and Client_Code = '$_GET[client_code]') as chiba_solo,
(select count(*) from servicedb where service_line = 'test' and service_status = 'o' and service_sw between 'C00%' and 'C49%' and Client_Code = '$_GET[client_code]') as chiba_01_test,
(select count(*) from servicedb where service_line = 'event' and service_status = 'o' and service_sw between 'C00%' and 'C49%' and Client_Code = '$_GET[client_code]') as chiba_01_event,
(select count(*) from servicedb where service_line = 'substitution' and service_status = 'o' and service_sw between 'C00%' and 'C49%' and Client_Code = '$_GET[client_code]') as chiba_01_substitution,
(select count(*) from servicedb where service_line = 'normal' and service_status = 'o' and service_sw between 'C50%' and 'C79%' and Client_Code = '$_GET[client_code]') as chiba_02_normal,
(select count(*) from servicedb where service_line = 'defence' and service_status = 'o' and service_sw between 'C50%' and 'C79%' and Client_Code = '$_GET[client_code]') as chiba_02_defence,
(select count(*) from servicedb where service_line = 'test' and service_status = 'o' and service_sw between 'C50%' and 'C79%' and Client_Code = '$_GET[client_code]') as chiba_02_test,
(select count(*) from servicedb where service_line = 'event' and service_status = 'o' and service_sw between 'C50%' and 'C79%' and Client_Code = '$_GET[client_code]') as chiba_02_event,
(select count(*) from servicedb where service_line = 'substitution' and service_status = 'o' and service_sw between 'C50%' and 'C79%' and Client_Code = '$_GET[client_code]') as chiba_02_substitution";
$chiba = @mysql_query($chiba_query , $db_connect) or die($db_q_error);
$data_chiba=mysql_fetch_assoc($chiba);
$tokyo_query="select
(select count(*) from servicedb where service_line = 'normal' and service_status = 'o' and service_sw between 'C80%' and 'C99%' and Client_Code = '$_GET[client_code]') as normal,
(select count(*) from servicedb where service_line = 'defence' and service_status = 'o' and service_sw between 'C80%' and 'C99%' and Client_Code = '$_GET[client_code]') as defence,
(select count(*) from servicedb where service_line = 'test' and service_status = 'o' and service_sw between 'C80%' and 'C99%' and Client_Code = '$_GET[client_code]') as test,
(select count(*) from servicedb where service_line = 'event' and service_status = 'o' and service_sw between 'C80%' and 'C99%' and Client_Code = '$_GET[client_code]') as event,
(select count(*) from servicedb where service_line = 'substitution' and service_status = 'o' and service_sw between 'C80%' and 'C99%' and Client_Code = '$_GET[client_code]') as substitution";
$tokyo = @mysql_query($tokyo_query , $db_connect) or die($db_q_error);
$data_tokyo=mysql_fetch_assoc($tokyo);
$coupon_query="select service_line, client_code , sum(coupon) From servicedb where service_line NOT IN ( 'vpn', 'test','soloLine','substitution','event' ) and client_code = '$_GET[client_code]'";
$data_coupon = @mysql_query($coupon_query , $db_connect) or die($db_q_error);
$coupon=mysql_fetch_assoc($data_coupon);
if ( $coupon['sum(coupon)'] == NULL ) {$coupon['sum(coupon)'] = 0;}
?>
| 도쿄 |
치바 |
VPN |
| =$data_tokyo[normal]+$data_tokyo[defence]?> |
=$data_chiba[chiba_01_normal]+$data_chiba[chiba_02_normal]+$data_chiba[chiba_01_defence]+$data_chiba[chiba_02_defence]+$data_chiba[chiba_solo]?> |
=$datachivpn[mkcount]?> |
| 일반 |
방어 |
전용 |
이벤트 |
| =$data_tokyo[normal]+$data_chiba[chiba_01_normal]+$data_chiba[chiba_02_normal]?> |
=$data_tokyo[defence]+$data_chiba[chiba_01_defence]+$data_chiba[chiba_02_defence]?> |
=$data_chiba[chiba_solo]?> |
=$data_tokyo[event]+$data_chiba[chiba_01_event]+$data_chiba[chiba_02_event]?> |
| 테스트 |
대체 |
장기할인 |
쿠폰 |
| =$data_tokyo[test]+$data_chiba[chiba_01_test]+$data_chiba[chiba_02_test]?> |
=$data_tokyo[tokyo_substitution]+$data_chiba[chiba_01_substitution]+=$data_chiba[chiba_02_substitution]?> |
$discount_query="select * from servicedb where client_code='$_GET[client_code]' and service_line NOT IN ( 'vpn', 'test', 'event' ) order by service_open_date asc";
$discount = @mysql_query($discount_query , $db_connect) or die($db_q_error);
$data_discount=mysql_fetch_assoc($discount);
//$oneyears = date("Y-m-d", mktime(0,0,0,date(m),date(d),date(Y)-1));
$server_date= explode('-', $data_discount['service_open_date']);
$server_timestamp = mktime('0','0','0',$server_date[1],$server_date[2],$server_date[0]);
$today_timestamp = mktime();
$oneyears = $today_timestamp - 32676480;
$twoyears = $today_timestamp - 65352960;
$threeyears = $today_timestamp - 98029440;
//echo $today_timestamp;
//echo "/";
//echo $oneyears;
$mk_sum=$today_timestamp - $server_timestamp ;
if ( $mk_sum >= 163382400 ){$dis_cnt="30";}
elseif ( $mk_sum >= 130705920 ){$dis_cnt="25";}
elseif ( $mk_sum >= 98029440 ){$dis_cnt="20";}
elseif ( $mk_sum >= 65352960 ) {$dis_cnt="15";}
elseif ( $mk_sum >= 32676480 ) {$dis_cnt="10";}
else {$dis_cnt="0";}
if ($server_timestamp == '0') {$dis_cnt="0";}
//if $data_discount['service_open_date']
?>
=$dis_cnt?> % |
=$coupon['sum(coupon)']?> |
//DB닫기
mysql_close($db_connect);
?>