예약을 3일후에 신청 할수 있게 바꾸고 싶습니다.

예약을 3일후에 신청 할수 있게 바꾸고 싶습니다.

QA

예약을 3일후에 신청 할수 있게 바꾸고 싶습니다.

본문

신청되는 날짜가 현재날짜 기준으로 다음날부터 신청이 가능한데요..

이 신청할수 있는 날짜를 현재기준으로 내일이 아닌 3일후 신청으로 수정하고 싶습니다.

도와주세요~

 

 

////////       현재 소스    //////////////

 

<?php
include_once('../include/common.php');
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
$g5['title'] = "대관신청";
include_once(G5_PATH.'/head.php');

if(!$year) $year=date('Y');
if(!$month) $month=date('n');

if($month==1) {
    $year1 = $year-1;
    $month1 = 12;
} else {
    $year1 = $year;
    $month1 = $month-1;
}
if($month==12) {
    $year2 = $year+1;
    $month2 = 1;
} else {
    $year2 = $year;
    $month2 = $month+1;
}
$s_date = date('Y-m-d',strtotime("$year-$month-01"));
$e_date = date('Y-m-t',strtotime("$year-$month-01"));

// 휴무일 설정 달력 표기
$holidata = array();
$hque = "SELECT * from dj_holiday where hd_date>='$s_date' and hd_date<='$e_date' and hd_type=2";
$hsql = sql_query($hque);
while($hrow = sql_fetch_array($hsql)) {
    $holidata[date('j',strtotime($hrow['hd_date']))] = $hrow['hd_name'];
}

$data = array();
$que = "SELECT * from dj_space_request where sr_date>='$s_date' and sr_date<='$e_date' order by sr_date, sr_hour1, sr_hour2, sr_space";
$sql = sql_query($que);
while($row = sql_fetch_array($sql)) {
    $data[date('j',strtotime($row['sr_date']))] .= '<a href="#"><li class="rsv_txt03 rsv_'.$a_sr_state_en[$row['sr_state']].'">'.$a_sr_space[$row['sr_space']].'<br>'.substr($row['sr_hour1'],0,-3).'~'.substr($row['sr_hour2'],0,-3).'<br>'.$row['sr_name'].'</li></a>';
}

//이름에 별표 추가
function name_to_star($name){
    if(!trim($name)) return '';
    $length = mb_strlen($name);
    $first = mb_substr($name, 0, 1);
    $tails = mb_substr($name, 2, $length-2);
    return $first.'*'.$tails;
}
//전화번호에 뒷자리만 추출
function get_last_num($ph){
    if(!trim($ph)) return '';    
    $arr = explode('-', $ph);
    if(count($arr) < 1) return '';
    $phone = $arr[count($arr)-1];
    $first = substr($phone, 0, 1);
    $tails = substr($phone, 2, strlen($phone)-2);
    return '('.$first.'*'.$tails.')';
}

/*function plus_day($day) {
return mktime(0,0,0,date("m"),date("d")+$day,date("Y"));
}*/
?>
<!--'.$row['sr_name'].'-->
<style>
.organization { width:847px;}
.organization img { width:100%;}
.organization .pc { display:block;}
.organization .mo { display:none;}

.txt_01 { border:2px solid #dddddd; background:#ffffff; padding:20px; box-sizing:border-box; width:100%;}
.txt_01 ul {}
.txt_01 ul li { font-size:13px !important; line-height:24px !important; padding:0 0px;}

.txt_red { color:#ea2006;}
.txt_orange { color:#f2510a;}
.txt_blue { color:#1c6ed3;}


.list_tit {}
.list_tit ul{}
.list_tit ul li{ font-size:14px !important; line-height:24px !important; color:#666666;}
.txt_left{text-align:left !important;}
.txt_center{text-align:center !important}
.txt_right{text-align:right !important}
.list{clear:both;width:100%;color:#353535;border-top:2px solid #aeb3ba;border-bottom:1px solid #d7d7d7;line-height:1.5;margin-bottom:20px;margin-top:0px}
.list thead th{text-align:center;font-weight:600;border-bottom:1px solid #d7d7d7;border-right:1px solid #d7d7d7;padding:12px 0;color:#333;background:#f7f7f7;font-size:14px}
.list th{text-align:center;font-weight:600;border-bottom:1px solid #d7d7d7;border-right:1px solid #d7d7d7;padding:12px 0;color:#333;background:#f7f7f7;font-size:14px}
.list th.th{text-align:center;font-weight:600;border-bottom:1px solid #d7d7d7;border-right:1px solid #d7d7d7;padding:12px 0;color:#333;background:#fff;font-size:36px}
.list td{text-align:center;padding:12px 10px;letter-spacing:0;border-bottom:1px solid #d7d7d7;border-right:1px solid #d7d7d7;vertical-align:middle;font-size:14px;border-left:1px solid #d7d7d7;}
.list td:first-child {border-left:0px solid #d7d7d7;}
.list td a{color:#353535;}
.list td a:hover{color:#217fff}
.list .r_none{border-right:none}
.list .w_txt{padding:0 5px; background:#ffffff; border:1px solid #dddddd; height:35px;}
.list .wide { width:100%;}
.list .txt_left{padding:12px 12px;}
.list input, .list select, .list img{vertical-align:middle;color:#666;font-size:12px}
.list .first{border-top:1px solid #83a0da;}
.list td ul li{font-size:16px;line-height:22px}
.list td .bl3 { font-size:14px !important; font-weight:bold;vertical-align:middle; margin:0;}
.list td span { display:block;}
.list td span.cont_01 { font-size:14px; padding:4px 5px;}
.list td span.cont_02 { font-size:13px; padding:0 18px;}
.list th span.cont_03 { font-size:12px; display:block; letter-spacing:-1px;}

.list input[type=text] {}
.list input[type=radio] { width:18px; margin-top:-4px;}
.list input[type=checkbox] {border:1px solid #dddddd !important; border-radius:0 !important;}
.list select { font-size:14px; padding:0 10px 3px !important;}
.list textarea { height:100px !important;}

.list input[type="checkbox"] + label {color:#676e70}
.list input[type="checkbox"] + label:hover {color:#2172f8}
.list input[type="checkbox"] + label span {position:absolute;top:20px;right:15px;width:17px;height:17px;display:block;background:#fff;border:1px solid #dddddd;border-radius:0px}
.list input[type="checkbox"]:checked + label {color:#000}
.list input[type="checkbox"]:checked + label span {background:url('./img/chk.png') no-repeat 50% 50% #3a8afd;border-color:#1471f6;border-radius:0px}
.list.chk_all input[type="checkbox"] + label span {top:18px}

.button6{display:block;height:30px;line-height:30px;font-size:13px;vertical-align:middle;background:#007dac;color:#ffffff;}
.button6 a{white-space:nowrap;font-size:13px;font-weight:bold;color:#fff !important;cursor:pointer;padding:0 10px;height:30px;line-height:30px;display:block;}
.button6_gray{background:#999999;}
.button6_red{background:#f13509;}

.list_btn { border-top:1px solid #dddddd; margin-top:30px; padding-top:30px;}
.list_btn ul { }
.list_btn ul li { font-size:16px !important; background:#f13509; width:200px; height:45px; line-height:43px !important; color:#ffffff; text-align:center;display:block; margin:0 auto;}

.required2 { font-size:12px; position:absolute; color:#f13509; margin-top:-5px;}

.fl{float:left;}
.fr{float:right}

.bl3{background:url(/images/bul_01.gif) no-repeat 0 10px;padding-left:12px}

@media screen and (max-width:768px) {
    .organization { width:100%;}
    .organization .pc { display:none;}
    .organization .mo { display:block;}
}
@media screen and (max-width:1100px) {
    .organization { width:100%;}
}
</style>

        <div class="col-lg-12 col-md-12">


            <div class="txt_01">
                <ul>
                    <li>하단 공간안내 내용을 꼭 숙지하시고, 대관신청을 해주시기 바랍니다.</li>
                    <li>행사명에 공간 사용 내용을 자세히 적어 주세요(행사명, 스터디 내용, 세미나명, 모임 주제 등)</li>
                </ul>
            </div>

            <div class="row mt-70 mb-40">
              <div class="col-lg-12 col-md-12">
                <h5><i class="fa fa-plus-circle"></i> 대관 신청</h5>
                <div class="divider mt-20 mb-20"></div>
                    <div class="date_default" id="calendar">
                        <h6><a href="?year=<? echo $year1; ?>&month=<? echo $month1; ?>#calendar"><span class="left_arrow"><i class="fa fa-angle-left"></i></span></a><? echo $year?>년 <? echo $month?>월<a href="?year=<? echo $year2; ?>&month=<? echo $month2; ?>#calendar"><span class="right_arrow"><i class="fa fa-angle-right"></i></span></a></h6>
                    </div>
                    <div class="state_box">
                        <ul>
                            <li><span class="rsv_box rsv_wait"></span>승인대기 상태</li>
                            <li><span class="rsv_box rsv_finish"></span>승인완료 상태</li>
                            <li><span class="rsv_box rsv_cancel"></span>승인취소 상태</li>
                        </ul>
                    </div>
                    <table class="calendar-table">
                    <colgroup>
                        <col width="14.28%">
                        <col width="14.28%">
                        <col width="14.28%">
                        <col width="14.28%">
                        <col width="14.28%">
                        <col width="14.28%">
                        <col width="14.28%">
                    </colgroup>
                        <thead>
                               <tr>
                                <th class="text-center">일</th>
                                <th class="text-center">월</th>
                                <th class="text-center">화</th>
                                <th class="text-center">수</th>
                                <th class="text-center">목</th>
                                <th class="text-center">금</th>
                                <th class="text-center">토</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                            <?
                                $week1 = date('w',strtotime("$year-$month-01"));
                                $day1 = date('t',strtotime("$year1-$month1-01")) - $week1 + 1;
                                for($i=0; $i<$week1; $i++) {
                                    echo '<td class="text-left gone">'.$day1.'</td>';
                                    $day1++;
                                }

                                $totime = mktime(0,0,0,date('m'),date('d'),date('Y'));
                                for($i=1; $i<=date('t',strtotime("$year-$month-01")); $i++) {
                                    $time = strtotime("$year-$month-$i");
                                    if(date('w',$time) == 0) {
                                        echo "</tr><tr>";
                                    }
                            ?>
                                <td class="text-left"><? echo $i?> <span style="float:right"><? echo $holidata[$i] ?></span>
                                <div class="space_rsv">
                                      <ul>
                                        <? if($time <= $totime || date('w',$time)==1 || $holidata[$i]) { ?>
                                        <a href="javscript:"><li class="rsv_txt01"><? date("Y-m-d", strtotime("+3 day")); ?>예약불가</li></a>
                                        <? } else { ?>
                                        <a href="./space_form.php?sp_date=<? echo $year.'-'.$month.'-'.$i; ?>"><li class="rsv_txt02">예약가능</li></a>
                                        <? } ?>
                                        <? echo $data[$i] ?>
                                    </ul>
                                </div>
                                </td>
                            <? } ?>
                            <?
                                $week2 = date('w',strtotime("$year2-$month2-01"));
                                if($week2>0) {
                                    $day2 = 1;
                                    for($i=$week2; $i<7; $i++) {
                                        echo '<td class="text-left gone">'.$day2.'</td>';
                                        $day2++;
                                    }
                                }
                            ?>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>

        </div>


<?php
include_once(G5_PATH.'/tail.php');
?>

이 질문에 댓글 쓰기 :

답변 2

이걸 한번 참고해 보세요~

 

<?php
include_once('../include/common.php');
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
$g5['title'] = "대관신청";
include_once(G5_PATH.'/head.php');

if(!$year) $year=date('Y');
if(!$month) $month=date('n');

if($month==1) {
    $year1 = $year-1;
    $month1 = 12;
} else {
    $year1 = $year;
    $month1 = $month-1;
}
if($month==12) {
    $year2 = $year+1;
    $month2 = 1;
} else {
    $year2 = $year;
    $month2 = $month+1;
}
$s_date = date('Y-m-d',strtotime("$year-$month-01"));
$e_date = date('Y-m-t',strtotime("$year-$month-01"));

// 휴무일 설정 달력 표기
$holidata = array();
$hque = "SELECT * from dj_holiday where hd_date>='$s_date' and hd_date<='$e_date' and hd_type=2";
$hsql = sql_query($hque);
while($hrow = sql_fetch_array($hsql)) {
    $holidata[date('j',strtotime($hrow['hd_date']))] = $hrow['hd_name'];
}

$data = array();
$que = "SELECT * from dj_space_request where sr_date>='$s_date' and sr_date<='$e_date' order by sr_date, sr_hour1, sr_hour2, sr_space";
$sql = sql_query($que);
while($row = sql_fetch_array($sql)) {
    $data[date('j',strtotime($row['sr_date']))] .= '<a href="#"><li class="rsv_txt03 rsv_'.$a_sr_state_en[$row['sr_state']].'">'.$a_sr_space[$row['sr_space']].'<br>'.substr($row['sr_hour1'],0,-3).'~'.substr($row['sr_hour2'],0,-3).'<br>'.$row['sr_name'].'</li></a>';
}

//이름에 별표 추가
function name_to_star($name){
    if(!trim($name)) return '';
    $length = mb_strlen($name);
    $first = mb_substr($name, 0, 1);
    $tails = mb_substr($name, 2, $length-2);
    return $first.'*'.$tails;
}
//전화번호에 뒷자리만 추출
function get_last_num($ph){
    if(!trim($ph)) return '';    
    $arr = explode('-', $ph);
    if(count($arr) < 1) return '';
    $phone = $arr[count($arr)-1];
    $first = substr($phone, 0, 1);
    $tails = substr($phone, 2, strlen($phone)-2);
    return '('.$first.'*'.$tails.')';
}

// 현재 날짜로부터 3일 후의 날짜 계산
$next_available_date = date('Y-m-d', strtotime('+3 days'));

// 신청 가능한 날짜를 3일 후로 변경
$s_date = $next_available_date;
$e_date = date('Y-m-t', strtotime($next_available_date));

?>
 

  <? if($time <= $totime || date('w',$time)==1 || $holidata[$i]) { ?>

이걸 수정 하면 됩니다

답변을 작성하시기 전에 로그인 해주세요.
전체 0 | RSS
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT