PHP: www-filesize

To get the filesize of a file that isn’t located on your own server is not such
an easy thing! There’s this nice function in PHP to get the size of your files,
filesize() – but it just works for local files.

This workaround should work. – kinda slow, as you need to make a connection to the
remote host, but that’s probably the only way to do it:

Read More

PHP5 and SQLite

Currently I’m working on SourDough Framework, my light opensource framework for web-applications written in PHP. It contains a database abstraction layer I started to work on together with Rocco Siegrist back in summer 2002. This part is already pretty mature. My upcoming applications PPhlogger3 (future version of PowerPhlogger), Pigalle (picture gallery) and Yabook (guestbook) are going to work on the following database systems: MySQL, PostgreSQL and Microsoft SQL Server 2k. I have already tested them on those systems. The DB abstraction layer should also support FrontBase, Interbase, and Sybase – but this hasn’t been tested yet.

Today I ran over SQLite. I didn’t really expect a lot of this „Embeddable SQL Database Engine“, how they call it. It stores data into flat files and pretends to almost fully support SQL92.
I was interested about it and implemented another layer for SQLite in my framework. And, wow, it works! It didn’t take me more than 2 hours. Currently, YaBook already runs with SQLite as DBS. I didn’t encounter any serious problems. Well, it took me some time to realize that SQLite is typeless. Pretty funny, though.
Instead of AUTOINCREMENTs I had to use INTEGER PRIMARY KEY. Even indexes seem to work.
I haven’t done any performance testing yet, but for simple operations it should be fine. For an application like YaBook it might as well be faster than MySQL.

SQLite has been bundled with PHP5. Effectively this means that anybody, even users at share hosters with no access to their server, will be able to use SQL databases. Great!

Interview with Benjamin Voigt – Microsoft .NET

Microsoft .NET vs. J2EE – Welche Technologie wird siegen? Was für Vorteile bringt uns .NET? Was steckt überhaupt hinter diesem Begriff?
Im Rahmen meines Studienprojektes bei der Credit Suisse Leasing habe ich dieses Interview mit Benjamin Voigt geführt.

Benjamin Voigt ist seit 2001 aktiver Microsoft Student Consultant an der Universität Zürich. Als ehemaliger Linux-Crack und Anhänger der OpenSource-Gemeinde besitzt er ein äusserst breit gefächertes Wissen. Gewiss kann er nicht als engstirniger Microsoftianer bezeichnet werden.
Momentan beschäftigt er sich mit XML, SOAP und zahlreichen neuen Entwicklungen innerhalb Microsoft’s .NET Framework. Er bereitet sich auf einen .NET Workshop im Oktober 2003 vor, für den er auch sehr viel seiner Freizeit aufwendet. Das Meiste macht Benjamin aus Eigeninitiative und Freude an der Technologie selbst und hat weniger mit seiner Anstellung bei Microsoft selbst zu tun. Dies zeichnet ihn zu einem äusserst interessanten Gesprächspartner aus, und ich bin ihm äusserst dankbar, dass er sich Zeit für dieses Interview genommen hat.

read interview

PHP: directory listing

you want to list a whole directory’s contents…
use the following function to list all files of the directory $url including filesize:

PHP: load SQL lines

first of all I want to give a big applause to Tobias Ratschiller, the creator
of www.phpwizard.net ! His nice tool phpMyAdmin helped me a lot administrating my mySQL-database. phpMyAdmin is probably the best
script around!! Often I was looking at his code to get some ideas and solve my
problems.
The following snippet has been taken out of his code. I just changed a couple
of things to let it run as an independent function.
Read More

PHP: ipcheck

sameIP() is my most important function in Power Phlogger. Phlogger calls that
function every time someone enters a page. Actually, that’s all it does: sameIP()
returns true if the visitor was already logged and doesn’t
need to be tracked again. I’m checking his IP and keep it for the last $timeout
minutes (as default I use 30 minutes). If it’s a new visitor or his timeout has
expired, the function returns false and I create a new hit.

Read More

css.php