Jump to content

Recommended Posts

ok i have a table in my stats package that has Last 10 referrers

 

now what i want to do is have an array in the config file so that i can block spam sites from the listing

 

so say the block list includes

 

www.google.com

www.yahoo.com

www.msn.com

 

so how can i on insert get it to check if the domain is included in the array

 

 

would i do it like this

 

if $domain is in array {

exit

} else {

insert statement

}

 

 

?

 

or is there a better way to do this

Link to comment
https://forums.phpfreaks.com/topic/106914-solved-mysql-and-arrays/
Share on other sites

for testing purposes i have this

 

if (in_array($blocked,$ref)) {
echo "BLOCKED";
} else {
echo "NOT BLOCKED";
}

 

 

getting this error

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/public_html/browser.php on line 288

NOT BLOCKEDError: Query was empty

 

 

 

this is my array

 

$blocked[] = "www.haggistech.co.uk";
$blocked[] = "haggistech.co.uk";

 

 

 

any ideas

ok this is working now

 

if (in_array($ref,$blocked)) {
echo "BLOCKED";
} else {
echo "NOT BLOCKED";
}

 

 

but

 

say i block www.google.co.uk

 

 

the referrer is

 

http://www.google.co.uk/search?hl=en&q=haggistech&meta=

 

how can i alter

 

if (in_array($ref,$blocked)) {
echo "BLOCKED";
} else {
echo "NOT BLOCKED";
}

 

to find out if www.google.co.uk is in the string

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.