当前位置: 首页 > 图文教程 > 网络编程 > PHP > 综合图片计数器

PHP
一贴学会PHP 新手入门教程
用PHP的ob_start() 控制您的浏览器cache
谈谈新手如何学习PHP 默默经典版本
黑夜路人出的几道php笔试题
一些 PHP 管理系统程序中的后门
用php获取本周,上周,本月,上月,本季度日期的代码
PHP 简单数组排序实现代码
PHP 多维数组排序实现代码
php 全局变量范围分析
php_xmlhttp 乱码问题解决方法
PHP 数组学习排序全接触
php Sql Server连接失败问题及解决办法
PHP 翻页 实例代码
php 随机数的产生、页面跳转、件读写、文件重命名、switch语句
PHP 5.3.0 安装分析心得
php 生成WML页面方法详解
php 取得瑞年与平年的天数的代码
php empty函数 使用说明
php natsort内核函数浅析
PHP 源代码分析 Zend HashTable详解

PHP 中的 综合图片计数器


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 245 ::
收藏到网摘: n/a

--------------------------------------------------------------------------------
请保持文章的完整性
--------------------------------------------------------------------------------------
<?
//counter.php All rights reserved http://sports98.126.com
//类似163的计数器,可以申请使用,开通多用户服务,[图片计数器]v1.00 代码免费,如果您使用本代码请保证您的代码也要完全公布
$counterfile="/upload/tech/20091012/20091012013156_23ce1851341ec1fa9e0c259de10bf87c.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='/upload/tech/20091012/20091012013156_598b3e71ec378bd83e0a727608b5db01.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顺利通过