473,408 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

filtering an ip address

29
I have a hit counter on my website that I wrote. I would like to filter out the ip address for our store to keep it from polluting a true record of outside hits. Is there a PHP or MYSQL system variable that records the ip address of the user so I could say something like:

Expand|Select|Wrap|Line Numbers
  1. <?PHP
  2. if (ip_address == 'my_address') {
  3.    $hits = $row_hits['hits'];
  4. } else {
  5.    $hits = ($count+1);
  6. }
  7. mysql_query("UPDATE tbl_count SET hits='$hits'");
  8. ?>
Thanks for any help

Robert
Jan 10 '08 #1
3 1165
ak1dnar
1,584 Expert 1GB
Are you looking for something like in this article?
http://www.plus2net.com/php_tutorial/php_ip.php
Jan 10 '08 #2
rlm51
29
I did a little research and found:
$ip=$_SERVER['REMOTE_ADDR'];

So I wrote it as:

Expand|Select|Wrap|Line Numbers
  1. $ip=$_SERVER['REMOTE_ADDR'];
  2. $today = date('D');     
  3.   if ($ip == 'my_address') {
  4.     $hits = $row_hits[$today];
  5.   } else {
  6.     $count = $row_hits[$today];
  7.     $hits = ($count+1);
  8.   }
Thanks for your efforts.

See you all next time ...

Robert
Jan 11 '08 #3
ak1dnar
1,584 Expert 1GB
I did a little research and found:
$ip=$_SERVER['REMOTE_ADDR'];

So I wrote it as:

$ip=$_SERVER['REMOTE_ADDR'];
$today = date('D');
if ($ip == 'my_address') {
$hits = $row_hits[$today];
} else {
$count = $row_hits[$today];
$hits = ($count+1);
}

Thanks for your efforts.

See you all next time ...

Robert
And thank you so much for sharing the solution with us.
Jan 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Tim Pollard | last post by:
Hi I am trying to filter a table of users to select only those records whose roleID matches a value in an array. There could be any number of IDs held in the array from one to a few hundred. The...
3
by: Aionius | last post by:
Good day to all. I have this problem in JavaScript. I have a form (textbox) which accepts a series of numbers in format 9999-9999-9. Now i want to filter all inputs to the textbox. let's say...
3
by: Mark V. | last post by:
Here's what I have and I'm stumped. I have a table that has several thousand names and addresses. I only want to send to one address in a household. So what I would like to do is create a new...
0
by: Monir | last post by:
Hi guys, I made a database with two tables ( tblsender, tblreceiver) with one to many relationship. tblsender has sender_Id (pk) sender_name, address, phone, email etc. tblreceiver has...
0
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: Patrick Useldinger | last post by:
Hi all, I am looking to write a filtering DNS proxy which should - receive DNS queries - validate them again an ACL which looks as follows: { 'ip1':, 'ip2':, ... } - if the request is valid...
2
by: JUAN ERNESTO FLORES BELTRAN | last post by:
Hi you all, I am developping a python application which connects to a database (postresql) and displays the query results on a treeview. In adittion to displaying the info i do need to implement...
3
by: Anup Daware | last post by:
Abstract: I want to filter a dataview with a value where column name have a SPACE. Description:- I bind a dataview to a datagrid, The query which is fetching the results in Dataset is something...
19
by: didacticone | last post by:
I created a search form that works well except when i am searching for a record that has multiple entries in the corresponding table. i would to filter the results so that they will display all the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.