Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Connect to database
- $servername = "localhost";
- $username = "spook";
- $password = "password";
- $db = "drone_research";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $db);
- $output = '';
- //collet data
- if (isset($_POST['search'])) {
- $searchq = $_POST['search'];
- $query = mysqli_query($conn, "SELECT * FROM urls WHERE url LIKE '%$searchq%'") or die ("could not search");
- $count = mysqli_num_rows($query);
- if ($count == 0){
- $output = 'No articles found!';
- }else{
- while ($row = mysqli_fetch_array($query)) {
- $website = $row['website'];
- $url = $row['url'];
- $output .= '<div>'.$url.' '.$website.'</div>';
- }
- }
- }
- ?>
- <html>
- <head>
- <style type="text/css">
- h1{
- color : red;
- text-align : center;
- font-family: Impact;
- }
- body {
- background-color: black;
- background-image: url('https://i.imgur.com/ttVpdPe.png');
- background-size: 100% 100%;
- background-repeat: no-repeat;
- font-family: Trebuchet MS;
- color: white;
- }
- div{
- text-align:center;
- }
- }
- #submit:hover {
- border: none;
- background:white;
- color: #d14836;
- box-shadow: 0px 0px 1px #777;
- }
- #submit{
- border: 1px solid #d14836;
- background-color: #d14836;
- color: white;
- border-radius: 40px;
- padding: 5px;
- width: 155px;
- cursor: pointer;
- font-family: Trebuchet MS;
- font-size: 20px;
- font-weight: bold;
- }
- input[type=text] {
- -webkit-transition: width 0.4s ease-in-out;
- transition: width 0.4s ease-in-out;
- border: 2px solid red;
- padding-left: 40px;
- border-radius: 50px;
- background-image: url('http://www.clker.com/cliparts/7/C/B/Q/6/n/search-icon-hi.png');
- background-size:20px 20px;
- background-position: 10px 10px;
- background-repeat: no-repeat;
- padding: 12px 20px 12px 40px
- }
- input[type=text]:focus {
- width: 100%;
- }
- </style>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>D.R.A.F</title>
- </head>
- <body>
- <h1>Drone Research Article Finder (D.R.A.F)</h1>
- <form action="index.php" method="post">
- <div>
- <input type="text" position="center" name="search" placeholder="Search for article">
- <br><br>
- <input type="submit" value="Search" id="submit">
- </div>
- </form>
- <?php print("$output"); ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement