묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
쿠시 설정이 먹히질 않아서...??
2004.02.25 15:10
인터넷에서 짝퉁 카운터라는 카운터를 받았는데요
그 카운터에서 쿠키 설정으로 리로드할때는 카운터가 되지 않도록 하는 기능이 있는데
태그의 위쪽에 두었는데도 먹히질 않습니다.
소스를 올립니다. 함 봐주시고 고수님들 조언해 주시길...
--------------------------------------------------
<?php
if (file_exists("count.dat")){
$buffer = file("count.dat");
$set = explode("|",$buffer[0]);
$count=$set[0];
$today_count=$set[1];
$today=$set[2];
$max_count=$set[3];
$yesterday_count=$set[4];
}else{
$count=0;
$today_count=0;
$today=date("md");
$max_count=0;
$yesterday_count=0;
}
if(!$counter){
setcookie("counter", "count_ok", time()+3600);//1시간(3600초)이내 재카운트 금지
$count++;
$now_date=date("md");
if($today==$now_date){
$today_count++;
}else{
//날짜가 넘어갈때 처리
if($today_count>$max_count)$max_count=$today_count;//최대접속수일때
$yesterday_count=$today_count;//어제접속수일때
$today_count=1;//오늘접속수 초기화
$today=$now_date;
}
$t_count="$count|$today_count|$today|$max_count|$yesterday_count|";
$fp=fopen('count.dat','w');
fputs($fp,$t_count);
fclose($fp);
}
?>
<?
$_zb_url = "zboard/";
$_zb_path = "/home/ichon/html/zboard/";
include $_zb_path."outlogin.php";
?>
<HTML>
<HEAD>
<!----------------------------------헤드태그 사이에 넣어야 할 스타일쉬트------------------------>
<style type="text/css">
.box {border:solid 1 Dimgray; background-image:url(''); background-repeat:no-repeat; background-attachment:fixed; background-position:right bottom; background-color:; }
.ver8 { color:; font-family:tahoma; font-size:8pt}
.ver9 { color:; font-family:tahoma; font-size:9pt}
</style>
<!-----------------------------------여기까지-------------------------------------------------->
<STYLE type=text/css>
A:link {color:#FF7DB4;font-size:13px;text-decoration:none}
A:visited {color:#FF7DB4;font-size:13px;text-decoration:none}
A:active {color:#FF7DB4;font-size:13px;text-decoration:none}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<TITLE></TITLE>
</HEAD>
<body bgcolor=white leftmargin="0" topmargin="0" marginwidth=0 marginheight=0>
<br>
<br>
<center>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td height=150 valign=bottom align=center>
<a href="counter.html" target=main><img src="img/counter_2.jpg" border=0></a><br>
<!-----------------------------------카운터 넣을 부분에 투입!----------------------------------->
<div style="width:100px; height:100px; position:absolute; left:41px; top:16px; z-index:1; visibility:hide" id="overDiv"></div>
<script language="JavaScript">
<!--
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
if (ie4) {
if (navigator.userAgent.indexOf('MSIE 5')>0) {
ie5 = true;
}
else {
ie5 = false;
}
}
else {
ie5 = false;
}
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
if ( (ns4) || (ie4) ) {
if (ns4) over = document.overDiv
if (ie4) over = overDiv.style
document.onmousemove = mouseMove
if (ns4) document.captureEvents(Event.MOUSEMOVE)
}
function drc(text, title, osy) {
dtc(1, text, title, osy);
}
function dlc(text, title, osy) {
dtc(0, text, title, osy);
}
function dcc(text, title, osy) {
dtc(2, text, title, osy);
}
function nd() {
if ( cnt >= 1 ) { sw = 0 };
if ( (ns4) || (ie4) ) {
if ( sw == 0 ) {
snow = 0;
hideObject(over);
}
else {
cnt++;
}
}
}
function dtc(d, text, title, osy) {
txt = text
layerWrite(txt);
dir = d;
offsety = osy;
disp();
}
function disp() {
if ( (ns4) || (ie4) ) {
if (snow == 0) {
if (dir == 2) {
moveTo(over,x,y+10);
}
if (dir == 1) {
moveTo(over,x,y+10);
}
if (dir == 0) {
moveTo(over,x,y+10);
}
showObject(over);
snow = 1;
}
}
}
function mouseMove(e) {
if (ns4) {x=e.pageX; y=e.pageY;
}
if (ie4) {x=event.x; y=event.y;
}
if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;
}
if (snow) {
if (dir == 2) {
moveTo(over,x,y+10);
}
if (dir == 1) {
moveTo(over,x,y+10);
}
if (dir == 0) {
moveTo(over,x,y+10);
}
}
}
function cClick() {
hideObject(over);
sw=0;
}
function layerWrite(txt) {
if (ns4) {
var lyr = document.overDiv.document
lyr.write(txt)
lyr.close()
}
else if (ie4) document.all["overDiv"].innerHTML = txt
}
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}
function hideObject(obj) {
if (ns4) obj.visibility = "hide"
else if (ie4) obj.visibility = "hidden"
}
function moveTo(obj,xL,yL) {
obj.left = xL
obj.top = yL
}
//-->
</script>
<!--실질적인 카운터표시부분-->
<a onMouseOver="dcc('<div style=margin-right:0;margin-top:0><table cellspacing=0 cellpadding=1 width=130 class=box><tr><td><? echo "<font class=ver8>Yesterday:$yesterday_count Max:$max_count</font>"; ?></td></tr></table></div>','','20')" onMouseOut="nd()" target="_self">
<font class=ver8 color=yellowgreen><? echo "Total: $count"; ?> <? echo "Today: $today_count"; ?></font>
</a>
<!------------------------------------여기까지(카운터넣을 부분에 넣어요.)--------------------------->
</td>
<tr>
<td><a href="zboard/zboard.php?id=notice" target=main><img src="img/m1.jpg" border=0></a></td>
<tr>
<td><a href="zboard/zboard.php?id=notice_2" target=main><img src="img/m2.jpg" border=0></a></td>
<tr>
<td><a href="hot_cool.php" target=main><img src="img/m3.jpg" border=0></a></td>
<tr>
<td><a href="intro.html" target=main><img src="img/m4.jpg" border=0></a></td>
<tr>
<td><a href="intro2.html" target=main><img src="img/m5.jpg" border=0></a></td>
<tr>
<td><a href="zboard/zboard.php?id=to" target=main><img src="img/m6.jpg" border=0></a></td>
</table>
<br>
<? include "banner.php"; ?>
</center>
</body>
</HTML>
그 카운터에서 쿠키 설정으로 리로드할때는 카운터가 되지 않도록 하는 기능이 있는데
태그의 위쪽에 두었는데도 먹히질 않습니다.
소스를 올립니다. 함 봐주시고 고수님들 조언해 주시길...
--------------------------------------------------
<?php
if (file_exists("count.dat")){
$buffer = file("count.dat");
$set = explode("|",$buffer[0]);
$count=$set[0];
$today_count=$set[1];
$today=$set[2];
$max_count=$set[3];
$yesterday_count=$set[4];
}else{
$count=0;
$today_count=0;
$today=date("md");
$max_count=0;
$yesterday_count=0;
}
if(!$counter){
setcookie("counter", "count_ok", time()+3600);//1시간(3600초)이내 재카운트 금지
$count++;
$now_date=date("md");
if($today==$now_date){
$today_count++;
}else{
//날짜가 넘어갈때 처리
if($today_count>$max_count)$max_count=$today_count;//최대접속수일때
$yesterday_count=$today_count;//어제접속수일때
$today_count=1;//오늘접속수 초기화
$today=$now_date;
}
$t_count="$count|$today_count|$today|$max_count|$yesterday_count|";
$fp=fopen('count.dat','w');
fputs($fp,$t_count);
fclose($fp);
}
?>
<?
$_zb_url = "zboard/";
$_zb_path = "/home/ichon/html/zboard/";
include $_zb_path."outlogin.php";
?>
<HTML>
<HEAD>
<!----------------------------------헤드태그 사이에 넣어야 할 스타일쉬트------------------------>
<style type="text/css">
.box {border:solid 1 Dimgray; background-image:url(''); background-repeat:no-repeat; background-attachment:fixed; background-position:right bottom; background-color:; }
.ver8 { color:; font-family:tahoma; font-size:8pt}
.ver9 { color:; font-family:tahoma; font-size:9pt}
</style>
<!-----------------------------------여기까지-------------------------------------------------->
<STYLE type=text/css>
A:link {color:#FF7DB4;font-size:13px;text-decoration:none}
A:visited {color:#FF7DB4;font-size:13px;text-decoration:none}
A:active {color:#FF7DB4;font-size:13px;text-decoration:none}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<TITLE></TITLE>
</HEAD>
<body bgcolor=white leftmargin="0" topmargin="0" marginwidth=0 marginheight=0>
<br>
<br>
<center>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td height=150 valign=bottom align=center>
<a href="counter.html" target=main><img src="img/counter_2.jpg" border=0></a><br>
<!-----------------------------------카운터 넣을 부분에 투입!----------------------------------->
<div style="width:100px; height:100px; position:absolute; left:41px; top:16px; z-index:1; visibility:hide" id="overDiv"></div>
<script language="JavaScript">
<!--
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
if (ie4) {
if (navigator.userAgent.indexOf('MSIE 5')>0) {
ie5 = true;
}
else {
ie5 = false;
}
}
else {
ie5 = false;
}
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
if ( (ns4) || (ie4) ) {
if (ns4) over = document.overDiv
if (ie4) over = overDiv.style
document.onmousemove = mouseMove
if (ns4) document.captureEvents(Event.MOUSEMOVE)
}
function drc(text, title, osy) {
dtc(1, text, title, osy);
}
function dlc(text, title, osy) {
dtc(0, text, title, osy);
}
function dcc(text, title, osy) {
dtc(2, text, title, osy);
}
function nd() {
if ( cnt >= 1 ) { sw = 0 };
if ( (ns4) || (ie4) ) {
if ( sw == 0 ) {
snow = 0;
hideObject(over);
}
else {
cnt++;
}
}
}
function dtc(d, text, title, osy) {
txt = text
layerWrite(txt);
dir = d;
offsety = osy;
disp();
}
function disp() {
if ( (ns4) || (ie4) ) {
if (snow == 0) {
if (dir == 2) {
moveTo(over,x,y+10);
}
if (dir == 1) {
moveTo(over,x,y+10);
}
if (dir == 0) {
moveTo(over,x,y+10);
}
showObject(over);
snow = 1;
}
}
}
function mouseMove(e) {
if (ns4) {x=e.pageX; y=e.pageY;
}
if (ie4) {x=event.x; y=event.y;
}
if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;
}
if (snow) {
if (dir == 2) {
moveTo(over,x,y+10);
}
if (dir == 1) {
moveTo(over,x,y+10);
}
if (dir == 0) {
moveTo(over,x,y+10);
}
}
}
function cClick() {
hideObject(over);
sw=0;
}
function layerWrite(txt) {
if (ns4) {
var lyr = document.overDiv.document
lyr.write(txt)
lyr.close()
}
else if (ie4) document.all["overDiv"].innerHTML = txt
}
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}
function hideObject(obj) {
if (ns4) obj.visibility = "hide"
else if (ie4) obj.visibility = "hidden"
}
function moveTo(obj,xL,yL) {
obj.left = xL
obj.top = yL
}
//-->
</script>
<!--실질적인 카운터표시부분-->
<a onMouseOver="dcc('<div style=margin-right:0;margin-top:0><table cellspacing=0 cellpadding=1 width=130 class=box><tr><td><? echo "<font class=ver8>Yesterday:$yesterday_count Max:$max_count</font>"; ?></td></tr></table></div>','','20')" onMouseOut="nd()" target="_self">
<font class=ver8 color=yellowgreen><? echo "Total: $count"; ?> <? echo "Today: $today_count"; ?></font>
</a>
<!------------------------------------여기까지(카운터넣을 부분에 넣어요.)--------------------------->
</td>
<tr>
<td><a href="zboard/zboard.php?id=notice" target=main><img src="img/m1.jpg" border=0></a></td>
<tr>
<td><a href="zboard/zboard.php?id=notice_2" target=main><img src="img/m2.jpg" border=0></a></td>
<tr>
<td><a href="hot_cool.php" target=main><img src="img/m3.jpg" border=0></a></td>
<tr>
<td><a href="intro.html" target=main><img src="img/m4.jpg" border=0></a></td>
<tr>
<td><a href="intro2.html" target=main><img src="img/m5.jpg" border=0></a></td>
<tr>
<td><a href="zboard/zboard.php?id=to" target=main><img src="img/m6.jpg" border=0></a></td>
</table>
<br>
<? include "banner.php"; ?>
</center>
</body>
</HTML>