Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. <form method="post" action="lookup.php">
  2. <input type="text" class="form-control" name="imgid" maxlength="3" placeholder="What's the image number?">
  3. </form>
  4.  
  5. -----------------------------------------------------------------------------------------------------------------
  6. lookup.php
  7. -----------------------------------------------------------------------------------------------------------------
  8.  
  9.  
  10. <?php
  11. $servername = "localhost";
  12. $username = "user";
  13. $password = "pass";
  14. $dbname = "database";
  15.  
  16. $id = $_POST["imgid"];
  17.  
  18. // Create connection
  19. $conn = new mysqli($servername, $username, $password, $dbname);
  20. // Check connection
  21. if ($conn->connect_error) {
  22. die("Connection failed: " . $conn->connect_error);
  23. }
  24.  
  25. $sql = "SELECT * FROM pics WHERE id = '$id'";
  26. $result = $conn->query($sql);
  27. // output data of each row
  28. while($row = $result->fetch_assoc()) {
  29. $dir = $row["dir"];
  30. $likes = $row["likes"];
  31. }
  32.  
  33. $conn->close();
  34. ?>
  35.  
  36. <!DOCTYPE html>
  37. <html lang="en">
  38. <head>
  39. <meta charset="utf-8">
  40. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  41. <meta name="viewport" content="width=device-width, initial-scale=1">
  42. <title>Hentai Rate</title>
  43. <link href="css/bootstrap.min.css" rel="stylesheet">
  44. <link rel="stylesheet" type="text/css" href="css/pace.css">
  45. <link rel="stylesheet" type="text/css" href="css/custom.css">
  46. <!--[if lt IE 9]>
  47. <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  48. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  49. <![endif]-->
  50. </head>
  51. <body>
  52. <div class="container-fluid">
  53. <br/>
  54. <br/>
  55.  
  56. <div class="row">
  57. <center>
  58. <h3 class="text-center">Photo #<?php echo $id; ?></h3>
  59. <img src="<?php echo $dir; ?>" class="img-main">
  60. </center>
  61. <br/>
  62. <div class="panel panel-default col-lg-2 col-lg-push-5">
  63. <div class="panel-body">
  64. <p class="text-center">Likes: <?php echo $likes; ?></p>
  65. </div>
  66. </div>
  67. </div>
  68.  
  69. </div>
  70. <!-- ##END### -->
  71. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  72. <script src="js/bootstrap.min.js"></script>
  73. <script src="js/pace.js"></script>
  74. <script src="js/custom.js"></script>
  75. </body>
  76.  
  77. <!-- <hr style="width: 100%; color: black; height: 1px; background-color: #2b2b2b; border: none;" /> -->
  78. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement