Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post" action="lookup.php">
- <input type="text" class="form-control" name="imgid" maxlength="3" placeholder="What's the image number?">
- </form>
- -----------------------------------------------------------------------------------------------------------------
- lookup.php
- -----------------------------------------------------------------------------------------------------------------
- <?php
- $servername = "localhost";
- $username = "user";
- $password = "pass";
- $dbname = "database";
- $id = $_POST["imgid"];
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM pics WHERE id = '$id'";
- $result = $conn->query($sql);
- // output data of each row
- while($row = $result->fetch_assoc()) {
- $dir = $row["dir"];
- $likes = $row["likes"];
- }
- $conn->close();
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Hentai Rate</title>
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link rel="stylesheet" type="text/css" href="css/pace.css">
- <link rel="stylesheet" type="text/css" href="css/custom.css">
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <div class="container-fluid">
- <br/>
- <br/>
- <div class="row">
- <center>
- <h3 class="text-center">Photo #<?php echo $id; ?></h3>
- <img src="<?php echo $dir; ?>" class="img-main">
- </center>
- <br/>
- <div class="panel panel-default col-lg-2 col-lg-push-5">
- <div class="panel-body">
- <p class="text-center">Likes: <?php echo $likes; ?></p>
- </div>
- </div>
- </div>
- </div>
- <!-- ##END### -->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- <script src="js/bootstrap.min.js"></script>
- <script src="js/pace.js"></script>
- <script src="js/custom.js"></script>
- </body>
- <!-- <hr style="width: 100%; color: black; height: 1px; background-color: #2b2b2b; border: none;" /> -->
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement