Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <p>
- I only need the JW Pepper Link, so place it below.
- </p>
- <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
- JW Pepper URL <input type="text" name="URL"><br>
- <input type="submit">
- </form>
- <?php
- $servername = "localhost";
- $username = "Db User";
- $password = "Db Password";
- $dbname = "pepTest";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // prepare and bind
- //$stmt = $conn->prepare("INSERT INTO pepTest (URL) VALUES (?)");
- //$stmt->bind_param("s", $URL);
- // set parameters and execute
- $URL = $_POST["URL"];
- if(isset($URL)){
- $item = ".item#/";
- $https = "https://www.jwpepper.com/";
- $info1 = strpos($URL, $item);
- $info2 = strpos($URL, $https);
- if($info1 !== false && $info2 !== false){
- $doubleValue = $conn->query("select URL from pepTest where URL = '$URL'");
- // $URL = $conn->query("insert into pepTest (URL) values ('$URL')");
- //echo "Submit Successful <br>";
- if($doubleValue->num_rows == 0){
- $URL = $conn->query("insert into pepTest (URL) values ('$URL')");
- echo "Submit Successful <br>";
- echo "GOOD!";
- }else{
- echo "This already exists in the database! <br>";
- }
- } else{
- echo "Please enter a music item from JW Pepper <br>";
- }
- }
- $printDB = "SELECT * FROM pepTest";
- $result = $conn->query($printDB);
- echo "CURRENT DATABASE CONTENTS <br>";
- if ($result->num_rows > 0){
- while ($row = $result->fetch_assoc()) {
- echo "Song Name: " . $row["NAME"]. " URL:" . $row["URL"] . "<br>" ;
- }
- } else {
- echo "No Results Displayed";
- }
- $stmt->close();
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement