Posted By

waheedpay on 07/06/16


Tagged


Versions (?)

Meta search engine; web, image, video, news and weather Simple


 / Published in: PHP
 

URL: https://www.cragglist.com/

Don't compromise with quality, we provide high-quality and adaptable meta search scripts; web, video, image, etc. Making building a website that much easier.

  1. <?php
  2. if(isset($_GET['q'])) {
  3. $q=stripslashes(preg_replace('/\s\s+/', ' ', $_GET['q']));
  4. }
  5. else {
  6. $q="";
  7. }
  8. $qw=preg_replace("/[^A-Za-z0-9 ]/", "", $q);
  9. if(isset($_GET['search'])) {
  10. $search=$_GET['search'];
  11. }
  12. else {
  13. $search="";
  14. }
  15.  
  16. require_once("header.php");
  17. ?>
  18. <style type="text/css">
  19. <?php if(str_replace(" ","",$qw)=="") { ?>
  20. .navigation {
  21. margin-top: 15%;
  22. text-align: center;
  23. }
  24. .logo {
  25. padding: 17px;
  26. display: block;
  27. }
  28. footer {
  29. position:absolute;
  30. left:0;
  31. right:0;
  32. bottom:0;
  33. }
  34. nav {
  35. margin:0;
  36. }
  37. input.input-text {
  38. width: 40%;
  39. }
  40. <?php } else { ?>
  41. .navigation {
  42. background: #f2f2f2;
  43. border-bottom: 1px solid #e4e4e4;
  44. padding: 12px 10px;
  45. position:fixed;
  46. top:0;
  47. left:0;
  48. right:0;
  49. }
  50. .logo img {
  51. width:76px;
  52. height:34px;
  53. }
  54. <?php } ?>
  55. </style>
  56. <body>
  57. <nav>
  58. <li><a href="?q=<?=$q?>&search=web">Web</a></li>
  59. <li><a href="?q=<?=$q?>&search=images">Image</a></li>
  60. <li><a href="?q=<?=$q?>&search=videos">Video</a></li>
  61. <li><a href="?q=<?=$q?>&search=news">News</a></li>
  62. </nav>
  63. <?php error_reporting(0);
  64. require_once("functions.php");
  65. // now have some fun with the results...
  66.  
  67. if(str_replace(" ","",$qw)=="") {
  68. ?>
  69. <div class="navigation">
  70. <form>
  71. <div class="logo"><a href="/"><img src="image/logo_main.png" alt="logo"></a></div><input type="search" class="input-text" name="q" value="<?=$q?>" id="search" /><input type="hidden" name="search" value="<?=$search?>"><input type="submit" class="g-button" value="Search" />
  72. </form>
  73. </div>
  74. <?php
  75. } else { ?>
  76. <div class="navigation">
  77. <form>
  78. <div class="logo"><a href="/"><img src="image/logo_main.png" alt="logo"></a></div><input type="search" class="input-text" name="q" value="<?=$q?>" id="search" /><input type="hidden" name="search" value="<?=$search?>"><input type="submit" class="g-button" value="Search" />
  79. </form>
  80. </div>
  81. <?php
  82. $page = preg_replace('/[^-0-9]/', '', $_GET['page']);
  83.  
  84. if($page=="" or $page==" ") {
  85. $page="1";
  86. }
  87. $qe=urlencode($q);
  88. $qs=urlencode($qw);
  89. $limit=12;
  90. $start = ($page-1) * $limit;
  91.  
  92. if($search=="images" || $search=="videos" || $search=="news") {
  93. echo '<ol class="vid_result_main">';
  94.  
  95. if($search =="images") {
  96. image_str(array_merge(image($qs,$start+1), image($qs,$start+5),image($qs,$start+9),image($qs,$start+13)));
  97. } else
  98. if($search =="videos") {
  99. video($qs,$page,21);
  100. } else
  101. if($search =="news") {
  102. news($qs,$page,21);
  103. }
  104. echo '</ol>';
  105. pagination('?q='.$qe.'&search='.$search,$page);
  106. } else {
  107. $limit=12;
  108. $start = ($page-1) * $limit;
  109. echo '<ol class="img_result_main">';
  110. image_str(array_merge(image($qs,$start+1), image($qs,$start+5),image($qs,$start+9)));
  111. echo "</ol>";
  112. echo'<div class="results_container">';
  113. ?>
  114. <script type="text/javascript">
  115. ( function() {
  116. if (window.CHITIKA === undefined) {
  117. window.CHITIKA = { 'units' : [] };
  118. };
  119. var unit = {
  120. 'fluidH' : 1,
  121. 'nump' : "2",
  122. 'publisher' : "waheedpay",
  123. 'width' : 528,
  124. 'height' : "auto",
  125. 'type' : "mpu",
  126. 'sid' : "Chitika Default",
  127. 'color_site_link' : "0000CC",
  128. 'color_title' : "0000CC",
  129. 'color_border' : "FFFFFF",
  130. 'color_text' : "000000",
  131. 'color_bg' : "FFFFFF"
  132. };
  133. var placement_id = window.CHITIKA.units.length;
  134. window.CHITIKA.units.push(unit);
  135. document.write('<div id="chitikaAdBlock-' + placement_id + '"></div>');
  136. var s = document.createElement('script');
  137. s.type = 'text/javascript';
  138. s.src = 'http://scripts.chitika.net/getads.js';
  139. try {
  140. document.getElementsByTagName('head')[0].appendChild(s);
  141. } catch(e) {
  142. document.write(s.outerHTML);
  143. }
  144. }());
  145. </script>
  146. <?php
  147. web_str(array_merge(web($qs,$start), web($qs,$start+4),web($qs,$start+8)));
  148. if (count($results) < $pageslimit) {
  149. echo '<li class="results">Oops!, You\'ve reached the end of the results.</li>';
  150. }
  151.  
  152. echo '</ol>';
  153. video($qs,$page,6);
  154. pagination('?q='.$qe.'&search='.$search,$page);
  155. echo'</div>';
  156. }
  157.  
  158. }
  159.  
  160. require_once("footer.php");
  161. ?>
  162. </body>
  163. </html>

Report this snippet  

You need to login to post a comment.