mirror of
https://github.com/pikami/palm-paste.git
synced 2026-01-22 11:53:00 +00:00
People can now post pastes!
This commit is contained in:
24
post.php
Normal file
24
post.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
include "config/config.php";
|
||||
if(isset($_POST["type"])){
|
||||
echo "TYPE!";
|
||||
//===New_Paste===//
|
||||
if($_POST["type"]=="paste" && isset($_POST["text"])){
|
||||
echo "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();
|
||||
$conn = null; //close connection to database
|
||||
}
|
||||
}
|
||||
echo "FIN!";
|
||||
$conn = null;
|
||||
?>
|
||||
Reference in New Issue
Block a user