一个简单计数器的源代码_php基础

<?
$memo_file="phpcount/vst.txt";
if ($phpxcount<>$REMOTE_ADDR){
$visits = file($memo_file);
$number_of_last_visit = $visits[0];
$number_of_new_visit = ++$number_of_last_visit;
$fp = fopen($memo_file, "w");
$fw = fwrite($fp, $number_of_new_visit);
fclose($fp);

$len_str = strlen($number_of_new_visit);
for($i=(0);$i<$len_str;$i++){
$numbers_exploded = substr($number_of_new_visit,$i,1);
$output_str = $output_str . "<img src="$numbers_exploded.gif">";
}
}else{
$visits = file($memo_file);
$number_of_last_visit = $visits[0];
$number_of_new_visit = $number_of_last_visit;
$fp = fopen($memo_file, "w");
$fw = fwrite($fp, $number_of_new_visit);
fclose($fp);

$len_str = strlen($number_of_new_visit);
for($i=(0);$i<$len_str;$i++){
$numbers_exploded = substr($number_of_new_visit,$i,1);
$output_str = $output_str . "<img src="$numbers_exploded.gif">";
}
}
echo $output_str;
?>   

时间: 2024-08-01 09:22:58

一个简单计数器的源代码_php基础的相关文章

一个简单计数器的源代码

<? $memo_file="phpcount/vst.txt"; if ($phpxcount<>$REMOTE_ADDR){ $visits = file($memo_file); $number_of_last_visit = $visits[0]; $number_of_new_visit = ++$number_of_last_visit; $fp = fopen($memo_file, "w"); $fw = fwrite($fp, $

很实用的一个完整email发送程序_php基础

很实用的一个完整email发送程序,很简单,把下列代码复制到一个空白文本页面,如index.php,运行就行了.具体实例:http://zsvalley.uhome.net/email/index.php. 以下是完整的源代码:(有任何问题请email:zsvalley@cmmail.com) <? if ($ok=='yes'){ //        SetCookie("yname", $yname);  //        SetCookie("yemail&qu

php结合表单实现一些简单功能的例子_php基础

例子一(POST提交表单): 复制代码 代码如下: <html> <head> <title> Chunkify Form </title> </head> <body> <form action="chunkify.php" method="POST"> Enter a word: <input type="text" name="word&qu

多数据表共用一个页的新闻发布_php基础

本文为了简单并能够说明主要内容,一些次要的html内容相对简单. 在网站有多个内容要在某一页显示时可在网页中共用一个显示和提交. 本例中有两个数据表(news,ctm):一个主页(index.php): 一个提交页(index_pub.php:和一个包函页(index_view.php) 一个子页(view_d.php). ----news,ctm--- increate table news(id int(80) not null auto_increment,title char(100),

超级简单的发送邮件程序_php基础

最近做一个新闻系统,为了模仿各大网站的在线发信功能就写了这个小程序,希望对各位菜鸟兄弟有用.     我没有给出一部分代码,只给出关键部分.其中shouxin代表收信人地址,shouren代表收信人姓名,jixin代表发信人地址,faren代表发信人姓名.id是前边传过来的参数,对你来说根本没什么用的. <? if($shouxin=="") { echo "没有收件人的地址,无法寄出"; }else{ $to=explode(',',$shouxin); $

PHP制作图型计数器的例子_php基础

以前在奥索看见过很多这样的例子,各各方法复杂,请看如下例子实现图形计数器.在网页中使用请用 <script src="http://文件地址"></script> <? //存放计数的文本文件 $count="count.txt"; //计数器的位数,如果不填则默认为6位 $wei=""; //图像的URL路径 $tu="http://127.0.0.1/tcount/images"; ?>

一个域名查询的程序_php基础

(主要用了两个字符串函数implode()和explode) 我制作的域名查询的源代码,主要用了两个字符串函数implode()和explode,利用这两个函数的切割字符串的强大功能,可以查询.com,.net.,org.,cc.,tv下的域名whois. <?php echo '<center><form>'; echo '<input type="text" name="string">'; echo '<inpu

php学习之简单计算器实现代码_php基础

复制代码 代码如下: <html> <head> <title>PHP实现简单计算器</title> <meta http-equiv="Content-Type" content="text/html;charset=gb2312"> </head> <?php //单路分支 if(isset($_GET["sub"])) { $num1=true;//数字1是否为空

一个显示天气预报的程序_php基础

刚开始学PHP,先编写了一个程序,放在自己的主页上,可以显示天气预报,当然还很不完善,希望大家给提意见.程序如下:<?$fcont=file("http://www.bjmb.gov.cn/today.asp");$arr=array();for($i=0;$i<count($fcont);$i++){    $tmp=$fcont[$i];    $tmp=ereg_replace("<br>"," ",$tmp);