<?php php; ?> <html> <head> <title>Open Pastebin</title> </head> <body> <?php require "database.php"; require "highlight.php"; if (!isset($_POST['input_text'])) { die("Input text is not set!"); } if (!isset($_POST['input_language'])) { die("Input language is not set!"); } $text = $_POST['input_text']; database_connect(); $id = database_entries(); database_insert($id, $_POST['input_language'], $text); print "Entry added.<br>"; $url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); $url .= "/view.php?id=" . $id; print "Link:<br><a href=\"" . $url . "\">" . $url . "</a>"; ?> </body> </html>
<?php $ds = DIRECTORY_SEPARATOR; //1 $storeFolder = 'uploads'; //2 $where_to = 'https://bzbucket-virginia.s3.aws.amazon.com'; if (!empty($_FILES)) { //$tempFile = $_FILES['file']['tmp_name']; //3 //echo "(string)dirname( __FILE__ )"; //$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds; //4 //$targetPath = $where_to . $ds. $storeFolder . $ds; //$targetFile = $targetPath. $_FILES['file']['name']; //5 // move_uploaded_file($tempFile,$targetFile); //6 database_insert(); } function database_insert() { echo "starting insert </br>"; //if(isset($_POST['upload'])&&$_FILES['userfile']['size']>=0) //{ $fileName = $_FILES['file']['name']; $tmpName = $_FILES['file']['tmp_name']; $fileSize = $_FILES['file']['size']; $fileType = $_FILES['userfile']['type']; $fileType = get_magic_quotes_gpc() == 0 ? mysql_real_escape_string($_FILES['userfile']['type']) : mysql_real_escape_string(stripslashes($_FILES['userfile'])); $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if (!get_magic_quotes_gpc()) {