palm-paste/post.php

24 lines
635 B
PHP
Raw Normal View History

2016-06-09 09:22:48 +01:00
<?php
include "config/config.php";
if(isset($_POST["type"])){
//===New_Paste===//
if($_POST["type"]=="paste" && isset($_POST["text"])){
/* Set paste details */
$title = "Untitled";
$text = $_POST["text"];
if(isset($_POST["title"]))
$title = $_POST["title"];
/* Add paste to database */
$stmt = $conn->prepare("INSERT INTO pastes (title,text)
VALUES (:tit, :txt)");
$stmt->bindParam(':tit', $title);
$stmt->bindParam(':txt', $text);
$stmt->execute();
2016-06-09 10:02:09 +01:00
$id = $conn->lastInsertId();
2016-06-09 09:22:48 +01:00
$conn = null; //close connection to database
2016-06-09 10:02:09 +01:00
header("Location: ".$id);
die();
2016-06-09 09:22:48 +01:00
}
}
$conn = null;
?>