|
|
楼主 |
发表于 2005 年 3 月 16 日 13:26:40
|
显示全部楼层
<html>
, z2 ^/ i' f# d/ q* D5 j<head>% Z( a2 k4 ^7 W. X
<title>访客计数器 </title>! |7 f* B$ H- U0 @. c
</head>0 C2 V0 i3 \8 l3 s7 _
<body>+ I5 K( w) x' F: I0 h: g) K
<?php- a1 y* n& [: O& n& r
D5 R& r9 U9 t' b1 P7 O$counterFile = "/tmp/counter.txt";' @! G1 ]8 c* _7 v" M
- }8 K% K" e2 y- u8 \
function displayCounter($counterFile) {
/ p' U* m' t \" M $fp = fopen($counterFile,"rw");
' n, Z' t; [: ~, m. v+ p $num = fgets($fp,5);; M" |1 i9 ~5 Z) n! N
$num += 1;
/ c; ]( b6 r" y d; G print "您是第 "."$num"." 位想我份子,既然路过了请留下名字感谢你访问我bluejack的贴子";/ y# S$ ~6 f1 D
exec( "rm -rf $counterFile");
. Z0 z9 D' U3 z4 P exec( "echo $num > $counterFile");6 q( r& x# g; D5 m! {2 F$ k
}
" v' Z, n' r+ P! `, b1 g
' j' x1 i a/ Kif (!file_exists($counterFile)) {
- T5 z. `! ~' H. ] exec( "echo 0 > $counterFile");
; o, k7 I0 W. o6 I {}
' w% R5 _" _! t& x3 w$ Q
% c0 H6 l" e# `4 g" @displayCounter($counterFile);
9 A. X r, ?. B) V t' M9 F( |) k9 k7 |# K# y. u
?>4 p( ~( w" b' K i3 Z. H# r7 V# _, K
</body>
/ z) U& ^0 u7 S</html> |
|