|
楼主 |
发表于 2005 年 3 月 16 日 13:26:40
|
显示全部楼层
<html>
# C& [4 \0 w0 ]& m# P' [7 _<head>
4 m5 M8 L6 i0 A4 f* \7 h8 R! J<title>访客计数器 </title>6 x& T/ c9 s$ v
</head>
! b4 a/ y$ J1 x" X& ~" Y<body>) u- N! I3 `+ I" n0 s. q
<?php# @; r2 w8 f" u
, v8 K7 B, y4 } Q5 ?' | d
$counterFile = "/tmp/counter.txt";
: K) \: l+ r; O f+ e
8 ]5 Z% B: R* E1 B6 u& Q/ jfunction displayCounter($counterFile) {6 t9 n& F+ p6 _" Z; Q
$fp = fopen($counterFile,"rw");
; O0 b9 E5 U: |/ z $num = fgets($fp,5);4 V4 S, J) `" O8 {2 u0 Y3 r
$num += 1;1 s' K& L. n, V' U: b5 |! T1 F
print "您是第 "."$num"." 位想我份子,既然路过了请留下名字感谢你访问我bluejack的贴子"; E# `8 C" E+ L: q# h& u/ p
exec( "rm -rf $counterFile");
, f" ~2 ~! \3 j exec( "echo $num > $counterFile");
, {9 S5 U# h1 i3 e) G; P# i, \}. w" J; g1 O7 c) X
$ f; a9 l) \% ^
if (!file_exists($counterFile)) {1 [; e& N4 t* l$ _' [4 [7 K f
exec( "echo 0 > $counterFile");8 o& z- u; A, k4 ?
}
D, E8 G \- F7 B+ ^2 K; U' o |" k5 X: ~7 J5 Z2 I; I6 e
displayCounter($counterFile);
1 v- t6 Z' n7 q$ u& E& r0 Y( p: p3 L# s% y
?>
( i! b% T/ S6 \ }/ ~5 D+ v. p- G</body>+ G( u% t- w& o! K# |+ y, g
</html> |
|