diff --git a/README.txt b/README.txt index 946901e..38272d5 100644 --- a/README.txt +++ b/README.txt @@ -29,6 +29,7 @@ FEATURES: -upload image -can run any command from convert (maybe not enough restricted...?) -for each user: 1 folder for original and 1 folder for processed images +-if file already on server it's fine TODO: -preview not saved @@ -39,3 +40,17 @@ TODO: -email image -login page refresh -upload/process update DB +-2 images with same name..? + +user modifies password +admin modifies pass +admin can do more stuffs -> send emails to user, + +limit size max of image directory +some refresh issues, field are getting empty, etc. + +chmod 777 some files +images still visible after refresh + +command modified +check command input diff --git a/admin/imagebankimagebank.sql b/admin/imagebankimagebank.sql deleted file mode 100644 index d6cf1a9..0000000 --- a/admin/imagebankimagebank.sql +++ /dev/null @@ -1,59 +0,0 @@ --- phpMyAdmin SQL Dump --- version 3.3.9.2 --- http://www.phpmyadmin.net --- --- Host: localhost --- Generation Time: Nov 30, 2011 at 02:04 PM --- Server version: 5.5.9 --- PHP Version: 5.3.6 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Database: `imagebank` --- - --- -------------------------------------------------------- - --- --- Table structure for table `images` --- - -CREATE TABLE `images` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(32) DEFAULT NULL, - `date` varchar(32) DEFAULT NULL, - `type` varchar(32) DEFAULT NULL, - `filter` varchar(32) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `images` --- - - --- -------------------------------------------------------- - --- --- Table structure for table `users` --- - -CREATE TABLE `users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(32) DEFAULT NULL, - `email` varchar(32) DEFAULT NULL, - `password` varchar(32) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `users` --- - diff --git a/admin/index.php b/admin/index.php index b6a0c8c..25cde30 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,3 @@
-
-
-
\ No newline at end of file diff --git a/ajax/currentimageupdate.php b/ajax/currentimageupdate.php deleted file mode 100644 index 7abee75..0000000 --- a/ajax/currentimageupdate.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/ajax/testcommand.php b/ajax/executecommand.php similarity index 100% rename from ajax/testcommand.php rename to ajax/executecommand.php diff --git a/ajax/currentimage.php b/ajax/loadimage.php similarity index 100% rename from ajax/currentimage.php rename to ajax/loadimage.php diff --git a/ajax/updateimages.php b/ajax/updateimages.php new file mode 100644 index 0000000..05a523d --- /dev/null +++ b/ajax/updateimages.php @@ -0,0 +1,4 @@ + diff --git a/index.php b/index.php index ffebc63..6eb561e 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,6 @@ Login -#
diff --git a/js/ajax.js b/js/ajax.js index beff7d0..0fc5043 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -1,3 +1,7 @@ +// helper method +// +// + function getXMLHttp() { var xmlHttp @@ -30,7 +34,19 @@ function getXMLHttp() return xmlHttp; } -function UpdateCurrentImage(filename) + +// When we open an image +// +// + +function openImage(file) { + var im = ""); + RequestOpenImage(file.substring(6)); +} + +function RequestOpenImage(filename) { var xmlHttp = getXMLHttp(); @@ -38,28 +54,32 @@ function UpdateCurrentImage(filename) { if(xmlHttp.readyState == 4) { - HandleUpdateCurrentImage(xmlHttp.responseText, filename); + HandleOpenImage(xmlHttp.responseText, filename); } } - var im = "ajax/currentimage.php?var1="; + var im = "ajax/loadimage.php?var1="; var ag = im.concat(filename); xmlHttp.open("GET", ag, true); xmlHttp.send(null); } -function HandleUpdateCurrentImage(response, filename) +function HandleOpenImage(response, filename) { } -function UpdateImageIfAny() +// When we refresh the page +// +// + +function UpdateImages() { - RequestUpdateImageIfAny(); + RequestUpdateImage(); } -function RequestUpdateImageIfAny() +function RequestUpdateImage() { var xmlHttp = getXMLHttp(); @@ -67,33 +87,37 @@ function RequestUpdateImageIfAny() { if(xmlHttp.readyState == 4) { - HandleResponseUpdateImageIfAny(xmlHttp.responseText); + HandleResponseUpdateImage(xmlHttp.responseText); } } - xmlHttp.open("GET", "ajax/currentimageupdate.php", true); + xmlHttp.open("GET", "ajax/updateimages.php", true); xmlHttp.send(null); } -function HandleResponseUpdateImageIfAny(response) +function HandleResponseUpdateImage(response) { + images = response.split(" "); + // var im = ""); -} - -function openFile(file) { + + // set new image var im = ""); - UpdateCurrentImage(file.substring(6)); + var ag = im.concat(images[1]); + document.getElementById('filtered').innerHTML = ag.concat(" height=\"200\" width=\"200\" />"); } -function testCommand(file) { - UpdateTestCommand(file); +// When a command is executed +// +// + +function executeCommand(file) { + UpdateExecuteCommand(file); } -function UpdateTestCommand(file) +function UpdateExecuteCommand(file) { var xmlHttp = getXMLHttp(); @@ -101,18 +125,18 @@ function UpdateTestCommand(file) { if(xmlHttp.readyState == 4) { - HandleResponseUpdateTestCommand(xmlHttp.responseText); + HandleResponseExecuteCommand(xmlHttp.responseText); } } - var im = "ajax/testcommand.php?var1="; + var im = "ajax/executecommand.php?var1="; var ag = im.concat(file); xmlHttp.open("GET", ag, true); xmlHttp.send(null); } -function HandleResponseUpdateTestCommand(response) +function HandleResponseExecuteCommand(response) { document.getElementById('ajaxecho').innerHTML = response; diff --git a/login.php b/login.php index f562d23..5ddf56a 100644 --- a/login.php +++ b/login.php @@ -40,7 +40,7 @@ } else { echo "Wrong Username or Password"; - echo ""; + echo ""; exit; } } diff --git a/register.php b/register.php index cb70270..f8de717 100644 --- a/register.php +++ b/register.php @@ -50,13 +50,13 @@ //back to main page echo "User registered"; - echo ""; + echo ""; } else { // back to same page echo "User: '". $myemail ."' already exists in database"; - echo ""; + echo ""; } } diff --git a/registeredarea.php b/registeredarea.php index 5eb6c5f..05be658 100644 --- a/registeredarea.php +++ b/registeredarea.php @@ -19,17 +19,18 @@ var full2 = full.concat("/"); $(document).ready( function() { $('#fileTree').fileTree({ root: full2, script: 'libs/connectors/jqueryFileTree.php' }, function(file) { - openFile(file) + openImage(file) ;}) ;}); $(document).ready(function() { $("#target").keypress(function(event) { if(event.which == 13){ - testCommand( $("#target").val() ); + executeCommand( $("#target").val() ); } }); }); -//UpdateImageIfAny(); +// update images on refresh +UpdateImages();