Http stats login php

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

curl statistics made simple

License

reorx/httpstat

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

screenshot

httpstat visualizes curl(1) statistics in a way of beauty and clarity.

It is a single file 🌟 Python script that has no dependency 👏 and is compatible with Python 3 🍻 .

There are three ways to get httpstat :

  • Download the script directly: wget https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py
  • Through pip: pip install httpstat
  • Through homebrew (macOS only): brew install httpstat
python httpstat.py httpbin.org/get

If installed through pip or brew, you can use httpstat as a command:

Because httpstat is a wrapper of cURL, you can pass any cURL supported option after the url (except for -w , -D , -o , -s , -S which are already used by httpstat ):

httpstat httpbin.org/post -X POST --data-urlencode "a=b" -v

httpstat has a bunch of environment variables to control its behavior. Here are some usage demos, you can also run httpstat —help to see full explanation.

  • HTTPSTAT_SHOW_BODY Set to true to show response body in the output, note that body length is limited to 1023 bytes, will be truncated if exceeds. Default is false .
  • HTTPSTAT_SHOW_IP By default httpstat shows remote and local IP/port address. Set to false to disable this feature. Default is true .
  • HTTPSTAT_SHOW_SPEED Set to true to show download and upload speed. Default is false .
HTTPSTAT_SHOW_SPEED=true httpstat http://cachefly.cachefly.net/10mb.test . speed_download: 3193.3 KiB/s, speed_upload: 0.0 KiB/s
HTTPSTAT_CURL_BIN=/usr/local/Cellar/curl/7.50.3/bin/curl httpstat https://http2.akamai.com/ --http2 HTTP/2 200 .

For convenience, you can export these environments in your .zshrc or .bashrc , example:

export HTTPSTAT_SHOW_IP=false export HTTPSTAT_SHOW_SPEED=true export HTTPSTAT_SAVE_BODY=false

Here are some implementations in various languages:

  • Go: davecheney/httpstat This is the Go alternative of httpstat, it’s written in pure Go and relies no external programs. Choose it if you like solid binary executions (actually I do).
  • Go (library): tcnksm/go-httpstat Other than being a cli tool, this project is used as library to help debugging latency of HTTP requests in Go code, very thoughtful and useful, see more in this article
  • Bash: b4b4r07/httpstat This is what exactly I want to do at the very beginning, but gave up due to not confident in my bash skill, good job!
  • Node: yosuke-furukawa/httpstatb4b4r07 mentioned this in his article, could be used as a HTTP client also.
  • PHP: talhasch/php-httpstat The PHP implementation by @talhasch

Some code blocks in httpstat are copied from other projects of mine, have a look:

  • reorx/python-terminal-color Drop-in single file library for printing terminal color.
  • reorx/getenv Environment variable definition with type.

About

curl statistics made simple

Источник

Сбор статистики на PHP

Статистические сведения о посетителях сайта приносят не мало пользы. По статистике можно подогнать дизайн сайта в соответствии с разрешением большинства посетителей, подогнать дизайн к браузеру, на котором приходят большая часть посетителей да и просто интересно, кто заглядывает к вам на сайт, из под какой OC, а может это поисковый робот яндекса или гугла? Хотя некоторые системы слежения за посетителями бывают черезвычайно сложными, но с помощью довольно простой системы можно получить любопытные сведения о посетителях сайта. Я покажу как сделать с виду простой журнал посещений сайта с помощью PHP и cookies (MySQL не требуется). К тому же мой пример можно легко расширить.

Для того, что бы система работала, нужно скрипт статистики встроить в каждую страницу. Ну или в те страницы, статистику посещений которых вы хотите увидеть. Наш скрипт будет записывать следующие данные:

  • Браузер + OC (HTTP_USER_AGENT)
  • IP адрес (REMOTE_ADDR)
  • Хост (REMOTE_HOST)
  • Страницу-рефферер (HTTP_REFERER)
  • Время визита (date(«d.m.Y H:i:s»))
  • Запрашиваемый адрес (REQUEST_URI)

Даже эти данные, я думаю, будут весьма интересны веб-мастерам. Итак, начнем. Скрипт будет называться sniffer.php. Я приведу текст всего скрипта и дополню это обильными комментариями:

 extract($HTTP_GET_VARS); extract($HTTP_POST_VARS); extract($HTTP_COOKIE_VARS); extract($HTTP_SERVER_VARS); //этот фрагмент кода был позаимствован //из системы PHP Nuke ;) //далее объявляю переменные $fileName="stat.txt"; //имя файла со статистикой $maxVisitors=30; //количество записей, отображаемых //при просмотре статистики $cookieName="visitorOfMySite"; //имя куки $cookieValue="1"; //значение куки $timeLimit=86400; //срок в секундах, который должен //пройти с момента последнего посещения сайта, что бы //информация о посетителе записалась повторно. Это //значение равно 1 дню, т.е. один и тот же посетитель //записывается в статистику раз в одни сутки. Если //эту переменную приравнять к нулю, то будут учитываться //все посещения одного и того же посетителя //далее следуют переменные, отвечающие за отображение //статистики $headerColor="#808080"; $headerFontColor="#FFFFFF"; $fontFace="Arial, Times New Roman, Verdana"; $fontSize="1"; $tableColor="#000000"; $rowColor="#CECECE"; $fontColor="#0000A0"; $textFontColor="#000000"; //все переменные подготовлены. //Функция записи данных о посетителе function saveUserData() < GLOBAL $fileName, $HTTP_USER_AGENT, $REMOTE_ADDR, $REMOTE_HOST, $HTTP_REFERER, $REQUES_URI; $curTime=date("d.m.Y @ H:i:s"); //текущее время и дата //подготавливаю данные для записи if (empty($HTTP_USER_AGENT)) if (empty($REMOTE_ADDR)) if (empty($REMOTE_HOST)) if (empty($HTTP_REFERER)) if (empty($REQUEST_URI)) $data_ = $HTTP_USER_AGENT."::".$REMOTE_ADDR."::".$REMOTE_HOST.":: ".$HTTP_REFERER."::".$REQUEST_URI."::".$curTime."rn"; //разделителем будут два ":" //далее пишу в файл if (is_writeable($fileName) ) : $fp = fopen($fileName, "a"); fputs ($fp, $data_); fclose ($fp); endif; > //функция записи готова. Теперь нужно написать //функцию вывода данных из файла статистики function showStat () < GLOBAL $headerColor, $headerFontColor, $fontFace, $fontSize, $tableColor, $fileName, $maxVisitors, $rowColor, $fontColor, $textFontColor; //вывожу таблицу $fbase=file($fileName); $fbase = array_reverse($fbase); $count = sizeOf($fbase); echo ""; echo "Всего посещений: $count

"; echo " "; echo "< font face="$fontFace" color="$headerFontColor" size="$fontSize">Браузер
IP Хост Ссылка Страница Время визита"; echo ""; //открываю файл и запускаю цикл $fbase=file($fileName); $fbase = array_reverse($fbase); for ($i=0; $i= sizeof($fbase)) $s = $fbase[$i]; //разделяю $strr = explode("::", $s); if (empty($strr)) //вывожу данные echo "< font face="$fontFace" color="$fontColor" size="$fontSize">$strr[0] < font face="$fontFace" color="$fontColor" size="$fontSize">$strr[1] < font face="$fontFace" color="$fontColor" size="$fontSize">$strr[2] < font face="$fontFace" color="$fontColor" size="$fontSize">$strr[3] < font face="$fontFace" color="$fontColor" size="$fontSize">$strr[4] < font face="$fontFace" color="$fontColor" size="$fontSize">$strr[5] "; endfor; > ?>

Скрипт сбора и показа статистики готов. Теперь нужно вставить в те страницы, информацию о посетителях которой вы хотите просмотреть:

Здрасьте! А мона вас посчитать? Можно? Ну спасибо! Я вас посчитал! 😉

Обратите внимание, что этот код нужно вставлять в самый верх страницы, до того, как данные будут передаваться в браузер. В противном случае установить куки не получится. Далее сделаем страницу, выводящюю статистику:

Здесь мы просто включили файл sniffer.php и вызвали из него функцию showStat() Вот с помощью такого небольшого скрипта, длинной всего ровно в 100 строк, можно с помощью PHP получить и в удобном виде просмотреть. Здесь ещё много чего предстоит сделать, например сделать статистику по реферерам, браузерам. Так же можно из HTTP_USER_AGENT вытащить браузер и ОС и записать их в более удобном виде. Кстати, все размеры при выводе статистики я расчитывал при разрешении 1024*768 и у меня все удобно помещается в одну строку.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A WordPress plugin that tracks the daily count of registered user login in the site

tareq1988/User-Login-Stat

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

readme.txt

=== User Login Statistics === Contributors: tareq1988 Donate link: http://tareq.weDevs.com Tags: user, login, stat, statistics Requires at least: 3.2 Tested up to: 4.1.1 Stable tag: trunk Track registered users login activity == Description == A simple plugin that tracks registered users login statistics per day. You can track how many registered users are signing in to your site everyday. No extra configuration needed. Just creates a plugin page in admin panel and displays everydays user login count. Want to contribute? [Fork here](https://github.com/tareq1988/User-Login-Stat) == Installation == No extra configurations are there right now. 1. Upload the plugin to the `/wp-content/plugins/` directory 2. Activate the plugin through the 'Plugins' menu in WordPress 3. Done == Frequently Asked Questions == = Does it have widgets? = Nope, currently there isn't any == Screenshots == 1. Screenshot of this plugin == Changelog == Nothing is there right now == Upgrade Notice == Nothing is there right now

About

A WordPress plugin that tracks the daily count of registered user login in the site

Источник

Читайте также:  App local index php
Оцените статью