묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
플래쉬 카운터에서....수정을 할려면??
2002.08.21 19:19
http://www.musguy.com
첫화면의
플래쉬 카운터에서....
디폴트는 카운터를 대면 위로 네개의 막대가 생기며 오늘,어제 방문자수가 나타나는데,
이걸 맨처음에 자동으로 4개가 펼쳐졌다가 (보이다가) 디폴트로 돌아오게 할수 없을까요??
소스는 아래에....
&lock_open(CNT, "+<$file");
$cnt = <CNT>;
($total_c,$yesterday_c,$today_c,$lastday) = split(/,/, $cnt);
$total_c++;
$today_c++;
$your_c = &get_cookie($cookiename) + 1;
#####오늘과 어제의 연월일 취득
$ENV{'TZ'} = 'JST-9';
( $sec, $min, $hour, $day, $mon, $year ) = localtime(time);
($sec2, $min2, $hour2, $day2, $mon2, $year2 ) = localtime(time-24*60*60);
$mon++;
$year += 1900;
$today = "$year-$mon-$dayn";
$mon2++;
$year2 += 1900;
$yesterday = "$year2-$mon2-$day2n";
#####연월일 비교
if ($today ne $lastday) {
if ($yesterday ne $lastday) {
$yesterday_c = 0;
} else {
$yesterday_c = $today_c;
}
$today_c = 1;
$lastday = $today;
}
#####6자리수 변환
$total_c = sprintf("%06d", $total_c);
$today_c = sprintf("%06d", $today_c);
$yesterday_c = sprintf("%06d", $yesterday_c);
$your_c = sprintf("%06d", $your_c);
seek(CNT, 0, 0);
print CNT "$total_c,$yesterday_c,$today_c,$lastdayn";
&unlock_close(CNT);
#####HTTP헤더
print "Content-type: text/plainn";
&set_cookie($cookiename);
print "n";
print "cgi=$cgi&total=$total_c&yes=$yesterday_c&today=$today_c&you=$your_c&load=end&";
exit(0);
#####파일락 열기
sub lock_open {
local(*FILE, $name) = @_;
if (!open(FILE, $name)) {
print "content-type: text/plainnn";
print "$name파일을 열 수 없습니다.n";
exit(0);
}
if ($uselock) {
eval("flock(FILE, 2)");
if ($@) {
print "content-type: text/plainnn";
print "$@이 환경에서는 flock 은 사용할 수 없습니다$uselock = 0 으로 해주세요n";
exit(0);
}
}
seek(FILE, 0, 0);
}
#####파일락 닫기
sub unlock_close {
local(*FILE) = @_;
if ($uselock) {
eval("flock(FILE, 8)");
}
close(FILE);
}
#####===쿠키처리===############################################################################
#####쿠키유효기간
sub get_cookie_date {
$ENV{'TZ'} = 'JST-9';
my( $csec, $cmin, $chour, $cday, $cmon, $cyear, $cwday )
= localtime(time + $dday*60*60*24);
my(@month) = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my(@week) = qw(Sun Mon Tue Wed Thu Fri Sat);
return sprintf("%s, %d-%s-%04d %02d:%02d:%02d GMT",
$week[$cwday],$cday,$month[$cmon+1],$cyear+1900,$chour,$cmin,$csec);
}
#####쿠키의 출력
sub set_cookie {
local($cookiename2) = @_;
$cookiedate = &get_cookie_date;
print "Set-Cookie: $cookiename=$your_c; expires=$cookiedate; n";
}
#####쿠키의 취득
sub get_cookie {
local($cookiename1) = @_;
@pairs = split(/; /, $ENV{'HTTP_COOKIE'});
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
if ($name eq $cookiename) {
return $value;
}
}
return '';
}
첫화면의
플래쉬 카운터에서....
디폴트는 카운터를 대면 위로 네개의 막대가 생기며 오늘,어제 방문자수가 나타나는데,
이걸 맨처음에 자동으로 4개가 펼쳐졌다가 (보이다가) 디폴트로 돌아오게 할수 없을까요??
소스는 아래에....
&lock_open(CNT, "+<$file");
$cnt = <CNT>;
($total_c,$yesterday_c,$today_c,$lastday) = split(/,/, $cnt);
$total_c++;
$today_c++;
$your_c = &get_cookie($cookiename) + 1;
#####오늘과 어제의 연월일 취득
$ENV{'TZ'} = 'JST-9';
( $sec, $min, $hour, $day, $mon, $year ) = localtime(time);
($sec2, $min2, $hour2, $day2, $mon2, $year2 ) = localtime(time-24*60*60);
$mon++;
$year += 1900;
$today = "$year-$mon-$dayn";
$mon2++;
$year2 += 1900;
$yesterday = "$year2-$mon2-$day2n";
#####연월일 비교
if ($today ne $lastday) {
if ($yesterday ne $lastday) {
$yesterday_c = 0;
} else {
$yesterday_c = $today_c;
}
$today_c = 1;
$lastday = $today;
}
#####6자리수 변환
$total_c = sprintf("%06d", $total_c);
$today_c = sprintf("%06d", $today_c);
$yesterday_c = sprintf("%06d", $yesterday_c);
$your_c = sprintf("%06d", $your_c);
seek(CNT, 0, 0);
print CNT "$total_c,$yesterday_c,$today_c,$lastdayn";
&unlock_close(CNT);
#####HTTP헤더
print "Content-type: text/plainn";
&set_cookie($cookiename);
print "n";
print "cgi=$cgi&total=$total_c&yes=$yesterday_c&today=$today_c&you=$your_c&load=end&";
exit(0);
#####파일락 열기
sub lock_open {
local(*FILE, $name) = @_;
if (!open(FILE, $name)) {
print "content-type: text/plainnn";
print "$name파일을 열 수 없습니다.n";
exit(0);
}
if ($uselock) {
eval("flock(FILE, 2)");
if ($@) {
print "content-type: text/plainnn";
print "$@이 환경에서는 flock 은 사용할 수 없습니다$uselock = 0 으로 해주세요n";
exit(0);
}
}
seek(FILE, 0, 0);
}
#####파일락 닫기
sub unlock_close {
local(*FILE) = @_;
if ($uselock) {
eval("flock(FILE, 8)");
}
close(FILE);
}
#####===쿠키처리===############################################################################
#####쿠키유효기간
sub get_cookie_date {
$ENV{'TZ'} = 'JST-9';
my( $csec, $cmin, $chour, $cday, $cmon, $cyear, $cwday )
= localtime(time + $dday*60*60*24);
my(@month) = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my(@week) = qw(Sun Mon Tue Wed Thu Fri Sat);
return sprintf("%s, %d-%s-%04d %02d:%02d:%02d GMT",
$week[$cwday],$cday,$month[$cmon+1],$cyear+1900,$chour,$cmin,$csec);
}
#####쿠키의 출력
sub set_cookie {
local($cookiename2) = @_;
$cookiedate = &get_cookie_date;
print "Set-Cookie: $cookiename=$your_c; expires=$cookiedate; n";
}
#####쿠키의 취득
sub get_cookie {
local($cookiename1) = @_;
@pairs = split(/; /, $ENV{'HTTP_COOKIE'});
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
if ($name eq $cookiename) {
return $value;
}
}
return '';
}
댓글 2
-
아린
2002.08.22 15:17
PHP를 고치는게 아니라 플래쉬를 고쳐야 하는게 아닌지요 -
myself2
2002.08.22 18:02
fla파일에서.. 보여지는 모양을 수정해야 할꺼 같은데요.. ^^
php는 안보이는 부분에서 db들만 처리만 하는거니까..