diff --git a/admin_gallery.php b/admin_gallery.php
index cd47b36..4c2f369 100644
--- a/admin_gallery.php
+++ b/admin_gallery.php
@@ -10,6 +10,14 @@ if (isset($_POST['delete'])) {
updateImage($data[0], 3);
}
+// Remove
+if (isset($_POST['remove'])) {
+ $data = explode(":", $_POST['remove']);
+ $did = (int)$data[0];
+ echo 'Image '. $did .' removed.';
+ mysql_delete("DELETE FROM `znote_images` WHERE `id`='$did' LIMIT 1;");
+}
+
// Accept
if (isset($_POST['accept'])) {
$data = explode(":", $_POST['accept']);
@@ -39,7 +47,6 @@ if (isset($_POST['accept']) || isset($_POST['delete'])) {
$images = fetchImages(1);
if ($images != false) {
foreach($images as $image) {
- $pw = explode("!", $image['image']);
?>
@@ -47,7 +54,7 @@ if ($images != false) {
-
+
|
@@ -67,7 +74,6 @@ if ($images != false) {
$images = fetchImages(2);
if ($images != false) {
foreach($images as $image) {
- $pw = explode("!", $image['image']);
?>
@@ -75,7 +81,7 @@ if ($images != false) {
-
+
|
@@ -95,15 +101,17 @@ if ($images != false) {
$images = fetchImages(3);
if ($images != false) {
foreach($images as $image) {
- $pw = explode("!", $image['image']);
?>
- |
+ |
-
+
|
diff --git a/engine/function/users.php b/engine/function/users.php
index 2bc9302..7eda00f 100644
--- a/engine/function/users.php
+++ b/engine/function/users.php
@@ -16,7 +16,14 @@ function insertImage($account_id, $title, $desc, $image) {
$image = sanitize($image);
$account_id = (int)$account_id;
$time = time();
- mysql_insert("INSERT INTO `znote_images` (`title`, `desc`, `date`, `status`, `image`, `account_id`) VALUES ('$title', '$desc', '$time', '1', '$image', '$account_id');");
+
+ // Insert only if image dosn't already exist there
+ $exist = mysql_select_single("SELECT `id` FROM `znote_images` WHERE `image`='$image' LIMIT 1;");
+ if ($exist === false) {
+ mysql_insert("INSERT INTO `znote_images` (`title`, `desc`, `date`, `status`, `image`, `account_id`) VALUES ('$title', '$desc', '$time', '1', '$image', '$account_id');");
+ return true;
+ }
+ return false;
}
function updateImage($id, $status) {
diff --git a/gallery.php b/gallery.php
index 30b4dec..ea5f043 100644
--- a/gallery.php
+++ b/gallery.php
@@ -4,10 +4,9 @@ if ($logged_in === true) {
if (!empty($_POST['new'])) {
?>
Create image article
- Only works with "Direct link" URLs from imgland.net
-
Don't understand? Don't worry! Watch this video guide!
+ Works with "Image Code" text from www.freeimagehosting.net