summaryrefslogtreecommitdiff
path: root/static/upload.php
diff options
context:
space:
mode:
authorneku nekus <neku@pomf.se>2014-01-15 13:25:29 +0100
committerneku nekus <neku@pomf.se>2014-01-15 13:25:29 +0100
commitb451727a18bcbfa70fdc9178d14367a46f27a88a (patch)
treefc4d9a4adf2cad0df33ca93abf1e954b3f883ae8 /static/upload.php
parent8897006ab856bed4a09d437f0497ad5b7f7ca3b8 (diff)
accounts?
Diffstat (limited to 'static/upload.php')
-rw-r--r--static/upload.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/static/upload.php b/static/upload.php
index 9b66b3c..a5d3069 100644
--- a/static/upload.php
+++ b/static/upload.php
@@ -1,4 +1,12 @@
<?php
+// For accounts?
+session_start();
+if(isset($_SESSION['id'])){
+ $fileowner = $_SESSION['id'];
+}else{
+ $fileowner = 'NULL';
+}
+
include_once 'classes/UploadedFile.class.php';
include_once 'includes/settings.inc.php';
include_once 'includes/database.inc.php';
@@ -73,8 +81,8 @@ function upload_file ($file) {
// Attempt to move it to the static directory
if (move_uploaded_file($file->tempfile, POMF_FILES_ROOT . $newname)) {
// Add it to the database
- $q = $db->prepare('INSERT INTO files (hash, orginalname, filename, size, date, expire, delid)' .
- 'VALUES (:hash, :orig, :name, :size, :date, :expires, :delid)');
+ $q = $db->prepare('INSERT INTO files (hash, orginalname, filename, size, date, expire, delid, fileowner)' .
+ 'VALUES (:hash, :orig, :name, :size, :date, :expires, :delid, :fileowner');
$q->bindValue(':hash', $file->get_sha1());
$q->bindValue(':orig', $file->name);
$q->bindValue(':name', $newname);
@@ -82,6 +90,7 @@ function upload_file ($file) {
$q->bindValue(':date', date('Y-m-d'));
$q->bindValue(':expires', null);
$q->bindValue(':delid', sha1($file->tempfile));
+ $q->bindValue(':fileowner', $fileowner;
$q->execute();
return array(