ArticleTrader.com
  

 Main Menu

  Home
  Member Login
  Forum
  Submit Article
  Membership
  RSS Feeds
  Contact Us
  About

 Services

  Article Distribution
  Link Building

 Tools

  ArticleMS
  Directory Tracker

 Categories

  Automotive
  Business
  Computers
  Entertainment
  Finance
  Food
  Health
  Home and Family
  Internet
  Legal
  Science
  Self Improvement
  Shopping
  Society
  Sports
  Technology
  » Mobile Phones
  » Satellite Radio
  » VOIP
  Travel
  Writing

187 users online.



 
  » Category Sponsors
  Get Your Link Here - Limited Time Bargain at only $14/month!

Home » Technology » Statistics of web development in PHP

softlogic
Article written by softlogic

View Full Profile
Get Html Code
PDF | Print View | Post to your Site

Statistics of web development in PHP

Submitted by Netultimate
Fri, 26 Jun 2009

Make Money With Your Site!
Sell Links off your
site at ReverseLinks.
Buy Permenant Links
Get Permanent Text Links
for cheap.
Let's start with the database part. We'll need only one table that stores each click (page impression) of each visitor. The name of the table will be "hits". What should we store here?

1. The hostname is very important to identify the client. PHP gives us the IP address that I like to convert to hostname with gethostbyaddr(). I think it's better to see a string.
2. The time of visit can be stored easily by using the NOW() function of MySQL.
3. The visited page on your site should be stored. In most cases, you should store the URL of the visited page and the HTML title in two separated fields, eg. URL and Title fields, so that you'll be able to see your most visited sites simply by looking through the list of their titles.

Now we're going to write the piece of code that will save the hit. It will be called at the beginning of the program. To save the requested URL in the database you can use $_SERVER ['PHP_SELF'] that gives you the URL without the domain name or $_SERVER ['QUERY_STRING'] that gives you the parameters in the URL after the question mark.

Warning: $_SERVER['PHP_SELF'] doesn't contain the query string, only the path related to the server root and the filename.
I prefer $_SERVER['QUERY_STRING']. This can be especially useful if you use only one PHP to all functions, for example, you call "/index.php?op=forum&topicid=768" if you'd like to show a given forum topic or for showing articles /index.php?op=articles&id=25. Using QUERY_STRING, You will get "op=articles&id=25" that will be enough to identify the requested page.

Visit http://www.softlogiccorp.com

Phone:302 613 0469 (USA)

mail:support@softlogiccorp.com

--

 

At Softlogic, we provide innovative solutions for companies and businesses in order to help them optimize and enhance their business operations to global capabilities.


Source: ArticleTrader.com
Creative Commons License

Comments

No comments posted.

Add Comment

You do not have permission to comment. If you log in, you may be able to comment.

 Top Authors

 1 Stebee (3270)
 2 limalan88 (2920)
 3 alien82 (2756)
 4 kajuba (2508)
 5 sverdlow (1712)
 6 juliet (1691)
 7 jamiehanson (1690)
 8 MarkeD (1296)
 9 AnthonyF (1244)
 10 robertoms2003 (1210)
 11 articles (1205)
 12 artavia.seo (1148)
 13 spinxwebdesign (1112)
 14 gprather (1071)
 15 cj (1069)

 Distribution

Article Distribution

  
  Affiliate Program 2Checkout.com, Inc. is an authorized retailer of ArticleTrader.com

0.02s