Jump to content

gotornot

Members
  • Posts

    67
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

gotornot's Achievements

Member

Member (2/5)

0

Reputation

  1. the big question is how do you do that?
  2. Hi I am really struggling here i want this to check for fobidden words in an effort to stop sql injection. I cant seem to get it to work function secureit() { global $items_check; $unallowed = array('href', 'www', 'UPDATE', 'INSERT', 'DELETE', 'SET', 'OFFSET', 'ORDER BY', 'union', 'UPDATE', 'DROP TABLE', 'CREATE TABLE'); foreach($unallowed as $field) { if(stristr($items_check, $field) == TRUE) { $mess = 'NO Thanks "'.$items_check .'" is forbidden content!'; return $action = "0"; } } } The idea is that it checks the $items_check against a list of banned words if it finds one it doesnt allow the remaining script to execute.
  3. Your a star thank you soooo much
  4. Hi i wonder if you can help. I am trying to use a ajax call to collect data from a php file i managed to get this to work but how do i get the value of "Response" to output in html on the page after a form is submitted? $('form.ticketform').on('submit', function(){ var that = $(this), url = that.attr('action'), type = that.attr('method'), data = {}; that.find('[name]').each(function(index, value) { var that = $(this), name = that.attr('name'), value = that.val(); data[name] = value; }); $.ajax({ url: url, type: type, data: data, success: function(response){ return response; } }); return false; });
  5. Hi this is the query SELECT p.*, a.payout_level, a.buttonimage, a.smalldesc,a.companyname, v.* FROM products p left join advert a on p.advertId = a.id AND a.network='4' left join ( Select min(id), merchantid, code, value from vouchers group by merchantid ) as v on a.id = v.merchantid WHERE p.prod_name LIKE '%glass%' And p.cat like 'Glassware' order by p.fee asc LIMIT 0, 6 All the tables have been optimised for indexing
  6. well i am checking all the data every query as i have built a search engine. Currently there are 955000 rows and using pagination to sow 10 ordered by price
  7. Hi All I have a site that holds over 900k of products. I am searching on my db and its taking 10 seconds to search products and bring back results. I wondered if i stored the data in the ram the results would be instantanious. Does anyone have any experience or could point me in the right direction of how to do this. In an ideal world i would like the rsults to come back in aroun1/2 seconds. Thanks for the help and advice in advance
  8. Hi All I have a site that is takinga bunch of feeds from other sites, normalising the data into a product file. I also have a "Google" like search engine that a user can use to searh this data and get desired results. I have nearly 1m products and it takes 1 user only approximately 10 seconds to search the data even though its thoroughly indexed. I heard putting the data in cache would be far quicker. Is this true? The size of the data is just under 600mb so i have plenty of RAM. If this is true can someone please point me in the right direction to upload it in the cache and search on it. Many thanks
  9. Hi All I have a DB with over 950,000 rows and i want to be able to count how many rows are in the table. The only trouble is a mysql_num_rows statement takes ages i need something a lot quicker. This is what im using crrently and it doesnt work. any help would be great. <?php $qx = "select count(*) FROM products"; //$qnx = mysql_query( "SELECT SQL_CALC_FOUND_ROWS `id` From `products`" ); //$qnx = mysql_query($qx); //$qx = "SELECT * FROM products"; $qxr = mysql_query($qx); $qxn = mysql_num_rows($qxr); echo $qxn; ?>
  10. Hi All I have a database with 1million products in and I'm finding no matter how i index it to be slow when getting results. I have basically built a search engine that looks up the results. Is their anyway of loading all this data which is less than 1gig into the ram (Cache) would that speed the searches up and then i could update it every 24 hours? If the answer is yes. Can someone point me in the right direction of how to achieve this using PHP. Thanks
  11. That doesnt appear to work all i just changed was the script at the top?
  12. Hi i am trying to get a search box to work on both click a button or an enter action yet i cant get the enter action to work as well as enter. I know this isnt strictly php but i am using all php functions with the search and wondered if anyone could help. This is my code: <script type="text/javascript"> function get() { $.post('search_tsr.php', { search_term: form.name.value }, function(output) { $('#search_results').html(output).show(); }); } $(document).ready(function() { $(document).keyup(function(event) { if (event.keyCode == 13) { $("#form").submit(); $.post('search_tsr.php', { search_term: form.name.value }, function(output) { $('#search_results').html(output).show(); }); } }) }); </script> The form is below: <form name="form"> <img src="gfx/search_magnifyer.jpg" width="18" height="18" border="0" align="absmiddle"> <input name="name" type="text"><input type="button" onClick="get()" value="Go"> </form> Anyone can you help?
  13. Hi Really racking my brain on what i need to do here: I am using the file reader and ned to know how i clear the memory out so that i can re-use it. $zip = zip_open("$file_name"); if ($zip){ while ($zip_entry = zip_read($zip)){ $zip_size = 0; $zip_size = zip_entry_filesize($zip_entry); echo ' '.$zip_size.'<br>'; if (zip_entry_open($zip, $zip_entry)){ $contents = zip_entry_read($zip_entry, $zip_size); $datapool = $contents; // now loop through and explode it and add it $lines = explode("\n", $datapool); // note you might have to do \r\n else you'll end up with the dummy character in teh last item of the row foreach($lines as $value){ $pieces2 = explode(",", $value); // assign the array values ready for check and input $mer_id = $pieces2[0]; $name = $pieces2[1]; $aw_id = $pieces2[2]; $prod_name = $pieces2[3]; $cats = $pieces2[4]; $deeplink = $pieces2[5]; $image = $pieces2[6]; $fee = $pieces2[7]; $delivery = $pieces2[8]; $stock = $pieces2[9]; $rrp = $pieces2[10]; $valid_to = $pieces2[11]; $details = 'This is where we would have lots of content and all the details about the merchants and product etc'; //$details = $pieces[7]; //now check that the email hasnt been entered before with a duplicate if($fee>"0.01"){ $q = "SELECT * FROM $tablename WHERE aw_id='$aw_id'"; $qr = mysql_query($q); $qrn = mysql_num_rows($qr); if($qrn<"1"){ //new products $i = ++$i; $insq = "INSERT INTO $tablename (name, aw_img, aw_deeplink, prod_name, cat, fee, aw_id, mer_id, delivery, in_stock, valid_to, rrp, details, last_update) VALUES ('$name', '$image', '$deeplink', '$prod_name', '$cats', '$fee', '$aw_id', '$mer_id', '$delivery', '$stock', '$valid_to', '$rrp', '$details', '$timestamp')"; $insr = mysql_query($insq); }else{ //its a dupe $ud = "UPDATE $tablename SET name='$name', aw_img='$image', aw_deeplink='$deeplink', prod_name='$prod_name', cat='$cats', fee='$fee', aw_id='$aw_id', mer_id='$mer_id', delivery='$delivery', in_stock='$stock', valid_to='$valid_to', rrp='$rrp', details='$details', last_update='$timestamp' WHERE aw_id='$aw_id'"; $udr = mysql_query($ud); $b = ++$b; } }else{ $ig = ++$ig; } } zip_entry_close($zip_entry); } } zip_close($zip); //delete zip file unlink($file_name); } this gives this output: Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 7136978 bytes) in /web/public_html/zip.php on line 39 How do i empty out the memory as basically it needs it as im looping ??
  14. would that not work properly? i have set a function on the "onClick" area of the <a href>?
×
×
  • 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.