for($i=1;$i<=6;$i++)
{
echo" ";
}
?>
|
|
Year : size=4 maxlength=4 style='background-color:eeeeee; border:1 solid black;height:16'>
Month : size=2 maxlength=2 style='background-color:eeeeee; border:1 solid black;height:16'>
Day : size=2 maxlength=2 style='background-color:eeeeee; border:1 solid black;height:16'>
|
| .gif height=20> |
//-------------------------- 카운터 수 구해옴 -----------------------------//
// 전체
$total=mysql_fetch_array(mysql_query("select unique_counter, pageview from counter_main where no=1", $connect));
$count[total_hit]=$total[0];
$count[total_view]=$total[1];
// 오늘 카운터 읽어오는 부분
$detail=mysql_fetch_Array(mysql_query("select unique_counter, pageview from counter_main where date='$today'", $connect));
$count[today_hit]=$detail[0];
$count[today_view]=$detail[1];
// 어제 카운터 읽어오는 부분
$detail=mysql_fetch_Array(mysql_query("select unique_counter, pageview from counter_main where date='$yesterday'", $connect));
$count[yesterday_hit]=$detail[0];
$count[yesterday_view]=$detail[1];
// 최고 카운터 읽어오는 부분
$detail=mysql_fetch_Array(mysql_query("select max(unique_counter), max(pageview) from counter_main where no>1", $connect));
$count[max_hit]=$detail[0];
$count[max_view]=$detail[1];
// 최저 카운터 읽어오는 부분
$detail=mysql_fetch_Array(mysql_query("select min(unique_counter), min(pageview) from counter_main where no>1 and date<$today", $connect));
$count[min_hit]=$detail[0];
$count[min_view]=$detail[1];
//-----------------------------------------------------------------------------
// 전체카운터 (1)
//-----------------------------------------------------------------------------
if($no=="1")
{
echo"
전체 방문자수 : $count[total_hit]
전체 페이지뷰 : $count[total_view]
|
오늘 방문자수 : $count[today_hit]
오늘 페이지뷰 : $count[today_view]
|
어제 방문자수 : $count[yesterday_hit]
어제 페이지뷰 : $count[yesterday_view]
|
최고 방문자수 : $count[max_hit]
최고 페이지뷰 : $count[max_view]
|
최저 방문자수 : $count[min_hit]
최저 페이지뷰 : $count[min_view]
|
";
}
//-----------------------------------------------------------------------------
// 오늘 시간대별 카운터 (2)
//-----------------------------------------------------------------------------
elseif($no=="2")
{
echo"
$month 월 $day 일 방문자수 : $count[today_hit]
$month 월 $day 일 페이지뷰 : $count[today_view]
|
";
$max=1;
for($i=0;$i<24;$i++)
{
$time1=mktime($i,0,0,$month,$day,$year);
$time2=mktime($i,59,59,$month,$day,$year);
$temp=mysql_fetch_array(mysql_query("select count(*) from counter_ip where date>='$time1' and date<='$time2'", $connect));
$time_count[$i]=$temp[0];
if($max<$time_count[$i]) $max=$time_count[$i];
}
for($i=0;$i<24;$i++)
{
$per1=(int)($time_count[$i]/$max*100);
if($per1>100)$per1=99;
echo"
| - $i 시 |
![$i시 방문자수 : $time_count[$i]](image/bars1.gif) |
Unique $time_count[$i] |
";
}
echo"
|
";
}
//-----------------------------------------------------------------------------
// 주간별 카운터 (3)
//-----------------------------------------------------------------------------
elseif($no=="3")
{
$start_day=$day;
while(date('l',mktime(0,0,0,$month,$start_day,$year))!='Sunday')
{
$start_day--;
}
$last_day=$day;
while(date('l',mktime(0,0,0,$month,$last_day,$year))!='Saturday')
{
$last_day++;
}
$start_time=mktime(0,0,0,$month,$start_day,$year);
$last_time=mktime(23,59,59,$month,$last_day,$year);
$detail=mysql_fetch_Array(mysql_query("select sum(unique_counter), sum(pageview) from counter_main where date>=$start_time and date<=$last_time", $connect));
$count[week_hit]=$detail[0];
$count[week_view]=$detail[1];
echo"
$month 월 $start_day ~ $last_day 일 방문자수 : $count[week_hit]
$month 월 $start_day ~ $last_day 일 페이지뷰 : $count[week_view]
|
";
$max1=1;
$max2=1;
for($i=0;$i<7;$i++)
{
$time=mktime(0,0,0,$month,$start_day+$i,$year);
$temp=mysql_fetch_array(mysql_query("select unique_counter, pageview from counter_main where date='$time'", $connect));
$time_count1[$i]=$temp[0];
if($max1<$time_count1[$i]) $max1=$time_count1[$i];
$time_count2[$i]=$temp[1];
if($max2<$time_count2[$i]) $max2=$time_count2[$i];
}
$week=array("일요일","월요일","화요일","수요일","목요일","금요일","토요일");
for($i=0;$i<7;$i++)
{
$per1=(int)($time_count1[$i]/$max1*100+1);
$per2=(int)($time_count2[$i]/$max2*100+1);
if($per1>100)$per1=99;
if($per2>100)$per2=99;
echo"
| - $week[$i] |
![$week[$i] 방문자수 : $time_count1[$i]](image/bars1.gif)
|
Unique : $time_count1[$i] PageView : $time_count2[$i] |
";
}
echo"
|
";
}
//-----------------------------------------------------------------------------
// 월간카운터 (4)
//-----------------------------------------------------------------------------
elseif($no=="4")
{
$total_month_counter=mysql_fetch_array(mysql_query("select sum(unique_counter), sum(pageview) from counter_main where date>='$month_start' and date<='$lastdate'", $connect));
echo"
$month 월 방문자수 : $total_month_counter[0]
$month 월 페이지뷰 : $total_month_counter[1]
|
";
// 이번달 카운터 (각각)
$max=mysql_fetch_array(mysql_query("select max(unique_counter), max(pageview) from counter_main where date>='$month_start' and date<='$lastdate'",$connect));
$month_counter=mysql_query("select date, unique_counter, pageview from counter_main where date>='$month_start' and date<='$lastdate'",$connect);
while($data=mysql_fetch_array($month_counter))
{
$per1=$data[unique_counter]/$max[0]*100;
$per2=$data[pageview]/$max[1]*100;
echo"
| - ".date("d 일",$data[date])." |
![Unique : $data[unique_counter]](image/bars1.gif)
![PageView : $data[pageview]](image/bars2.gif) |
Unique : $data[unique_counter] PageView : $data[pageview] |
";
}
echo"
|
";
}
//-----------------------------------------------------------------------------
// 년간카운터 (5)
//-----------------------------------------------------------------------------
elseif($no=="5")
{
$year_start=mktime(0,0,0,1,1,$year);
$year_last=mktime(23,59,59,12,31,$year);
$total_year_counter=mysql_fetch_array(mysql_query("select sum(unique_counter), sum(pageview) from counter_main where date>='$year_start' and date<='$year_last'", $connect));
echo"
$year 년 방문자수 : $total_year_counter[0]
$year 년 페이지뷰 : $total_year_counter[1]
|
";
// 이번달 카운터 (각각)
$max1=1;
$max2=1;
for($i=0;$i<7;$i++)
{
$time=mktime(0,0,0,$month,$start_day+$i,$year);
$temp=mysql_fetch_array(mysql_query("select unique_counter, pageview from counter_main where date='$time'", $connect));
$time_count1[$i]=$temp[0];
if($max1<$time_count1[$i]) $max1=$time_count1[$i];
$time_count2[$i]=$temp[1];
if($max2<$time_count2[$i]) $max2=$time_count2[$i];
}
$mmax=array("31","28","31","30","31","30","31","31","30","31","30","31");
$max=1;
$max2=1;
for($i=0;$i<12;$i++)
{
$sdate=mktime(0,0,0,$i+1,1,$year);
$edate=mktime(0,0,0,$i+1,$mmax[$i],$year);
$year_counter=mysql_query("select sum(unique_counter), sum(pageview) from counter_main where date>='$sdate' and date<='$edate'",$connect);
$temp=mysql_fetch_array($year_counter);
$time_count1[$i]=$temp[0];
if($max1<$time_count1[$i]) $max1=$time_count1[$i];
$time_count2[$i]=$temp[1];
if($max2<$time_count2[$i]) $max2=$time_count2[$i];
}
for($i=0;$i<12;$i++)
{
$per1=(int)($time_count1[$i]/$max1*100+1);
$per2=(int)($time_count2[$i]/$max2*100+1);
if($per1>100)$per1=99;
if($per2>100)$per2=99;
$j=$i+1;
echo"
| - $j 월 |
![$week[$i] 방문자수 : $time_count1[$i]](image/bars1.gif)
|
Unique : $time_count1[$i] PageView : $time_count2[$i] |
";
}
echo"
|
";
}
//-----------------------------------------------------------------------------
// 접속자 방문경로?(6)
//-----------------------------------------------------------------------------
elseif($no=="6")
{
echo "";
$ip=mysql_query("select referer, hit from counter_referer where date='$today' order by hit desc", $connect);
while($data=mysql_fetch_array($ip))
{
if(strlen($data[referer])>40)
{
$temp=substr($data[referer],0,40);
$text="$temp...";
}
else $text=$data[referer];
if(!eregi("Typing or Bookmark", $data[referer])) $data[referer]="$text";
echo " - $data[referer] ($data[hit]) ";
}
echo" |
";
}
//-----------------------------------------------------------------------------
// 하단부분
//-----------------------------------------------------------------------------
echo"
| Edited by Glory 2008 |