一个简单的免费php计数器
这个是用数据库管理的。
建议数据库
create table count(
userid varchar(20) not null,
count varchar(20) not null,
ip varchar(20) not null
);
申请页面
if(!isset($submit))
{
?>
}
else
{
$mysql_db=mysql_connect("localhost","root","") or die("数据库连接失败");
mysql_select_db("footboy",$mysql_db) or die("数据库选表失败");
$sql="select * from count where userid=$userid";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
$ip=getenv("remote_addr");
if($num || $userid=="")//判断该ID是否存在,及输入是否正确
{
printf("%s已经存在或输入为空",$userid);
print("返回");
mysql_close();
}
else
{
$insert="INSERT INTO count VALUES($userid,1,$ip)";//满足条件,记录数据
mysql_query($insert);
print("$userid,恭喜您申请成功返回
");
print("您可以用以下代码应用http://footboy.host.wayall.com/count/count.php?userid=$userid");
mysql_close();
}
}
?>
应用页面
$mysql_db=mysql_connect("localhost","root","");//连接数据库
mysql_select_db("footboy",$mysql_db);
$sql="select * from count where userid=$userid";//数据库查询
$result=mysql_query($sql);
$sql_row=mysql_fetch_array($result);
$num=mysql_num_rows($result);//判断用户是否已经申请
$count=$sql_row[count];//取出计数器数据
//将数据格式化成5位
$count_len=strlen($count);
for($i=0;$i{$count="0".$count;}
//取得浏览用户IP,防止重复刷新
$ip=getenv("remote_addr");
if($num)
{
if($ip!=$sql_row[ip])
{
$sql_row[count]++;//条件满足开始记数输出
printf("您是第%s个浏览本站的
",$count);
mysql_query("update count set count=$sql_row[count],ip=$ip where userid=$userid");//存入数据
mysql_close();
}
else
{
printf("您是第%s个浏览本站的
",$count);
print("欢迎您再次光临本站");
}
}
else
printf("%s用户不存在,请先申请",$userid);
mysql_close();
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

The OKX trading platform offers a variety of rates, including transaction fees, withdrawal fees and financing fees. For spot transactions, transaction fees vary according to transaction volume and VIP level, and adopt the "market maker model", that is, the market charges a lower handling fee for each transaction. In addition, OKX also offers a variety of futures contracts, including currency standard contracts, USDT contracts and delivery contracts, and the fee structure of each contract is also different.

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.
