묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
이미지 카운터를 만들었는데..고수님 질문요~
2003.11.26 11:40
<?php
$user_ip=$REMOTE_ADDR;
$referer=$HTTP_REFERER;
if(!$referer) $referer="Typing or Bookmark Moving On This Site";
$image_file_count = "./image.dat";
$image_count=0;
$timer=0;
echo("<h2>이미지 카운터 서비스 만들기</h2><p>");
if(!$image_count){
if($timer >= 1){
setcookie("image_count"."image_count_val", time() +$timer);
}
$file_open = fopen($image_file_count, 'r');
$count = fread($file_open, filesize($image_file_count));
fclose($file_open);
$count += 1;
$str=(string) $count;
for($i=0; $i<strlen($str); $i++){
$s_str = substr($str, $i,1);
switch ($s_str){
case 0:
echo("<img src ='./image/0.jpg'>");
break;
case 1:
echo("<img src ='./image/1.jpg'>");
break;
case 2:
echo("<img src ='./image/2.jpg'>");
break;
case 3:
echo("<img src ='./image/3.jpg'>");
break;
case 4:
echo("<img src ='./image/4.jpg'>");
break;
case 5:
echo("<img src ='./image/5.jpg'>");
break;
case 6:
echo("<img src ='./image/6.jpg'>");
break;
case 7:
echo("<img src ='./image/7.jpg'+ '+ '>");
break;
case 8:
echo("<img src ='./image/8.jpg'>");
break;
case 9:
echo("<img src ='./image/9.jpg'>");
break;
}
}
$file_open_name = fopen ($image_file_count, "w");
fwrite ($file_open_name,"$count", strlen($count));
fclose ($file_open_name);
}
if($image_count=="image_count_val"){
$file_open_count = fopen($image_file_count,"r");
$count = fread($file_open_count,
filesize($image_file_count));
fclose($file_open_count);
$str = (string) $count;
}
?>
<html>
<head>
<title>
이미지 카운터 만들기
</title>
</head>
<body>
</body>
</html>
여기서 새로고침 눌러도 카운터 증가 안시키게 할려면 어떻게 해야 하나요?
$user_ip=$REMOTE_ADDR;
$referer=$HTTP_REFERER;
if(!$referer) $referer="Typing or Bookmark Moving On This Site";
$image_file_count = "./image.dat";
$image_count=0;
$timer=0;
echo("<h2>이미지 카운터 서비스 만들기</h2><p>");
if(!$image_count){
if($timer >= 1){
setcookie("image_count"."image_count_val", time() +$timer);
}
$file_open = fopen($image_file_count, 'r');
$count = fread($file_open, filesize($image_file_count));
fclose($file_open);
$count += 1;
$str=(string) $count;
for($i=0; $i<strlen($str); $i++){
$s_str = substr($str, $i,1);
switch ($s_str){
case 0:
echo("<img src ='./image/0.jpg'>");
break;
case 1:
echo("<img src ='./image/1.jpg'>");
break;
case 2:
echo("<img src ='./image/2.jpg'>");
break;
case 3:
echo("<img src ='./image/3.jpg'>");
break;
case 4:
echo("<img src ='./image/4.jpg'>");
break;
case 5:
echo("<img src ='./image/5.jpg'>");
break;
case 6:
echo("<img src ='./image/6.jpg'>");
break;
case 7:
echo("<img src ='./image/7.jpg'+ '+ '>");
break;
case 8:
echo("<img src ='./image/8.jpg'>");
break;
case 9:
echo("<img src ='./image/9.jpg'>");
break;
}
}
$file_open_name = fopen ($image_file_count, "w");
fwrite ($file_open_name,"$count", strlen($count));
fclose ($file_open_name);
}
if($image_count=="image_count_val"){
$file_open_count = fopen($image_file_count,"r");
$count = fread($file_open_count,
filesize($image_file_count));
fclose($file_open_count);
$str = (string) $count;
}
?>
<html>
<head>
<title>
이미지 카운터 만들기
</title>
</head>
<body>
</body>
</html>
여기서 새로고침 눌러도 카운터 증가 안시키게 할려면 어떻게 해야 하나요?