Advertisement
Guest User

lolool

a guest
Oct 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <?php
  2.  
  3. //Connect to database
  4. $servername = "localhost";
  5. $username = "spook";
  6. $password = "password";
  7. $db = "drone_research";
  8.  
  9. // Create connection
  10. $conn = new mysqli($servername, $username, $password, $db);
  11. $output = '';
  12. //collet data
  13. if (isset($_POST['search'])) {
  14. $searchq = $_POST['search'];
  15.  
  16. $query = mysqli_query($conn, "SELECT * FROM urls WHERE url LIKE '%$searchq%'") or die ("could not search");
  17.  
  18. $count = mysqli_num_rows($query);
  19. if ($count == 0){
  20. $output = 'No articles found!';
  21. }else{
  22. while ($row = mysqli_fetch_array($query)) {
  23. $website = $row['website'];
  24. $url = $row['url'];
  25.  
  26.  
  27.  
  28.  
  29. $output .= '<div>'.$url.' '.$website.'</div>';
  30. }
  31. }
  32. }
  33.  
  34.  
  35. ?>
  36.  
  37. <html>
  38. <head>
  39. <style type="text/css">
  40.  
  41.  
  42.  
  43. h1{
  44. color : red;
  45. text-align : center;
  46. font-family: Impact;
  47. }
  48.  
  49. body {
  50. background-color: black;
  51. background-image: url('https://i.imgur.com/ttVpdPe.png');
  52. background-size: 100% 100%;
  53. background-repeat: no-repeat;
  54. font-family: Trebuchet MS;
  55. color: white;
  56.  
  57.  
  58. }
  59.  
  60. div{
  61. text-align:center;
  62. }
  63.  
  64. }
  65.  
  66. #submit:hover {
  67. border: none;
  68. background:white;
  69. color: #d14836;
  70. box-shadow: 0px 0px 1px #777;
  71. }
  72. #submit{
  73. border: 1px solid #d14836;
  74. background-color: #d14836;
  75. color: white;
  76. border-radius: 40px;
  77. padding: 5px;
  78. width: 155px;
  79. cursor: pointer;
  80. font-family: Trebuchet MS;
  81. font-size: 20px;
  82. font-weight: bold;
  83. }
  84.  
  85. input[type=text] {
  86.  
  87.  
  88. -webkit-transition: width 0.4s ease-in-out;
  89. transition: width 0.4s ease-in-out;
  90. border: 2px solid red;
  91. padding-left: 40px;
  92. border-radius: 50px;
  93. background-image: url('http://www.clker.com/cliparts/7/C/B/Q/6/n/search-icon-hi.png');
  94. background-size:20px 20px;
  95. background-position: 10px 10px;
  96. background-repeat: no-repeat;
  97. padding: 12px 20px 12px 40px
  98. }
  99.  
  100. input[type=text]:focus {
  101. width: 100%;
  102. }
  103.  
  104.  
  105.  
  106. </style>
  107.  
  108. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  109. <title>D.R.A.F</title>
  110.  
  111. </head>
  112. <body>
  113.  
  114. <h1>Drone Research Article Finder (D.R.A.F)</h1>
  115.  
  116. <form action="index.php" method="post">
  117. <div>
  118. <input type="text" position="center" name="search" placeholder="Search for article">
  119. <br><br>
  120. <input type="submit" value="Search" id="submit">
  121. </div>
  122.  
  123.  
  124.  
  125.  
  126.  
  127. </form>
  128.  
  129.  
  130. <?php print("$output"); ?>
  131.  
  132.  
  133. </body>
  134.  
  135.  
  136.  
  137.  
  138. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement