16) { alert("이미지 파일만 업로드 할 수 있습니다."); } } } elseif ($bn_content_type === 'video') { // 동영상 파일 검증 if ($bn_video_file || $bn_video_name) { if (!preg_match('/\.(mp4|mkv|mov|avi|webm|flv|wmv|m4v)$/i', $bn_video_name)) { alert("동영상 파일(MP4, MKV, MOV, AVI, WebM, FLV, WMV, M4V)만 업로드 할 수 있습니다."); } } } elseif ($bn_content_type === 'video_url') { // URL 검증 if (!$bn_video_url) { alert("비디오 URL을 입력하세요."); } } elseif ($bn_content_type === 'youtube') { // 유튜브 URL 검증 if (!$bn_youtube_url) { alert("유튜브 URL을 입력하세요."); } } elseif ($bn_content_type === 'vimeo') { // 비메오 URL 검증 if (!$bn_vimeo_url) { alert("비메오 URL을 입력하세요."); } } $bn_url = isset($bn_url) ? clean_xss_tags($bn_url) : ''; $bn_alt = isset($bn_alt) ? (function_exists('clean_xss_attributes') ? clean_xss_attributes(strip_tags($bn_alt)) : strip_tags($bn_alt)) : ''; $bn_alt2 = isset($bn_alt2) ? (function_exists('clean_xss_attributes') ? clean_xss_attributes(strip_tags($bn_alt2)) : strip_tags($bn_alt2)) : ''; $bn_alt3 = isset($bn_alt3) ? (function_exists('clean_xss_attributes') ? clean_xss_attributes(strip_tags($bn_alt3)) : strip_tags($bn_alt3)) : ''; $bn_alt4 = isset($bn_alt4) ? (function_exists('clean_xss_attributes') ? clean_xss_attributes(strip_tags($bn_alt4)) : strip_tags($bn_alt4)) : ''; if(isset($_POST['bn_position_use']) && $_POST['bn_position_use']) { $bn_position = $_POST['bn_position_use']; } else { $bn_position = $_POST['bn_position']; } if ($w == "") { // 콘텐츠 유형별 필수 검사 if ($bn_content_type === 'image' && !$bn_bimg_name) { alert('배너 이미지를 업로드 하세요.'); } if ($bn_content_type === 'video' && !$bn_video_name) { alert('동영상 파일을 업로드 하세요.'); } if ($bn_content_type === 'video_url' && !$bn_video_url) { alert('비디오 URL을 입력하세요.'); } if ($bn_content_type === 'youtube' && !$bn_youtube_url) { alert('유튜브 URL을 입력하세요.'); } if ($bn_content_type === 'vimeo' && !$bn_vimeo_url) { alert('비메오 URL을 입력하세요.'); } sql_query("ALTER TABLE rb_banner AUTO_INCREMENT=1"); $sql = "INSERT INTO rb_banner SET bn_alt = '$bn_alt', bn_alt2 = '$bn_alt2', bn_alt3 = '$bn_alt3', bn_alt4 = '$bn_alt4', bn_url = '$bn_url', bn_device = '$bn_device', bn_content_type = '$bn_content_type', bn_video_url = '$bn_video_url', bn_youtube_url = '$bn_youtube_url', bn_vimeo_url = '$bn_vimeo_url', bn_position = '$bn_position', bn_border = '$bn_border', bn_radius = '$bn_radius', bn_ad_ico = '$bn_ad_ico', bn_new_win = '$bn_new_win', bn_begin_time = '$bn_begin_time', bn_end_time = '$bn_end_time', bn_time = '$now', bn_hit = '0', bn_order = '$bn_order'"; sql_query($sql); $bn_id = sql_insert_id(); } elseif ($w == "u") { $sql = "UPDATE rb_banner SET bn_alt = '$bn_alt', bn_alt2 = '$bn_alt2', bn_alt3 = '$bn_alt3', bn_alt4 = '$bn_alt4', bn_url = '$bn_url', bn_device = '$bn_device', bn_content_type = '$bn_content_type', bn_video_url = '$bn_video_url', bn_youtube_url = '$bn_youtube_url', bn_vimeo_url = '$bn_vimeo_url', bn_position = '$bn_position', bn_border = '$bn_border', bn_radius = '$bn_radius', bn_ad_ico = '$bn_ad_ico', bn_new_win = '$bn_new_win', bn_begin_time = '$bn_begin_time', bn_end_time = '$bn_end_time', bn_order = '$bn_order' WHERE bn_id = '$bn_id'"; sql_query($sql); } elseif ($w == "d") { @unlink(G5_DATA_PATH."/banners/$bn_id"); $sql = "DELETE FROM rb_banner WHERE bn_id = $bn_id"; $result = sql_query($sql); } if ($w == "" || $w == "u") { // 콘텐츠 유형에 따라 파일 업로드 if ($bn_content_type === 'image') { if (isset($_FILES['bn_bimg']['name']) && $_FILES['bn_bimg']['name']) { rb_upload_files($_FILES['bn_bimg']['tmp_name'], $bn_id, G5_DATA_PATH."/banners"); } } elseif ($bn_content_type === 'video') { if (isset($_FILES['bn_video_file']['name']) && $_FILES['bn_video_file']['name']) { rb_upload_files($_FILES['bn_video_file']['tmp_name'], $bn_id, G5_DATA_PATH."/banners"); } } // 나머지 타입(video_url, youtube, vimeo)은 파일 업로드 필요 없음 (URL만 저장) goto_url("./banner_form.php?w=u&bn_id=$bn_id"); } else { goto_url("./banner_list.php"); } ?>