묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
이미지카운터를 만들었는데, 좀 도와주세요~~~
2003.11.25 12:51
http://www.1more.co.kr/counter/counter2.php아래 소스에서 어떻게 해야 오늘방문자수도 보여줄수 있나요???
지금은 총방문자수만 나오게 돼있거든요......
도와주세요~ 보고 따라하긴 했는데....제가 필요한건 두개가동시에
나오게 하는겁니다......--;
<?
$today = date("Y-m-d");
$yday = mktime(0,0,0,date("m"), date("d")-1, date("Y"));
$yday = date("Y-m-d", $yday);
$time_set = 3600*24;
$connect = mysql_connect("localhost","more","more****") or die ("DB Server에 접속할 수 없습니다.");
mysql_select_db("more", $connect);
$query = "INSERT INTO counter2 VALUES ('$REMOTE_ADDR', NOW())";
mysql_query($query, $connect);
$total_query = "SELECT count(*) FROM counter2";
$total_res = mysql_query($total_query, $connect);
$total_row = mysql_fetch_row($total_res);
$today_query = "SELECT count(*) FROM counter2 WHERE DATE_FORMAT(visit_time, '%Y-%m-%d')='$today'";
$today_res = mysql_query($today_query, $connect);
$today_row = mysql_fetch_row($today_res);
settype($total_row[0], "string");
$i=0;
$j=strlen($total_row[0]);
$k=7-$j;
$counter=$total_row[0];
for($x=0;$x<$k;$x++){
$counter="0".$counter;
}
echo ("
<html>
<head>
<title>Count 연습</title>
</head>
<body bgcolor='#FFFFFF'>
");
while($i < 7) {
switch($counter[$i]) {
case "0" : echo("<img src='cimage/0.gif'>");
break;
case "1" : echo("<img src='./cimage/1.gif'>");
break;
case "2" : echo("<img src='./cimage/2.gif'>");
break;
case "3" : echo("<img src='./cimage/3.gif'>");
break;
case "4" : echo("<img src='./cimage/4.gif'>");
break;
case "5" : echo("<img src='./cimage/5.gif'>");
break;
case "6" : echo("<img src='./cimage/6.gif'>");
break;
case "7" : echo("<img src='./cimage/7.gif'>");
break;
case "8" : echo("<img src='./cimage/8.gif'>");
break;
case "9" : echo("<img src='./cimage/9.gif'>");
break;
}
$i++;
}
echo ("
</body>
</html>
");
?>
지금은 총방문자수만 나오게 돼있거든요......
도와주세요~ 보고 따라하긴 했는데....제가 필요한건 두개가동시에
나오게 하는겁니다......--;
<?
$today = date("Y-m-d");
$yday = mktime(0,0,0,date("m"), date("d")-1, date("Y"));
$yday = date("Y-m-d", $yday);
$time_set = 3600*24;
$connect = mysql_connect("localhost","more","more****") or die ("DB Server에 접속할 수 없습니다.");
mysql_select_db("more", $connect);
$query = "INSERT INTO counter2 VALUES ('$REMOTE_ADDR', NOW())";
mysql_query($query, $connect);
$total_query = "SELECT count(*) FROM counter2";
$total_res = mysql_query($total_query, $connect);
$total_row = mysql_fetch_row($total_res);
$today_query = "SELECT count(*) FROM counter2 WHERE DATE_FORMAT(visit_time, '%Y-%m-%d')='$today'";
$today_res = mysql_query($today_query, $connect);
$today_row = mysql_fetch_row($today_res);
settype($total_row[0], "string");
$i=0;
$j=strlen($total_row[0]);
$k=7-$j;
$counter=$total_row[0];
for($x=0;$x<$k;$x++){
$counter="0".$counter;
}
echo ("
<html>
<head>
<title>Count 연습</title>
</head>
<body bgcolor='#FFFFFF'>
");
while($i < 7) {
switch($counter[$i]) {
case "0" : echo("<img src='cimage/0.gif'>");
break;
case "1" : echo("<img src='./cimage/1.gif'>");
break;
case "2" : echo("<img src='./cimage/2.gif'>");
break;
case "3" : echo("<img src='./cimage/3.gif'>");
break;
case "4" : echo("<img src='./cimage/4.gif'>");
break;
case "5" : echo("<img src='./cimage/5.gif'>");
break;
case "6" : echo("<img src='./cimage/6.gif'>");
break;
case "7" : echo("<img src='./cimage/7.gif'>");
break;
case "8" : echo("<img src='./cimage/8.gif'>");
break;
case "9" : echo("<img src='./cimage/9.gif'>");
break;
}
$i++;
}
echo ("
</body>
</html>
");
?>