팝업창 하루동안띄우지않기해도 계속 띄워져서요..ㅠㅠ

팝업창 하루동안띄우지않기해도 계속 띄워져서요..ㅠㅠ

QA

팝업창 하루동안띄우지않기해도 계속 띄워져서요..ㅠㅠ

본문


<?
///레이어보기
function view_layer($no){
global $g4;

$sql="select * from {$g4[site_popup_table]} where no=$no ";
$result=mysql_query($sql);
$layer=mysql_fetch_array($result);
$title=stripslashes($layer[title]);
$check_input=$layer[check_input];
$content=nl2br(stripslashes($layer[content]));

$img_file=$layer[img_file];
$img_url=$layer[img_url];
$gigan=$layer[gigan];

$gigan_hour=$gigan*24; 
switch($gigan)
{
 case '1':
  $gigan_text="하루동안 보이지 않습니다";
  break;
 case '2':
  $gigan_text="이틀동안 보이지 않습니다";
  break;
 case '3':
  $gigan_text="사흘동안 보이지 않습니다";
  break;
 
 case '7':
  $gigan_text="일주일동안 보이지 않습니다";
  break;
 
 case '15':
  $gigan_text="보름동안 보이지 않습니다";
  break;
 
 case '0':
  $gigan_text="다음에 보이지 않습니다.";
  break;
 
 default:
  $gigan_text="하루동안 보이지 않습니다";
  break;
}

//----이미지파일을   너비/높이로.변경.... 
 if($layer[check_input]=="IMG" && $layer[img_file]){
 
 $size=GetImageSize($g4[path]."/popup_img/".$layer[img_file]);
 $width=$size[0];
 $height=$size[1];
 }else{
 $width=$layer[width];
 $height=$layer[height];
 
 }
if($img_url){
 $a_img_start="<a href='{$img_url}'>";
 $a_img_end="</a>";
}else{
 $a_img_start="";
 $a_img_end="";
}

?>
<div id="layer_<?=$no?>" style="position:absolute; left:<?=$layer[popup_left]?>px; top:<?=$layer[popup_top]?>px; width:<?=$width?>px; height:<?=$height?>px; z-index:<?=1000 +$no?>;filter:revealTrans(transition=23,duration=0.5) blendTrans(duration=0.5);cursor:hand;background-color:#FFFFFF"
onmouseover="dragObj=layer_<?=$no?>; drag=1;move=0" onmouseout="drag=0">
<table border=0 cellpadding=0 cellspacing=0>
<tr height=20 bgcolor=#000000>
<td colspan=2> <font color=#e1e1e1 class='font_11'>■</FONT> <font color=#ffffff class='font_11'><?=$title?></FONT></td>
</tr>
<tr valign=top >
 <td colspan=2>
<!--------------본문---------------->
<?if($check_input=="TEXT") { 
 ?>
<table border=0 cellpadding=0 cellspacing=0 width=<?=$width?> height=<?=$height?> >
<tr>
 <td valign=top><?=$content?></td>
</tr>
</table>
<? }//컨텐츠 끝?>
<?if($check_input=="IMG") { 
 ?>
<table border=0 cellpadding=0 cellspacing=0 width=<?=$width?> height=<?=$height?> >
<tr>
 <td align=center valign=top><?=$a_img_start?><img src="<?=$g4[path]?>/popup_img/<?=$img_file?>" border=0><?=$a_img_end?></td>
</tr>
</table>
<? }//이미지 끝?>
<!---------------본문 끝------------->
 </td>
</tr>
<tr height=20 bgcolor=#000000>
 <td>  
 <font color=#FFFFFF style='font-size:11px;font-family:돋움'><?=$gigan_text?></FONT> 
 <input type=checkbox name="gigan" value="<?=$gigan?>"
 onclick="set_cookie('cookie_<?=$no?>','Y', <?=$gigan_hour?>,'/');layer_<?=$no?>.style.display='none';" align=absmiddle>
   
 </td>
 <td align=right><span OnClick="layer_<?=$no?>.style.display='none';" style='cursor:hand'><img src='<?=$g4[path]?>/img/img_close_x.gif' border=0 align='absmiddle'></span>
  
 </td>
</tr>
</table>
</div>
<?
}//view_layer의 끝  
?>



소스입니다. ㅠㅠ

그알못이라 아무리 뒤져봐도모르겠네요..

고수님들의 도움이 필요합니다!

이 질문에 댓글 쓰기 :

답변 3


<?
ob_start();

include $g4[path]."/popup_layer.php";///layer함수
if(!$member[mb_level] || $member[mb_level]=="1"){///회원이 아닌경우[손님]

$sql="select * from  $g4[site_popup_table] where DATE_FORMAT(now(),'%Y-%m-%d') >= reg_date and  check_use='Y' and (level=0 or level=1)"; 
$result=mysql_query($sql);
$total_num=mysql_num_rows($result);
for($i=0;$row=mysql_fetch_array($result);$i++)
{
 
 
 
 
 $no=$row[no];
 $type=$row[type];
 $center=$row[center];
 //팝업의 쿠키가 발생했으면 PASS한다
 if($_COOKIE['cookie_'.$no]=='Y')continue; 
 
 //----이미지파일을   너비/높이로.변경.... 
 if($row[check_input]=="IMG" && $row[img_file]){
 
 $size=GetImageSize($g4[path]."/popup_img/".$row[img_file]);
 $width=$size[0];
 $height=$size[1] + 30;
 }else{
 $width=$row[width];
 $height=$row[height]+30;
 
 }

 if($type=="팝업창"){
  echo "<script language=\"javascript\">";
  if($row[menubar]=="Y"){ $menubar="yes";}else{ $menubar="no";}
  if($row[toolbar]=="Y"){ $toolbar="yes";}else{ $toolbar="no";}
  if($row[scrollbars]=="Y"){ $scrollbars="yes";}else{ $scrollbars="no";}
  if($row[resizable]=="Y"){ $resizable="yes";}else{ $resizable="no";}
  if($row[status]=="Y"){ $status="yes";}else{ $status="no";}
 
  
  if($center!="Y"){
  $popup_left=$row[popup_left];
  $popup_top=$row[popup_top];
  $option="menubar=$menubar,scrollbars=$scrollbars,status=$status,toolbar=$toolbar,resizable=$resizable,width=$width,height=$height,left=$popup_left,top=$popup_top";
  }else{?> 
 
  var left_pos_<?=$i?>,top_pos_<?=$i?>;
  left_pos_<?=$i?>=(screen.width-<?=$width?>)/2;
  top_pos_<?=$i?>=(screen.height-<?=$height?>)/2;
  <?
  $option="menubar=$menubar,scrollbars=$scrollbars,status=$status,toolbar=$toolbar,resizable=$resizable,width=$width,height=$height,left='+left_pos_{$i}+',top='+top_pos_{$i}+'"; 
  }//중앙정렬인경우의 끝
 
  echo "window.open('".$g4[path]."/popup_view.php?no=$no','new_win$i','$option');"; 
  echo "</script>";
 
 }else if($type=='레이어'){//레이어창일경우
 
  view_layer($no);
 }//레이어의끝
 
 
 
}


}else{//회원인경우--------------

$sql="select * from {$g4[site_popup_table]} where DATE_FORMAT(now(),'%Y-%m-%d') >= reg_date and check_use='Y' and (level=0 or level={$member[mb_level]})";
$result=mysql_query($sql,$connect_db);


for($i=0;$row=mysql_fetch_array($result);$i++)
{
   
 $no=$row[no];
 $type=$row[type];
 $center=$row[center];
 //팝업의 쿠키가 발생했으면 PASS한다
 if($_COOKIE['cookie_'.$no]=='Y')continue; 
 
 //----이미지파일을   너비/높이로.변경.... 
 if($row[check_input]=="IMG" && $row[img_file]){
 
 $size=GetImageSize($g4[path]."/popup_img/".$row[img_file]);
 $width=$size[0];
 $height=$size[1] + 30;
 }else{
 $width=$row[width];
 $height=$row[height]+30;
 
 }

 if($type=="팝업창"){
  echo "<script language=\"javascript\">";
  if($row[menubar]=="Y"){ $menubar="yes";}else{ $menubar="no";}
  if($row[toolbar]=="Y"){ $toolbar="yes";}else{ $toolbar="no";}
  if($row[scrollbars]=="Y"){ $scrollbars="yes";}else{ $scrollbars="no";}
  if($row[resizable]=="Y"){ $resizable="yes";}else{ $resizable="no";}
  if($row[status]=="Y"){ $status="yes";}else{ $status="no";}

  if($center!="Y"){
  $popup_left=$row[popup_left];
  $popup_top=$row[popup_top];
  $option="menubar=$menubar,scrollbars=$scrollbars,status=$status,toolbar=$toolbar,resizable=$resizable,width=$width,height=$height,left=$popup_left,top=$popup_top";
  }else{?> 
   var left_pos_<?=$i?>,top_pos_<?=$i?>;
  left_pos_<?=$i?>=(screen.width-<?=$width?>)/2;
  top_pos_<?=$i?>=(screen.height-<?=$height?>)/2;
  <?
  $option="menubar=$menubar,scrollbars=$scrollbars,status=$status,toolbar=$toolbar,resizable=$resizable,width=$width,height=$height,left='+left_pos_{$i}+',top='+top_pos_{$i}+'"; 
  }//중앙정렬인경우의 끝
  echo "window.open('".$g4[path]."/popup_view.php?no=$no','new_win$i','$option');"; echo "</script>";
 }else if($type=='레이어'){//레이어창일경우
  view_layer($no);
 }//레이어의끝
 
 
 
 
 
}//for문의끝

}//회원일경우끝
?>
<script language="javascript">
var x =0
var y=0
drag = 0
move = 0
window.document.onmousemove = mouseMove
window.document.onmousedown = mouseDown
window.document.onmouseup = mouseUp
window.document.ondragstart = mouseStop
function mouseUp() {
move = 0
}
function mouseDown() {
if (drag) {
clickleft = window.event.x - parseInt(dragObj.style.left)
clicktop = window.event.y - parseInt(dragObj.style.top)
dragObj.style.zIndex += 1
move = 1
}
}
function mouseMove() {
if (move) {
dragObj.style.left = window.event.x - clickleft
dragObj.style.top = window.event.y - clicktop
}
}
function mouseStop() {
window.event.returnValue = false
}
function Show(divid)
{
divid.filters.blendTrans.apply();
divid.style.visibility = "visible";
divid.filters.blendTrans.play();
}
function Hide(divid) {
divid.filters.blendTrans.apply();
divid.style.visibility = "hidden";
divid.filters.blendTrans.play();
}



</script>
<style>
.font_11{font-size:11px;font-family:돋움}
</style>


혹시몰라서 팝업창 소스도 함께올립니다.ㅠㅠ

set_cookie()

위에 쿠키실행 함수가 누락인지 아닌지 출력한 소스엔 없어서요. 

버튼을 클릭했을때 쿠키를 저장하는 함수? 소스? 가 있는지 없는지 확인해 보세요.

답변을 작성하시기 전에 로그인 해주세요.
전체 123,534 | RSS
QA 내용 검색

회원로그인

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