473,785 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

check variable against an array of words.

3 New Member
Hi,

First time posting here so please be gentle!

I wish to check a variable for a number of words that are in a array.

Not sure if this is the best way to do it, but this is what i have.

I have my own counter system that counts every visitor, but some of these visits are from BOTS, spiders..

So i wish to have a method of searching the HTTP_USER_AGENT for certain words i put in a array.

What i am after is how i get the words in an array and how i then get the script to check the HTTP_USER_AGENT for a word in the array and if so it will not complete the script. (not add to the counter)
if none of the words are in the HTTP_USER_AGENT then it will add to the counter.

so something like?

<?
// do array

// check if HTTP_USER_AGENT contains a word from array
if () {
// increase counter if none of the words are in HTTP_USER_AGENT
include(increas e.php);
}

?>


its the bit between the if () that i have no idea about, any help would be great.

cheers in advance for your help.

Jason
Nov 18 '06 #1
2 2532
ronverdonk
4,258 Recognized Expert Specialist
You already have exactly the same thread opened in the www.codingforums.com PHP forum at http://www.codingforums.com/showthread.php?t=100965 . And some people really helped you out!! Your exact last words in that forum thread were
but yes the code does work.

thank you so much for your help.

thank you for you patients
Ronald :cool:
Nov 19 '06 #2
cassbiz
202 New Member
You can save yourself a lot of trouble by just going out and getting AWSTATS

That will give you everything in a nutshell and will come right off of your http logs.
Nov 20 '06 #3

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

Similar topics

83
6530
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in C. It can cause very ugly errors,like this: epsilon=0 S=0 while epsilon<10: S=S+epsilon
15
2128
by: tabonni | last post by:
I want to check each button groups and save the checked value into a 2 dimensional array. But, it doesn't work. Could anyone tell me what's wrong with my code. My code is as follow: <html> <body> <script language="javascript"> <!-- var temp = new Array(2) var status = new Array();
17
12289
by: Davor | last post by:
How to define global variable in main()? I'm asking because I have an array in main, whose size is determined by input, so the definition has to be in main ( or in some other funcion ). And I need to use that array in my other functions, so I want it to be global. I tryed using extern keyword, but I gut some error, so I supose that's not it. thanks in advance Davor :-)
4
2663
by: Friday | last post by:
Being an Old L.A.M.P guy, I beg you to please excuse my ignorance of dot.net (and all things Windows, for that matter). As part of an experiment (to learn enough ASP/VB.net to port a series of existing PHP scripts of mine to work on IIS), I have created the following simple function to compare a Website visitor's IP address against a varabe-array. The experiment invovleas a common scenario -- banning a Website visitor by IP Address: ...
5
37859
by: Jason | last post by:
Is there a mechanism in VB.NET that allows something like: If myVar In ("A","B","C") Then... The way I'm doing it now is: Select Case myVar Case "A","B","C" Or like this:
9
2042
by: howarthc | last post by:
OK - here is what I want to do - but I am lost how to do it. I have a variable $mystring = "one two three four five six seven eight nine" This variable $mystring can be 4 words long or it could be 50 words long it is totally variable. What I want to do is take the number of words in $mystring, divide by three and insert a <brat the end of each "line".
112
5482
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions that may print some messages. foo(...) { if (!silent)
17
3261
by: wswilson | last post by:
In python, I could write: a = 1 if a in : do something... In c (and many other languages):
2
3202
by: slimewizard | last post by:
Hello there! I'm writing a 'hang man' program as a bit of a practice exercise and I've ran into a bit of a problem; I just need a little advise if anyone would be so kind. My apologies if this has been covered here before; I've tried googling this but I don't know how to word it so my results have been quite unhelpful. I'll try my best to explain what I'm trying to do through example. (Sorry if this is long winded :/) I wrote a...
0
9483
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.