diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2010-11-03 20:16:08 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2010-11-03 20:16:08 +1100 |
| commit | 44f3e91602b186b363ca6ec7dfe1cfd65739d8b4 (patch) | |
| tree | d3902c603ca671d9a17089fe75aa3460a28feb04 | |
| parent | 8849f5a2db1d041df556d069bb0b530aee11294e (diff) | |
Added a file hash in the database. Will be implemented later.
| -rw-r--r-- | install.sql | 1 | ||||
| -rw-r--r-- | post.php | 10 | ||||
| -rw-r--r-- | src/error.png | bin | 0 -> 1358 bytes | |||
| -rw-r--r-- | src/ok.png | bin | 0 -> 1483 bytes | |||
| -rw-r--r-- | src/warning.png | bin | 0 -> 1389 bytes |
5 files changed, 9 insertions, 2 deletions
diff --git a/install.sql b/install.sql index 301f1f47..000bcdbf 100644 --- a/install.sql +++ b/install.sql @@ -43,6 +43,7 @@ CREATE TABLE IF NOT EXISTS `posts` ( `fileheight` int(11) DEFAULT NULL, `filesize` int(11) DEFAULT NULL, `filename` varchar(30) DEFAULT NULL, + `filehash` varchar(32) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `ip` varchar(15) NOT NULL, UNIQUE KEY `id` (`id`) @@ -116,6 +116,7 @@ $post['width'] = $size[0];
$post['height'] = $size[1];
+ // Check if the image is valid
if($post['width'] < 1 || $post['height'] < 1) {
unlink($post['file']);
error(ERR_INVALIDIMG);
@@ -126,7 +127,10 @@ error(ERR_MAXSIZE);
}
+ $post['filehash'] = md5_file($post['file']);
$post['filesize'] = filesize($post['file']);
+
+ // Create a thumbnail
$thumb = resize($post['extension'], $post['file'], $post['thumb'], THUMB_WIDTH, THUMB_HEIGHT);
$post['thumbwidth'] = $thumb['width'];
$post['thumbheight'] = $thumb['height'];
@@ -140,7 +144,7 @@ if($OP) {
mysql_query(
- sprintf("INSERT INTO `posts` VALUES ( NULL, NULL, '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s' )",
+ sprintf("INSERT INTO `posts` VALUES ( NULL, NULL, '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s' )",
$post['subject'],
$post['email'],
$post['name'],
@@ -156,12 +160,13 @@ $post['height'],
$post['filesize'],
$post['filename'],
+ $post['filehash'],
$post['password'],
mysql_real_escape_string($_SERVER['REMOTE_ADDR'])
), $sql) or error(mysql_error($sql));
} else {
mysql_query(
- sprintf("INSERT INTO `posts` VALUES ( NULL, '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s' )",
+ sprintf("INSERT INTO `posts` VALUES ( NULL, '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s' )",
$post['thread'],
$post['subject'],
$post['email'],
@@ -178,6 +183,7 @@ $post['has_file']?$post['height']:null,
$post['has_file']?$post['filesize']:null,
$post['has_file']?$post['filename']:null,
+ $post['has_file']?$post['filehash']:null,
$post['password'],
mysql_real_escape_string($_SERVER['REMOTE_ADDR'])
), $sql) or error(mysql_error($sql));
diff --git a/src/error.png b/src/error.png Binary files differnew file mode 100644 index 00000000..f1ff27a8 --- /dev/null +++ b/src/error.png diff --git a/src/ok.png b/src/ok.png Binary files differnew file mode 100644 index 00000000..cbe92c77 --- /dev/null +++ b/src/ok.png diff --git a/src/warning.png b/src/warning.png Binary files differnew file mode 100644 index 00000000..43fec41e --- /dev/null +++ b/src/warning.png |
