묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
이 스크립트에서 뭐가 잘못됬길래...홈페이지가 안뜨나요 ㅠㅠ
2004.07.29 16:57
<?php
// 접속자수 구하기
// DB connect
include "./pboard/inc/db.inc.php";
// 접속한 날짜 및 시간을 구함
$timeinfo = getdate(time());
$cur_year = $timeinfo["year"];
$cur_month = $timeinfo["mon"];
$cur_day = $timeinfo["mday"];
$cur_time = $timeinfo["hours"];
$cur_week = $timeinfo["wday"];
if($cur_time < 10) $cur_time = "0".$cur_time;
$times = array( "01" => "s_time01" , "02" => "s_time02" , "03" => "s_time03" , "04" => "s_time04" , "05" => "s_time05" , "06" => "s_time06" ,
"07" => "s_time07" , "08" => "s_time08" , "09" => "s_time09" , "10" => "s_time10" , "11" => "s_time11" , "12" => "s_time12" ,
"13" => "s_time13" , "14" => "s_time14" , "15" => "s_time15" , "16" => "s_time16" , "17" => "s_time17" , "18" => "s_time18" ,
"19" => "s_time19" , "20" => "s_time20" , "21" => "s_time21" , "22" => "s_time22" , "23" => "s_time23" , "00" => "s_time24" );
// 처음 접속한경우 쿠키를 생성하여 접속한날 카운트 금지 시킴
if(!$firstVisit)
{
counters();
}
else
{
$cur_date = $cur_year. $cur_month . $cur_day;
$s = strtotime($cur_date)-strtotime($firstVisit);
$d = intval($s/86400);
// 하루이전에 생성된 쿠기라면 카운트 증가 시킴
if($d > 0 )
{
counters();
}
}
// 카운트 입력 및 카운트 증가 처리 함수
function counters()
{
global $cur_year, $cur_month, $cur_day, $cur_week, $conn, $cur_time, $times;
$count_date = $cur_year.$cur_month.$cur_day;
setcookie("firstVisit",$count_date, time()*86400,"/");
// DB insert OR update 선택
$count_que = "SELECT * FROM counter WHERE s_year=$cur_year AND s_month=$cur_month AND s_day=$cur_day";
$count_res = mysql_query($count_que);
// 이미 값이 존재하는 경우 업데이트 시킨다.
if(mysql_num_rows($count_res))
{
$update_que = "UPDATE counter SET $times[$cur_time] = $times[$cur_time]+1 , s_total = s_total + 1 WHERE s_year=$cur_year AND s_month=$cur_month AND s_day=$cur_day";
$update_res = mysql_query($update_que, $conn);
}
// 값이 존재하지 않는 경우 값을 넣는다
else
{
$uid_que = "SELECT MAX(uid) FROM counter";
$uid_res = mysql_query($uid_que) or die($uid_que);
// uid 구하기
if(list($uid) = mysql_fetch_array($uid_res)) $uid = intVal($uid) + 1;
else $uid = 1;
$insert_que = "INSERT INTO counter (uid, s_year, s_month, s_day, s_week, $times[$cur_time], s_total) VALUES ($uid, $cur_year, $cur_month, $cur_day, $cur_week , 1, 1)";
$insert_res = mysql_query($insert_que, $conn) or die($insert_que."<br>".mysql_error());
}
}
// counter 출력 (어제 , 오늘 , 전체)
$yesterday = mktime(0,0,0,$cur_month, $cur_day -1, $cur_year);
$y_year = date("Y", $yesterday);
$y_month = date("m", $yesterday);
$y_day = date("d", $yesterday);
$yday_count_que = "SELECT s_total FROM counter WHERE s_year=$y_year AND s_month=$y_month AND s_day=$y_day";
$yday_count_res = mysql_query($yday_count_que , $conn) or die($yday_count_que);
if($yday_count_res)
{
if(!list($yesterday_count) = mysql_fetch_array($yday_count_res))
$yesterday_count = 0;
}
$today_count_que = "SELECT s_total FROM counter WHERE s_year=$cur_year AND s_month=$cur_month AND s_day=$cur_day";
$today_count_res = mysql_query($today_count_que, $conn) or die($today_count_que);
if($today_count_res)
{
if(!list($today_count) = mysql_fetch_array($today_count_res))
$today_count = 0;
}
$total_count_que = "SELECT SUM(s_total) FROM counter";
$total_count_res = mysql_query($total_count_que, $conn);
if($total_count_res)
{
if(!list($total_count) = mysql_fetch_array($total_count_res))
$total_count = 0;
}
//DB close
mysql_close($conn) ;
$counter_view = "
<table width=100%' cellpadding='0' cellspacing='0' style='border-style:solid;border-width:2px;border-color:#DBDBDB'>
<tr align='center' height='50' bgcolor='#FFFFFF'>
<td>
<table width='100' style='font-size:8pt;font-family:돋움'>
<tr><td>오늘 : </td><td align='right'>${today_count}</td></tr>
<tr><td>어제 : </td><td align='right'>${yesterday_count}</td></tr>
<tr><td>전체 : </td><td align='right'>${total_count}</td></tr>
</table>
</td>
</tr>
</table>
";
//echo $counter_view;
?>
증상은 http://xelloss.nared.net 입니다...ㅠㅠ
// 접속자수 구하기
// DB connect
include "./pboard/inc/db.inc.php";
// 접속한 날짜 및 시간을 구함
$timeinfo = getdate(time());
$cur_year = $timeinfo["year"];
$cur_month = $timeinfo["mon"];
$cur_day = $timeinfo["mday"];
$cur_time = $timeinfo["hours"];
$cur_week = $timeinfo["wday"];
if($cur_time < 10) $cur_time = "0".$cur_time;
$times = array( "01" => "s_time01" , "02" => "s_time02" , "03" => "s_time03" , "04" => "s_time04" , "05" => "s_time05" , "06" => "s_time06" ,
"07" => "s_time07" , "08" => "s_time08" , "09" => "s_time09" , "10" => "s_time10" , "11" => "s_time11" , "12" => "s_time12" ,
"13" => "s_time13" , "14" => "s_time14" , "15" => "s_time15" , "16" => "s_time16" , "17" => "s_time17" , "18" => "s_time18" ,
"19" => "s_time19" , "20" => "s_time20" , "21" => "s_time21" , "22" => "s_time22" , "23" => "s_time23" , "00" => "s_time24" );
// 처음 접속한경우 쿠키를 생성하여 접속한날 카운트 금지 시킴
if(!$firstVisit)
{
counters();
}
else
{
$cur_date = $cur_year. $cur_month . $cur_day;
$s = strtotime($cur_date)-strtotime($firstVisit);
$d = intval($s/86400);
// 하루이전에 생성된 쿠기라면 카운트 증가 시킴
if($d > 0 )
{
counters();
}
}
// 카운트 입력 및 카운트 증가 처리 함수
function counters()
{
global $cur_year, $cur_month, $cur_day, $cur_week, $conn, $cur_time, $times;
$count_date = $cur_year.$cur_month.$cur_day;
setcookie("firstVisit",$count_date, time()*86400,"/");
// DB insert OR update 선택
$count_que = "SELECT * FROM counter WHERE s_year=$cur_year AND s_month=$cur_month AND s_day=$cur_day";
$count_res = mysql_query($count_que);
// 이미 값이 존재하는 경우 업데이트 시킨다.
if(mysql_num_rows($count_res))
{
$update_que = "UPDATE counter SET $times[$cur_time] = $times[$cur_time]+1 , s_total = s_total + 1 WHERE s_year=$cur_year AND s_month=$cur_month AND s_day=$cur_day";
$update_res = mysql_query($update_que, $conn);
}
// 값이 존재하지 않는 경우 값을 넣는다
else
{
$uid_que = "SELECT MAX(uid) FROM counter";
$uid_res = mysql_query($uid_que) or die($uid_que);
// uid 구하기
if(list($uid) = mysql_fetch_array($uid_res)) $uid = intVal($uid) + 1;
else $uid = 1;
$insert_que = "INSERT INTO counter (uid, s_year, s_month, s_day, s_week, $times[$cur_time], s_total) VALUES ($uid, $cur_year, $cur_month, $cur_day, $cur_week , 1, 1)";
$insert_res = mysql_query($insert_que, $conn) or die($insert_que."<br>".mysql_error());
}
}
// counter 출력 (어제 , 오늘 , 전체)
$yesterday = mktime(0,0,0,$cur_month, $cur_day -1, $cur_year);
$y_year = date("Y", $yesterday);
$y_month = date("m", $yesterday);
$y_day = date("d", $yesterday);
$yday_count_que = "SELECT s_total FROM counter WHERE s_year=$y_year AND s_month=$y_month AND s_day=$y_day";
$yday_count_res = mysql_query($yday_count_que , $conn) or die($yday_count_que);
if($yday_count_res)
{
if(!list($yesterday_count) = mysql_fetch_array($yday_count_res))
$yesterday_count = 0;
}
$today_count_que = "SELECT s_total FROM counter WHERE s_year=$cur_year AND s_month=$cur_month AND s_day=$cur_day";
$today_count_res = mysql_query($today_count_que, $conn) or die($today_count_que);
if($today_count_res)
{
if(!list($today_count) = mysql_fetch_array($today_count_res))
$today_count = 0;
}
$total_count_que = "SELECT SUM(s_total) FROM counter";
$total_count_res = mysql_query($total_count_que, $conn);
if($total_count_res)
{
if(!list($total_count) = mysql_fetch_array($total_count_res))
$total_count = 0;
}
//DB close
mysql_close($conn) ;
$counter_view = "
<table width=100%' cellpadding='0' cellspacing='0' style='border-style:solid;border-width:2px;border-color:#DBDBDB'>
<tr align='center' height='50' bgcolor='#FFFFFF'>
<td>
<table width='100' style='font-size:8pt;font-family:돋움'>
<tr><td>오늘 : </td><td align='right'>${today_count}</td></tr>
<tr><td>어제 : </td><td align='right'>${yesterday_count}</td></tr>
<tr><td>전체 : </td><td align='right'>${total_count}</td></tr>
</table>
</td>
</tr>
</table>
";
//echo $counter_view;
?>
증상은 http://xelloss.nared.net 입니다...ㅠㅠ