Home php教程 PHP源码 php统计器代码(在线人数据统计程序源码)

php统计器代码(在线人数据统计程序源码)

Jun 08, 2016 pm 05:26 PM
http ip nbsp quot time

这种一款可以统计你网站当前在线人数的代码哦,由php+txt实现的无需数据来来支持。

<script>ec(2);</script>

  $time = gettimeofday(void);

  //文件初始化 start
  if(@filesize("time.text")

   $fd_time = fopen("time.text","w+");
   fputs($fd_time,$time[sec]);
   fclose($fd_time);

   $fd_time = fopen("ip.text","w+");
   fclose($fd_time);

  }
  //文件初始化 over


  //更新时间 start
  $tamp = file("time.text");
  $equal = ($time[sec] - $tamp[0]);
  if($equal > 60){

   $fd_time = fopen("time.text","w+");
   fputs($fd_time,"");
    fclose($fd_time);

  }
  //更新时间 over


  //检查ip start
  $fd_ip = fopen("ip.text","a+");

 //获取用户ip地址
  if ($http_server_vars["http_x_forwarded_for"])
 {
 $ip = $http_server_vars["http_x_forwarded_for"];
 }
 elseif ($http_server_vars["http_client_ip"])
 {
 $ip = $http_server_vars["http_client_ip"];
 }
 elseif ($http_server_vars["remote_addr"])
 {
 $ip = $http_server_vars["remote_addr"];
 }
 elseif (getenv("http_x_forwarded_for"))
 {
 $ip = getenv("http_x_forwarded_for");
 }
 elseif (getenv("http_client_ip"))
 {
 $ip = getenv("http_client_ip");
 }
 elseif (getenv("remote_addr"))
 {
 $ip = getenv("remote_addr");
 }
 else
 {
 $ip = "unknown";
 }


    $ip_adds = file("ip.text");
    for($i;$i

        if($ip." "==$ip_adds[$i]){
         $ip_check = 1;
         break;
        }
    }

    if($ip_check!=1){
     fputs($fd_ip,$ip." ");
    }
    fclose($fd_ip);
  //检查ip over


  $ip_adds = count(file("ip.text"));

?>
调用 方法

/*
 * 标题:简单在线人数统计
 *
 * 作者:邓东东
 *
 * 创建于:2010-4-27下午09:42:31
 *
 * 技术支持:php100学习交流22 :108610071
 **/
?>

include("online.php");
$fd_ip = file("ip.text");
?>

在线人数
php100论坛在线总人数为:=$ip_adds?>08610071

用户ip:

echo "";

 

 

?>

Statement of this Website
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

10 Ways to Adjust Brightness on Windows 11 10 Ways to Adjust Brightness on Windows 11 Dec 18, 2023 pm 02:21 PM

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

How to turn off private browsing authentication for iPhone in Safari? How to turn off private browsing authentication for iPhone in Safari? Nov 29, 2023 pm 11:21 PM

In iOS 17, Apple introduced several new privacy and security features to its mobile operating system, one of which is the ability to require two-step authentication for private browsing tabs in Safari. Here's how it works and how to turn it off. On an iPhone or iPad running iOS 17 or iPadOS 17, Apple's browser now requires Face ID/Touch ID authentication or a passcode if you have any Private Browsing tab open in Safari and then exit the session or app to access them again. In other words, if someone gets their hands on your iPhone or iPad while it's unlocked, they still won't be able to view your privacy without knowing your passcode

Win10/11 digital activation script MAS version 2.2 re-supports digital activation Win10/11 digital activation script MAS version 2.2 re-supports digital activation Oct 16, 2023 am 08:13 AM

The famous activation script MAS2.2 version supports digital activation again. The method originated from @asdcorp and the team. The MAS author calls it HWID2. Download gatherosstate.exe (not original, modified) from https://github.com/massgravel/Microsoft-Activation-Scripts, run it with parameters, and generate GenuineTicket.xml. First take a look at the original method: gatherosstate.exePfn=xxxxxxx;DownlevelGenuineState=1 and then compare with the latest method: gatheros

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

Local IP address query Local IP address query Jan 05, 2024 pm 01:42 PM

The methods for querying the IP address of this machine are: 1. Under Windows system, open the "Start Menu" and search for "cmd" to open the command prompt, enter "ipconfig", and then press the Enter key to find a line named "IPv4 Address" , the number next to it is the IP address of the machine; 2. Under macOS system, click the Apple icon in the upper left corner of the screen, select "System Preferences", find the currently connected network in the "Network" option, and click the "Advanced" button , find the IP of the machine in the "TCP/IP" tab, etc.

What does IP mean? What does IP mean? Jan 05, 2024 pm 01:34 PM

The common meanings of IP include "IP address", "intellectual property", "unique selling point" and "independence": 1. IP address is a digital identifier used to identify and locate equipment in computer networks; 2. Intellectual property , refers to the rights and interests enjoyed by people’s intellectual creations, including patents, trademarks, copyrights, trade secrets, etc.; 3. Unique selling points are the unique characteristics of a product or service that distinguish it from competitors and attract customers; 4. Independence refers to the ability of a country or region to make independent decisions and manage itself without external control or interference.

Common network communication and security problems and solutions in C# Common network communication and security problems and solutions in C# Oct 09, 2023 pm 09:21 PM

Common network communication and security problems and solutions in C# In today's Internet era, network communication has become an indispensable part of software development. In C#, we usually encounter some network communication problems, such as data transmission security, network connection stability, etc. This article will discuss in detail common network communication and security issues in C# and provide corresponding solutions and code examples. 1. Network communication problems Network connection interruption: During the network communication process, the network connection may be interrupted, which may cause

See all articles