Advertisement
corestudiosnet

search.php new

Apr 6th, 2011
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. $categories = array( 'sugar' => 'proionta/sugar/',
  4.                      'metropolitan' => 'proionta/metropolitan/',
  5.                      'interior' => 'proionta/interior/',
  6.                      'glamour' => 'proionta/glamour/',
  7.                 );
  8.  
  9. $keyword = trim($_GET['search']);   // kovei ta kena apo arxh k telos
  10. // $keyword = strtolower($keyword);    // ta metatrepei ola se mikra
  11. $keyword = preg_replace('/\s\s+/','*', $keyword);
  12. $keyword = explode("*", $keyword);    // spaei to searchstring se array
  13. $image_found=false;
  14. $cat = $_GET['category'];
  15. $folder = $categories[$cat];
  16.  
  17.  
  18. foreach ($keyword as $key=>$file) {
  19.     $images = glob($folder . "*" .$file. "*.*");
  20.         foreach($images as $image) {
  21.             echo json_encode($images);
  22.         }
  23. }
  24.          
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement