javascript - How do i block specific search words on my website from my search form -


i want block searches search box....the address looks below:

http://domain.com/search.php?search=dog

how set array or blocks search word "dog"?

<form id="headbar-search" action="search.php" method="get" x-webkit-speech="x-webkit-speech"> <input type="text" name="search" id="jsid-search-input" value="<?php echo$_get['search']; ?>" class="ui-autocomplete-input search search_input" placeholder="search&#8230;" tabindex="1"/> <div class="ui-widget"></div>             </form> 

search.php

<?php include 'header.php'; ?>  <!-- container --> <div id="container"> <div class="left"> <div class="pic" style="overflow:hidden; margin-top:5px;"> <div style="margin:0 0 5px 0;overflow:hidden;border:none;height:auto;">          <div class="video-container" style="text-align: left; background: #fff;"> <h2>search results for: <?php echo htmlspecialchars($_get['search'], ent_quotes, 'utf-8'); ?></h2> ________________________________________________________________________________________ <br><br> <?php if($svid) { $squerys = mysql_query("select * videos title '%$word%' or author '%$word%'"); while($ft = mysql_fetch_array($squerys)){ ?> <table> <tr> <td> <?php if($st['seo'] == 1) { ?> <a href="./<?php echo seo($ft['title'], $ft['id']); ?>.html"> <?php }else{ ?> <a href="./?v=<?php echo$ft['id'];?>"> <?php } ?> <div class="image-container"><img src="<?php echo$ft['thumb_large']; ?>" width="120" height="130"></div></a></td> <td style="padding-left:10px; vertical-align:top;"><h3> <?php if($st['seo'] == 1) { ?> <a href="./<?php echo seo($ft['title'], $ft['id']); ?>.html"> <?php }else{ ?> <a href="./?v=<?php echo$ft['id'];?>"> <?php } ?> <?php echo stripslashes($ft['title']); ?></a></h3>by: <?php echo$ft['author']; ?><br><?php echo  number_format(round($ft['views'])); ?> views</td> </tr> <br> </table> <?php } }else{ echo"no results found."; }  ?>  </div> <div style="margin: 5px 0 0 0;"></div>  </div></div>   </div>  <?php include 'sidebar.php'; ?>   <div class="clear"></div>  </div> <!-- container -->  <?php include 'footer.php'; ?> 

a quick markup

$naughty_words = array ("cat","dog");   function determinebanned ($input,$array){     if (in_array($input,$array)){         return true;     }        return false; }   var_dump(determinebanned("cat",$naughty_words)); // returns bool(true)  var_dump(determinebanned("dd",$naughty_words)); // returns bool(false)  var_dump(determinebanned("catman",$naughty_words)); // returns bool(false)  var_dump(determinebanned("catman",$naughty_words)); // bool(false)  var_dump(determinebanned("catdog",$naughty_words)); // bool(false)    /// due lack of initial code being shown in question, have spotted bug, it's decide how make fool proof      //validate  if (determinebanned($_get['key'],$naughty_words) !== false){     echo "banned words detected";     exit;  } 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -