diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-02-12 19:50:55 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-02-12 19:50:55 +0100 |
commit | 24547ccec6526fcef3cccb34bc35fb81f31236b3 (patch) | |
tree | fc908fb06a6b8b4d4131c7303c4fb3b7d348f9bf /lib/image/upload.php | |
parent | cd76af42463bd80539db8c9671a427a9f0fe5d69 (diff) | |
download | Bits-24547ccec6526fcef3cccb34bc35fb81f31236b3.tar.gz Bits-24547ccec6526fcef3cccb34bc35fb81f31236b3.zip |
A lot of changes : blogging system essentially.
Diffstat (limited to 'lib/image/upload.php')
-rw-r--r-- | lib/image/upload.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/image/upload.php b/lib/image/upload.php index 812295f..5176a3a 100644 --- a/lib/image/upload.php +++ b/lib/image/upload.php @@ -4,11 +4,15 @@ $title = "Upload an image"; require("lib/conf/image.php"); +/* $number = mysql_fetch_assoc(sql("SELECT count(*) AS count FROM images WHERE owner = " . $user['id'])); assert_error($number['count'] < $quota || $user['priv'] >= $min_priv_for_no_quota || $user['id'] == 0, "You have already exceeded your upload quota."); +*/ -if (isset($_FILES['image'])) { +if (isset($_FILES['image']) && isset($_POST['name'])) { + $name = esca($_POST['name']); + if ($name == "") $name = $_FILES['image']['name']; if ($_FILES['image']['error'] != 0) { $error = "Sorry, an error occurred while uploading your file. Try with a smaller one."; require("tpl/image/upload.php"); @@ -24,7 +28,7 @@ if (isset($_FILES['image'])) { $error = "Sorry, we only accept GIF, PNG and JPEG images."; require("tpl/image/upload.php"); } - sql("INSERT INTO images(owner, extension) VALUES(" . $user['id'] . ", '$type')"); + sql("INSERT INTO images(owner, extension, name, upl_date) VALUES(" . $user['id'] . ", '$type', '" . escs($name) . "', NOW())"); $id = mysql_insert_id(); $filen = $savedir . $id . "." . $type; $minin = $savedir . $id . "-min." . $type; |