Guest User

Untitled

a guest
Oct 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $dbname = "nope";
  4. $username = "nope";
  5. $password = "nope";
  6.  
  7. if(isset($_GET["s"])){
  8. try{
  9. $pdo = new PDO("mysql:host=".$host.";dbname=".$dbname,$username,$password);
  10. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  11. $table = "links";
  12. $sql ="CREATE TABLE IF NOT EXISTS $table(
  13. ID INT(11) AUTO_INCREMENT PRIMARY KEY,
  14. key VARCHAR(50) NOT NULL,
  15. url TEXT(65535) NOT NULL,
  16. ip VARCHAR(150) NOT NULL)";
  17. $pdo->exec($sql);
  18. } catch (PDOException $e) {
  19. echo 'Connection failed: ' . $e->getMessage();
  20. }
  21.  
  22.  
  23. /*$statement = $pdo->prepare("select url from $table where key = :key");
  24. $statement->execute(array(':key' => $_GET["s"]));
  25. $result = $statement->fetch();
  26. echo $result;*/
  27. }
  28. else{
  29. echo "error";
  30. }
  31. ?>
Add Comment
Please, Sign In to add comment