Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set(‘display_errors’,1);
- error_reporting(E_ALL|E_STRICT);
- if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_POST) > 0) {
- $hash = sha1(uniqid(mt_rand(), true));
- //$sql = 'INSERT INTO pastebin ('
- $stmt = $db->prepare("INSERT INTO pastebin (`hash`, `author`, `created`, `pastetext`) VALUES ( :hash, :author, :created, :pastetext ) ");
- $stmt->execute(array('hash' => $hash, 'author' => $_POST['authname'], 'created' => time(), 'pastetext' => $_POST['paste']));
- $sql1 = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (count($sql1) > 0)
- {
- // Redirect the user to the submitted paste.
- header('Location: index.php?paste=' . $hash);
- exit();
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head><title>Sw0rdfish's Pastebin</title></head>
- <body>
- <form action="index.php" method="post">
- <p><input type="text" name="authname" value="Your Name" /></p>
- <p><textarea name="paste" rows="15" cols="60"></textarea></p>
- <input type="submit" value="Paste it"/></form>
- </body></html>
Add Comment
Please, Sign In to add comment