/    Sign up×
Community /Pin to ProfileBookmark

Bad word filter

Hi,

I have this code and I like to know if its possible add a bad word filter on it.
Thank you in advance

[CODE]//inserting data order in database

$select=mysql_query(“SELECT * FROM Test WHERE tags=’$displaysearch’ LIMIT 1”) or die(mysql_error());

if( mysql_num_rows($select) ){
mysql_query(“UPDATE Test SET count=count+1 WHERE tags=’$displaysearch'”) or die(mysql_error());
}else{
mysql_query(“INSERT INTO Test SET tags=’$displaysearch’, url=’$displaysearch'”) or die(mysql_error());

} [/CODE]

to post a comment
PHP

11 Comments(s)

Copy linkTweet thisAlerts:
@RANauthorJul 16.2009 — Or in this part of code

[CODE]<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<link rel="stylesheet" type="text/css" href="se.css" />

<div class="container">

<table id="table1">

<td bgcolor="#FF9900">
<?php include 'counter/showcounter.php'; ?><tr>

<td class="tags">

<?php

#DATABASE TAGS

$db_host = "localhost";
$db_user = "sharing3_ran";
$db_pass = "sharingran";
$db_name = "sharing3_sharing";

mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
mysql_select_db($db_name);

function tag_info() {
$result = mysql_query("SELECT * FROM Test GROUP BY tags ORDER BY Rand() DESC");
while($row = mysql_fetch_array($result)) {
$arr[$row['tags']] = $row['count'];
}
//ksort($arr);
return $arr;
}

function tag_cloud() {

$min_size = 11;
$max_size = 20;

# GET THE SMALLEST AND LARGET COUNT NUMBERS
$sql = mysql_query("SELECT MIN(count),MAX(count) FROM Test");
list($minimum_count,$maximum_count) = mysql_fetch_row($sql);
$spread = $maximum_count - $minimum_count;

if($spread == 0) {
$spread = 1;
}

$cloud_html = '';
$cloud_tags = array();

$step = ($max_size - $min_size)/($spread);

# GRAB THE DATA FROM MySQL
$sql = mysql_query("SELECT tags,count,Url FROM Test GROUP BY tags ORDER BY Rand() DESC LIMIT 55");
# USING mysql_fetch_row SO WE CAN USE list()
while(list($tag,$count,$url) = mysql_fetch_row($sql)) {
$size = $min_size + ($count - $minimum_count)
* $step;

// $size = ($max_size + $min_size)/$spread;
$cloud_tags[] = '<a style="font-size: '. floor($size) . 'px'
. '" class="tag_cloud" href="index.php?q=' . $url
. '" class="tag_cloud" href="' . $url
. '" title="'' . $tag . '' returned a count of ' . $count . '">'
. htmlspecialchars(stripslashes($tag)) . '</a>';
}
$cloud_html = join("|", $cloud_tags) . "";
return $cloud_html;
}

?>

<?php print tag_cloud(); ?>
</td></tr>
</table>

<hr width="800" size="0" noshade>




[/CODE]
Copy linkTweet thisAlerts:
@GUIRJul 18.2009 — You may have an array with badwords, compare them with your results.

I have attached a badwords database, that may be useful to you.

[upl-file uuid=1b55dc11-caab-4275-ac2c-a0882d729d75 size=5kB]badwords.zip[/upl-file]
Copy linkTweet thisAlerts:
@RANauthorJul 18.2009 — Thank you for your help, but the problem is my tag cloud display "&amp" instead of "&" and "&quote;" instead of ""

Any way to fix that?
Copy linkTweet thisAlerts:
@bokehJul 18.2009 — I have attached a badwords database, that may be useful to you.[/QUOTE]I guess you must be joking, right? I mean, since when were gay, screw, pussy, etc rude words. But it goes to show what a hopeless cause a word filter is until someone is clever enough to write one that understands context.
Copy linkTweet thisAlerts:
@RANauthorJul 18.2009 — Hi,

My only problem is my tagcloud display "&amp" instead of "&" and "&quote;" instead of "".

I think I need some kind of filter but is not necessary.

I only need to show on my tagclouds "Gay & Gay" instead of "Gay &amp; Gay"

or "Gay" instead of "&amp;Gay&amp;"
Copy linkTweet thisAlerts:
@JunkMaleJul 18.2009 — Well one only needs to get off ones A H and search the forum &amp; one might *cough find the answer... some threads do contain other useful information even if it has nothing to do with your needs... ?
Copy linkTweet thisAlerts:
@bokehJul 20.2009 — Well one only needs to get off ones A H and search the forum &amp; one might *cough find the answer... some threads do contain other useful information even if it has nothing to do with your needs... ?[/QUOTE]Nice attitude!
Copy linkTweet thisAlerts:
@JunkMaleJul 20.2009 — Nice attitude![/QUOTE]

Or not, depending on how you read things bokeh but I can assure you that if it was all attitude, it would be as obvious as a punch in the face.

If people sit in their asses and the answer is served up to them with out the asker getting off their rear to help find their answer or even perform a site search or internet search but instead the answer is served up in one easy helping... they never learn anything.

So to some seeing that post as attitude, think again, unless you push people in to learning, they will happily let others do the job for them. Why do you think I spend time pointing people to these resources and "NOT" giving them a fully functioning script? They need to not only understand it but also have to learn what is going on so that they can solve their own problems.

If you have never done any form of teacher training, you won't understand my methods.
Copy linkTweet thisAlerts:
@MindzaiJul 20.2009 — This isn't a classroom and you are not a teacher. If people ask for help and you point them to a resource, fine. If you give them the answer direct, also fine. If you do either but answer with righteous indignation because they dared to ask a question to which you knew the answer, not fine. Though I wouldn't expect anything less from you ?
Copy linkTweet thisAlerts:
@RANauthorJul 20.2009 — Hi,

Thank you for your help.

My problem is resolved.
Copy linkTweet thisAlerts:
@JunkMaleJul 20.2009 — This isn't a classroom and you are not a teacher. If people ask for help and you point them to a resource, fine. If you give them the answer direct, also fine. If you do either but answer with righteous indignation because they dared to ask a question to which you knew the answer, not fine. Though I wouldn't expect anything less from you ?[/QUOTE]

! & you too.
×

Success!

Help @RAN spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...