-------------------------------------------------------------------------------- 請保持文章的完整性 -------------------------------------------------------------------------------------- <? //counter.php All rights reserved http://sports98.126.com //類似163的計數器,可以申請使用,開通多用戶服務,[圖片計數器]v1.00 代碼免費,如果您使用本代碼請保證您的代碼也要完全公布
$counterfile="./counter/${name}.txt"; //定義數據文件; $fp=fopen("$counterfile","rw"); //打開數據文件 $usernumber=fgets($fp,8); //取出數據文件數據 $usernumber+=1; //將數據計算 $int_counter=$usernumber; //分出一個操作變量 $int_pan=10000000; //定義被除數 for($int_b1=0;$int_b1<=7;$int_b1++) //此循環為判定數據將數據更改為圖象位置 { $int_a[$int_b1]=$usernumber / $int_pan; $int_a[$int_b1]=intval($int_a[$int_b1]); $int_a_a[$int_b1]=selectpic($int_a[$int_b1],$xxxx); /* 注意這里如果是單用戶可以省略使用函數,使用函數是為了多用戶使用,將數據加密使用 */ $usernumber=$usernumber % $int_pan; $int_pan=$int_pan /10; } echo "<div style="border:dotted;width:xxx;border-color:${rgb};height:xxx;cursor:hand;">"; //輸出數據圖象框架 for($int_la=0;$int_la<=7;$int_la++) { echo "$int_a_a[$int_la]"; //輸出數據圖象 } echo "</div>"; exec("del $counterfile"); //刪除數據文件防止追加 //unix 下使用 exec("rm -vf $counterfile"); exec("echo $int_counter > $counterfile"); //添加最新數據到文件內 function selectpic($int_tmp,$path) //判定圖片位置函數 { $int_pic="<img src='http://www.okasp.com/techinfo/pic/${path}/${int_tmp}.gif'>"; return($int_pic); } ?> ------------------------------------------------------------------------------------ <? //jsq.php //申請的時候,最好使用數據庫將申請名單保存,以便以后發現盜用者,在這里我沒考慮用戶驗證 //可以直接生成這個文件就可以了 if($submit){ $db=mysql_connect("host","name","password") or die ("connect faild!"); mysql_select_db("table",$db); $query="insert into table value('','')"; $result=mysql_query($query,$db); exec("echo 0 > ./counter/${username}.txt"); print "<h1>恭喜!您已經成功的申請到服務了</h1>"; print "請使用以下代碼<script language=javascript src="http://host/cccc.php?name=xxxx&xxxx=1&rgb=color"></script>"; ?> ----------------------------------------------------------------------------------- //cccc.php document.write("<? include "./counter.php" ?>");
//注意本計數器 結合mysql后添加驗證就可以進行申請服務了。 //調試在oso通過,在51順利通過,在2000+iis5.0+php4.0.5順利通過
|