|
|
楼主 |
发表于 2005 年 3 月 16 日 13:26:40
|
显示全部楼层
<html>5 i0 y8 |/ p5 {7 w4 T
<head>* y( K! N4 u9 t% [
<title>访客计数器 </title>% F, P" E2 s* _8 R/ F/ O
</head>& y7 |- d* Y9 b
<body>
1 q- ]2 s; c! S: F5 h<?php
5 V& r$ n5 ?) ~: j* x0 m
% A$ I* i4 P6 P$counterFile = "/tmp/counter.txt";1 m( A5 w, _7 I$ J- R* J" w" B5 _
- ]! p- R5 ]$ I; D+ G: L
function displayCounter($counterFile) {" o! q7 O8 `5 a
$fp = fopen($counterFile,"rw");
- ?! o: L9 g9 R: x6 V $num = fgets($fp,5);# q. t% Q* @/ y3 [; ~: I5 h7 S
$num += 1;* d; L7 \ t* I( F0 \
print "您是第 "."$num"." 位想我份子,既然路过了请留下名字感谢你访问我bluejack的贴子";
( y8 M7 @% q2 Q& r exec( "rm -rf $counterFile");
4 t4 n9 S3 E) Z4 Z exec( "echo $num > $counterFile");
e5 a/ ~& ^! K, N$ V- q}3 o+ d1 v2 |; _3 _1 h7 Y- U
/ D# A* r; Q# H5 u3 ?1 lif (!file_exists($counterFile)) {
& h) U9 }4 q5 C' D$ C: |% O exec( "echo 0 > $counterFile");9 `/ Q! B. |9 X; @
}
: J2 J3 D( v C* s' S' C! S, @1 h. @# i
displayCounter($counterFile);
, m5 Q! V$ _3 n2 T* F+ U# L; u- d3 o1 {* P# x7 C, l& G$ K
?>( _2 z# ~- N# y/ c! ?
</body>: H! m, H' n+ L5 D
</html> |
|