search
Homephp教程php手册打造计数器DIY三步曲(上)

打造计数器DIY三步曲(上)

Jun 13, 2016 pm 12:41 PM
diysuperiorpeopleusebuilddatabasesongofmy owncounterforum

人大多都很向往使用数据库来做自己的计数器,留言本,论坛之类的东西了,本篇将介绍本人自制的计数器程序。
    首先建立0~9这10个GIF数字图片,放在img文件夹下,再建立一个PHP文件
——count1.php,程序如下:

$linkptr=mysql_pconnect("localhost","yourname","password");

mysql_select_db("yourname",$linkptr);
mysql_query("update counter
   set visited=visited+1 where num=1",$linkptr);
$result=mysql_query("select visited
   from counter where num=1",$linkptr);
list($counter)=mysql_fetch_row($result);
$counter=sprintf("%05d",$counter);

for($i=0;$i   $tmpstr="打造计数器DIY三步曲(上)";
   echo $tmpstr;
   }
?>
    在主页上适当位置放置代码 include "count1.php" ?>,这样主页上就显示了你的计数器,不过要记住在你的数据库上建立一个TABLE——counter:create table counter(
   num int unsigned,
   visited int unsigned
);
    怎么样,容易吧!中篇我将介绍怎样让你的镜像站也能用上你自己的计数器。  
                                                      

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools