jquery - php instant search crashing -


i have created instant search mysql database using php , jquery. search functioning until delete of keyword search terms , begin search again. once search terms deleted user search results no longer being returned expected. once occurs if refresh page receive "no data received" message browser , site not go online again minute or so. in order see mean can go www.partsearch.club .. of keywords can used "decora connector wet bx tek tk". if continue add , remove search terms see mean. here code

index.php

<!doctype html> <html> <head> <meta charset="utf-8"> <title>instant search tutorial</title> </head>  <body> <script type="text/javascript" src="js/jquery.js"></script> <br /> <br /> <br /> <br /> <br /> <br /> <center><input type="text" id="search" placeholder="search..." size="50"><br /> </br> <form><input type=button value="refresh" onclick="history.go()"></form>    </center><br /> <div id="searchresults"></div> <script type="text/javascript" src="js/search.js"></script> </body> </html> 

search.php

<!doctype html> <html> <head> <meta charset="utf-8"> <title>instant search tutorial</title> </head>  <body> <?php  $username = "xxxx"; $password = "xxxxx"; $hostname = "localhost";    mysql_connect($hostname, $username, $password);  mysql_select_db("wesco");  $searcharray = explode(" ", $_post['searchterm']); $query = ""; foreach($searcharray $val) { $search = mysql_real_escape_string(trim($val)); if (!empty($query)) {     $query = $query . " , "; // or and, depends on want }  $query = $query . "`keywords` '%$search%'"; }  if (!empty($query)) { $find_parts = mysql_query("select * `parts` $query"); }  while($row = mysql_fetch_assoc($find_parts)) { $name = $row['name'];  echo "<center>$name</center><br />"; }  ?> </body> </html> 

search.js

$('#search').keyup(function() { var searchterm = $('#search').val();  if(searchterm!='') {     $.post('search.php',{searchterm:searchterm},     function(data)     {         $('#searchresults').html(data);     }); } else {     $('#searchresults').html('');    } }); 

are using firewall, or using varnish or reverse proxy in front of apache? setting rate limit on amount of requests, anywhere on apache settings? tried overload server doing several autocomplete requests , got blocked, @ same exact moment tried box on ip , got correct answer:

curl -x -i http://www.partsearch.club/ http/1.1 200 ok date: sat, 06 feb 2016 01:42:05 gmt server: apache/2.4.16 x-powered-by: php/5.4.45 transfer-encoding: chunked content-type: text/html 

so shows server not going down everyone, rather blocked few seconds, apache or ddos protection may have in server. suggest trying nginx or litespeed webserver, check if problem lies on apache or somewhere else.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -