Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $dbname = "nope";
- $username = "nope";
- $password = "nope";
- if(isset($_GET["s"])){
- try{
- $pdo = new PDO("mysql:host=".$host.";dbname=".$dbname,$username,$password);
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $table = "links";
- $sql ="CREATE TABLE IF NOT EXISTS $table(
- ID INT(11) AUTO_INCREMENT PRIMARY KEY,
- key VARCHAR(50) NOT NULL,
- url TEXT(65535) NOT NULL,
- ip VARCHAR(150) NOT NULL)";
- $pdo->exec($sql);
- } catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
- }
- /*$statement = $pdo->prepare("select url from $table where key = :key");
- $statement->execute(array(':key' => $_GET["s"]));
- $result = $statement->fetch();
- echo $result;*/
- }
- else{
- echo "error";
- }
- ?>
Add Comment
Please, Sign In to add comment