OneFile is a package of several small PHP-applications or helpers. These were originally developed only for my own usage, because I had for example troubles checking my e-mail while being on vacation (no Eudora), because I did not have a free FTP program on the Macintosh for OsX, or because I had no mySQL server. The OneFile things are also simple. Some design principles are:
- zero required options to set in the script (easy to 'configure')
- zero things to do for installing (except putting them on the server and setting permissions)
- zero pictures (small on server and fast in usage)
- zero browser specific technologies (only very easy javascript, only session cookies required)
- zero extra storage on the server for users (can handle a lot of users)
- safe (use non-stored cookies)
- small (mail is 42KB, ftp is 15KB, OneSQL is 17KB)
- one protocol = one file
Go download it.
To make the code freely available to everyone, I do not claim copyright on my work.
Be aware that the code is provided "as is", with absolutely no warranty expressed or implied. Any use is at your own risk.
Ow, please mail me (niels [@] bonneville.nl) if you use the software regulary, that would be nice.
I, the author of this work, hereby release it into the public domain. This applies worldwide.
In case this is not legally possible:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
OneMail
- Size: 42.1 KB
This small script let you send and receive e-mail without bullshit. Note that there's no local storage, so there is no address book nor spam-filter (perhaps in the future), but on the other hand it can handle a lot of users, and perhaps that's why it is often chosen by webmasters and hosting companies. Since 1.49, spam-assist-signed e-mails are automaticly deleted (you can turn this off if you might want to). Current status: no known errors, only I still have to test the IMAP-stuff, for now it works with IMAP-servers but the folder-stuff is disabled.
Tip: put things like 'onemail.php' in a folder '/email' and rename it to
'index.php'.
You can always e-mail me!
Niels Gorisse
OneFTP
- Size: 15.2 KB
OneFTP is a small FTP-script, which does what you expect it to do. The only thing it has besides the basic stuff, is virtual users, which means that although you only have one FTP-account, you can fake extra accounts. This might be usefull if you do not have your own hosted server but you want to give access to a directory to someone specificly. Note that you often can't upload more than 2MB due to PHP-server-settings.
OneForum
- Size: 5.4 KB
OneForum is a very small basic forum, which uses flat files to save the messages. The code is so small, it nearly fits on one paper. This has the advantage that if there is something you don't like about it, you can easily change it yourself. And it installs as all scripts: upload it, and you're done. For if you need to have a small forum right now.
OnePoll
- Size: 14.6 KB
- Needs: OneSQL
OnePoll is an open poll-system, usefull to get an answer from a lot of people, but without getting tons of mails or spend an hour reading a forum to get the conclusion. People can add any new options themselves, that's the thing with Onepoll. This really saved me a lot of e-mail-reading; it really works quite well when there are more than 4 persons and you have to decide one thing.
Note: make a subfolder called 'data', and make sure it's chmod'ded to be writable by PHP, because that's where the data is stored. You can put an index.html or a .htaccess there to make sure nobody can read it.
OneSQL
- Size: 17.6 KB
OneSQL (formally known as noSQL) is a small set (11kb) of SQL-like PHP functions to manage a database in an SQL-like way, but without actually having a SQL-server. Everything is stored in flat .csv-formatted files, so putting data into OneSQL or getting data from OneSQL inside a spreadsheet program is a piece of cake. If you are too lazy to setup an SQL-server, or you simply don't have one right now but perhaps later in the future, use OneSQL.
There are 9 primal functions inside OneSQL. Similar SQL-queries are printed above each function. Here they are:
// IF OBJECT_ID($table) IS NOT NULL RETURN 'TRUE' else RETURN 'FALSE'
function nosql_present($table)
// CREATE TABLE '$table' $fields
function nosql_createTable($table,$fields)
// DROP TABLE '$table'
function nosql_dropTable($table)
// SELECT * FROM '$table'
function nosql_selectAllFrom($table)
// SELECT * FROM '$table' WHERE '$property' $comparator '$value'
function nosql_selectAllFromWhere($table,$property,$comparator,$value)
// INSERT INTO '$table' VALUES $record
function nosql_insertInto($table,$record)
// UPDATE '$table' SET '$prop' = '$new' WHERE '$searchfor' = '$value'
function nosql_updateSetWhereEquals($table,$prop,$new,$searchfor,$value)
// DELETE FROM '$table' WHERE '$property' $comparator '$value'
function nosql_deleteFromWhere($table,$property,$comparator,$value)
// mysql_fetch_array($array); the second argument is optional, which is by default MYSQL_BOTH
function nosql_fetch_array(&$pointer,$how="NOSQL_BOTH")
Example
A small example is listed below here. If you do not understand this, then go and learn PHP first and do not start with OneSQL before you do understand it.
if (!nosql_present("test"))
nosql_createTable("test",array("name","lastname","birthdate"));
$add[name]="no";
$add[lastname]="SQL";
$add[birthdate]="22 November 2003";
nosql_insertInto("test",$add);
echo "<table>";
$result=nosql_selectAllFromWhere("test","lastname","=","SQL");
nosql_sort($result,"lastname"); // you can leave this line out if you don't want any sorting
while ($record=nosql_fetch_array($result))
{
echo "<tr><td>$record[name]</td><td>$record[lastname]</td><td>$record[birthdate]</td></tr>";
}
echo "</table>";
nosql_updateSetWhereEquals("test","birthday",time(),"name","no");
nosql_deleteFromWhere("test","name","=","no");
There are a few more functions, which have two selection requirements instead of one. And, there is a sorting algorithm. Here they are:
// SELECT * FROM $table WHERE $property $comparator $value AND $prop2 $comp2 $val2
function nosql_selectAllFromWhereAnd($table,$property,$comparator,$value ,$prop2,$comp2,$val2)
// UPDATE $table SET $prop=$new WHERE $searchfor=$value AND $also=$val
function nosql_updateSetWhereEqualsAnd($table,$prop,$new,$searchfor,$value ,$also,$val)
// DELETE FROM '$table' WHERE '$property' $comparator '$value' AND '$prop' $comp '$val'
function nosql_deleteFromWhereAnd($table,$property,$comparator,$value,$prop,$comp,$val)
// (SELECT .... FROM $table ) ORDER BY $column $type
// Use between the select() and fetch_array() calls, and use the select() argument.
// Look at the example above, and notice that this method does not return any value, it only alters
// the existing select-result. The last parameter is optional, and is "ASC" by default; change this to
// "DESC" to make it a descending sort.
function nosql_sort($select_result,$column,"ASC")
// (SELECT * FROM $table ) ORDER BY RAND() $LIMIT
// Use between the select() and fetch_array() calls, and use the select() argument.
// This function selects $limit items randomly from a table.
// Note: UNTESTED
function nosql_OrderByRandLimit(&$select_result,$limit)
/*
$query = array (property,comparator,value)
OR
$query[] = array (property,comparator,value)
call with
nosql_selectAllFromWhereArr("inc/db/article",array("property","comperator","value"));
OR
$query[] = array("property","comperator","value");
nosql_selectAllFromWhere("inc/db/article",$query);
Note: UNTESTED
*/
function nosql_selectAllFromWhereArr($table,$query)
Your files will be acessible by a simple http:// call. To fix this:
- put all your .csv files inside a folder called 'data'
- Make sure you define the $nosql_datadir to "data/" or replace all "yourtable" appearances with "data/yourtable"
- create a file called ".htaccess" inside the data folder with as content: Order deny,allow Deny from all
- if you can't change any data anymore, use 'chmod' on the .csv files to regain access
Note: if you want to import a .csv file, first prepare the .csv file with a text-editor
so that the line-endings are unix line-endings and not DOS line-endings. The first
line is used as names of the colums (look at a OneSQL generated file first).
Download
Download it here: OneFile1.79.zip (± 102kb)
Last updates:
- 06 June 2010 (fixed timestamp reading of e-mails from pmmail in onemail)
- 24 January 2010 (cleaned up layout and some possible bugs by loading it into Eclipse/PHP)
- 8 January 2010 (fixed small upload problem in oneftp in root folder)
- 9 April 2009 (very small fix: oneftp file editing regarding html entities)
- 5 March 2009 (seperated view/download/edit in oneFTP, copied oneForum with oneftp from viceroy321)
- 3 Februari 2009 (fixed going back to the same folder in the 'edit' in oneFTP)
- 28 January 2009 (added a primitive 'edit' button in the oneFTP)
- 9 October 2008 (added automatic focus to the first input field for onemail and onepoll)
- 6 October 2008 (finally added working imap support to onemail, and fixed logon problems by centralising the login-code)
- 14 september 2008 (added writable-check in onesql)
- 5 August 2008 (added feature: you can automaticly delete the message you are replying to)
- 28 April 2008 (fixed OneFTP PHP5.2 message, and removed temporal file storage before downloading)
- 21 October 2007 (fixed some more PHP 5.2 issues in onemail, is now 100% without any warnings, and a onesql update)
- 15 July 2007 (fixed some PHP 5.2 issues)
- 15 April 2007 (added Return-Path and Reply-To headers in onemail)
- Februari 2007 (fixed descending sorting inside onsql)
- 20 January 2007 (added the most recent onepoll code)
- 11 August 2006 (small Oneforum file-lock fixes)
- 23 July 2006 (added OneForum)
- 07 July 2006 (various small fixes)
- 29 May 2006 (onesql: added error handling and global folder thanks to Izzy!!, oneftp: fixed some errors with windows servers)
- 28 April 2006 (OneMail: have to be logged in to send an email...)
- 24 April 2006 (fixed sending text/plain attachments with gmail, OneFTP now also shows hidden files)
- 18 March 2006 (added 'Vote' possibility in the poll)
- 7 February 2006 (faster sorting in onesql, ftp support for Outlook Exchange)
- 12 January 2006 (fixed small onepoll problem)