Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <?php
  2.  
  3. header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  4. header("Cache-Control: post-check=0, pre-check=0", false);
  5. header("Pragma: no-cache");
  6. setlocale(LC_TIME, 'de_DE', 'deu_deu');
  7. date_default_timezone_set("Europe/Berlin");
  8. set_time_limit(300);
  9. # session start
  10. session_start();
  11. # includes
  12. include("error.php");
  13. include("config.php");
  14. include("class/database.php");
  15. include("class/run.php");
  16. # connect and create
  17. $GLOBALS['db'] = database::connect(HOST,USER,PASSWORD,DATABASE);
  18.  
  19. if(isset($_GET['sq'])) {
  20. $foundArray = array();
  21. $sq = $GLOBALS['db']->escape_string($_GET['sq']);
  22. echo "Ihr Suchbegriff: <strong>".$sq."</strong>";
  23. echo "<hr/>";
  24. $query0 = "SELECT * FROM pages WHERE title LIKE '%".$sq."%'";
  25. $data0 = run::query($query0);
  26. $query = "SELECT * FROM tt_content WHERE header LIKE '%".$sq."%' OR bodytext LIKE '%".$sq."'";
  27. $data = run::query($query);
  28. if($data0) {
  29. foreach($data0 AS $d) {
  30. $pid = $d->uid;
  31. $foundArray[$pid] = $pid;
  32. }
  33. }
  34. if($data) {
  35. foreach($data AS $d) {
  36. $pid = $d->pid;
  37. $foundArray[$pid] = $pid;
  38. }
  39. }
  40. if(count($foundArray)>0) {
  41. foreach($foundArray AS $fA) {
  42. $get = "SELECT uid,title FROM pages WHERE uid='".$fA."'";
  43. $finalData = run::query($get)[0];
  44. ?>
  45. <div class="ajaxSearchContainer">
  46. <div class="ajaxSearchContainerHeadline"><a href="index.php?id=<?php echo $finalData->uid; ?>"><?php echo utf8_encode($finalData->title); ?></a></div>
  47. </div>
  48. <?php
  49. }
  50. } else {
  51. ?>
  52. Ihre Suche ergab leider keine Treffer
  53. <?php
  54. }
  55. }
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement