Samstag, 26. April 2014

PLOG - a Picture Log

I created a PLOG with PHP wich can use a MySQL Database. You can also use it without the Database.

An Android Smartphone App for it is included, with full source code!.

To use it without Database, there ist the file php/values.php where you can set your DB connection variables or turn the DB off with

$db_use_Database = false;

The code is built on six (6) files. (excluding the Android App)

index.php -> assembles the webpage with the php commands below and some divs around it.
_android.php -> communicates with the Android app. (returns the result of $plogapp->validate_android() to the device. That is one line of text.)
css.css -> general style definitions for index.php and some tags from php/plogclass.php
php/_install.php -> Call that one ONCE after you created the MySQL-Database. It creates the necessary Table on the Database.
php/values.php -> The values that you MUST set before using the PLOG.
php/plogclass.php -> All the code for the PLOG and the Android app goes here.

You can alter index.php, css.css and php/values.php for your PLOG. The _android.php, php/plogclass.php and php/_install.php files should not be altered, except the SQL syntax may be wrong on your server.

There is a bonus file asciiimage.php wich creates a coloured text image from a given file.
I am to lazy to remove the link every time I make it public, so you get it all.

The HTML code is right at the bottom of php/plogclass.php, if you want to change the file-list appereance.

To delete uploaded files/comments, just call index.php in your browser with the flag "enabledeletion".


To alter a comment on an already uploaded file, just call index.php in your browser with the flag "changecomment".


You can create whatever file you want for index.php, it should only contain this stuff in php:
include "php/plogclass.php";
$plogapp=new PLOG(); // -> create a PLOG-instance.
$plogapp->validate_html(); // -> uploads or deletes some files. (This was previously in the constructor.)
$plogapp->show_uploadform() // -> shows the upload form, you could also create your own.
$plogapp->show_files() // -> this "is" the PLOG itself.
$plogapp->show_feedback() // -> shows some feedback from the code like "File uploaded".

Your _android.php file should only return the result of $plogapp->validate_android(); and contain NO html tags. The WHOLE file looks like this:
$plogapp=new PLOG();
return $plogapp->validate_android();

..and should not contain something other than that because the Android device reads everything as plain text.

Here is MY PLOG:

Last but  not least, here is the download of the .zip file with all six files and all Android-app stuff in it.

And last but not least, a direct link to the (debug version of the) Android App:

Have Fun!

Keine Kommentare:

Kommentar veröffentlichen