Suggestion for Hit count:
1. Create table to store the
hit counts into Database.
2. That table having the fields like
(a.) auto_increment_id (Primary Key)
(b.) file_name
(c.) user_ip_address
(d.) date_time_visit
3. Write an INSERT query to insert a record into the Database
Query: INSERT INTO table_name
SET file_name = 'VALUE1',
user_ip_address = 'VALUE2',
date_time_visit = 'VALUE3'
VALUE1 -- basename($_SERVER['PHP_SELF'])
VALUE2 -- $_SERVER['REMOTE_ADDR']
VALUE3 -- date('Y-m-d H:i:s')
4. VALUE1 is used to store for which filename visited by the user
5. VALUE2 is used to store the IP address of the visited user
6. VALUE3 is used to store the visited time of the user
7. Write the INSERT in (STEP 3) on your common areas
i.e. Header or Footer or leftpanel, or other regions loaded every time on every files in our site
8. If you want Total number of hits of all the files i.e. our entire site ?
Query : SELECT count(auto_increment_id) FROM tablename
this query answers for this question
9. Total number of hits for a particular file i.e. login.php
$current_filename = basename($_SERVER['PHP_SELF']);
Query: SELECT count(auto_increment_id) FROM tablename WHERE filename = '$current_filename';
this query answer for this question
Conclusion:
I hope you got some idea about getting the hit count using PHP..
Sunday, September 21, 2008
Subscribe to:
Post Comments (Atom)
Popular Posts
-
1. How old PHP language is? - PHP began in 1994, so 14 years old. 2. What are different names of PHP? - PHP originally stood for Persona...
-
HTML: a. HTML is a markup language that is used to build static (non interactive and nonanimated) webpages. b. HTML is Case-Insensitive. So...
-
A payment gateway is an e-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks...
-
Note : This is not a perfect sort order, we have just displaying the list of PHP companies. 1. Photon Infotech No. 2/102, Arvind IT Park (N...
-
- count() -- Count elements in a variable - syntax for count() [int count ( mixed var [, int mode])] - If the optional mode parameter is set...
-
Hai all, Simple show hide sample using Show/Hide? Simple Show/Hide code
-
Sharing PHP, MySQL, Javascript, CSS Knowledge, We can share our PHP knowledge on the basis of PHP versioning, Javascript, AJAX, Stylesheet, ...
-
Use the below code and you can get the exact value in php as us saw in browser. Code: $encode_data = iconv('UTF-8', 'windows-125...
-
Download and Enjoy!
-
A hyperlink is a text or a image that you can click on, and move from one page to another web page. Syntax: < a href= "web pag...
1 comment:
I have read your blog its very attractive and impressive. I like it your blog.
PHP Training in chennai | PHP Training Course
PHP Training in chennai | Online PHP Course
Post a Comment