Clan snapshot webserver scripts.

kidoblivious

New member
Here are 4 little scripts I wrote to beautify the clan snapshots directory. They won't work unless you are serving it up on a (Apache) web server with php and mod_rewrite - this however isn't a tutorial on installing them (I must emphasize this is no big shakes if you are thinking about it.)

What it does
index.php colours each record depending on month of the year and provides handy access to the internal directories mafia makes for the snapshots through the other scripts. (Tested for usefulness to red/green colourblind people on Mister Flopsy, feedback gratefully received.)
ascensions.php gives the saved ascensions for your clannies and their links to the KoLDB.
profiles.php gives the saved profiles of the clannies and links for each of them to the jicken wings DC database.
kolchar.inc collects the small bits of common code together in a useful place.


Installing it

Simply copy them into your clan snapshot directory (and change the owner to www and make sure the files are readable!) and browse to there!

If your (apache)webserver doesn't serve up index.php by default you add (modify) these lines in /etc/httpd.conf

DirectoryIndex index.html index.php
AddType application/x-httpd-php .php

To support ascensions.php and profiles.php add these lines to your /etc/httpd.conf (they are what depends on mod_rewrite; there are other solutions to do this but this is mine;)

RedirectMatch ^/snapshots/(.+)/ascensions/$ "/snapshots/ascensions.php?dir=$1"

RedirectMatch ^/snapshots/(.+)/profiles/$ "/snapshots/profiles.php?dir=$1"

Change /snapshots/ to match your snapshot directory.

If you would like to see the working instance I am not shy, it is at http://www.kidoblivious.no-ip.org/SomethingLounge/snapshots/clan/

These scripts are neither 100% secure nor 100% bug-proof so you may want to think twice about copying them onto your web server and letting the world access them without first reading them to be sure they're doing what I tell you they're doing, and that I'm not some measly malware spreader.
Comments welcomed.
 

Attachments

  • clan-php.zip
    2.6 KB · Views: 102

kidoblivious

New member
Well, following the resounding success of the previous post I have made a couple of modifications, and added header.inc to simplify the clan identification process. Just change the statement
$clan = "Something Lounge";
to the statement
$clan = "MyOtherClanName";
in header.inc
and the scripts will be customised to your clan!
The previous need for rewrite rules has been removed, so if you put them in you should remove them now: this is one less thing to do for the new user!

To install:
As before php must be enabled.
Copy the scripts into your the root of your /snapshots/ directory and you're ready to go!

The implementation is now at http://www.somethinglounge.org/snapshots/ if you would like to view.
 

Attachments

  • clan-php-1.1.zip
    3 KB · Views: 95

Azrane

New member
Looking at your source, I couldn't help but notice something that made me scratch my head. In index.php, you have no body tags at all. You're using H1 tags that happen to be nested inside the HEAD tags. I'm sure this is simply an overlooked mistake. Also, your prettify() function uses excessive elseif statements. Could be shortened and read more easily using switch().

I haven't had a chance to use this yet, but I love the idea of it, and I'll bet there will be room for improvements, if not in function, then in form. ;)

I'm going to do a little poking around and see if I can't come up with something a little more aesthetically pleasing (to me at least). Would you be interested in any modifications I do?
 

kidoblivious

New member
OK, hands up, I'm not a particularly good writer of HTML, and I really should have looked up PHP switch syntax more thoroughly than the cursory moment I think I did, I think your criticisms are perfectly fair. A little shamefully, I shall revise prettify() to switch statements for the next version ;)

The HTML tags: I'll have a good look online and see if I can't sort my idiocies out for an even prettier release sometime soon.

Interested in any modifications you think should be made, do please share.... And thank you for the feedback, its what makes it (apart (of course) from the adulation of my clan members) all worth it! ;)

[quote author=Azrane link=topic=1760.msg8548#msg8548 date=1216764946]
Looking at your source, I couldn't help but notice something that made me scratch my head. In index.php, you have no body tags at all. You're using H1 tags that happen to be nested inside the HEAD tags. I'm sure this is simply an overlooked mistake. Also, your prettify() function uses excessive elseif statements. Could be shortened and read more easily using switch().

I haven't had a chance to use this yet, but I love the idea of it, and I'll bet there will be room for improvements, if not in function, then in form. ;)

I'm going to do a little poking around and see if I can't come up with something a little more aesthetically pleasing (to me at least). Would you be interested in any modifications I do?
[/quote]
 

kidoblivious

New member
I put in a bit more effort after incorporating the changes above described.

Fixed: Screwage from old (2006) snapshots where the filenames for characters were different.
Fixed: Changed the hardcoded (I can be fool can't I?) snapshots directory reference which was stopping the scripts just being dropped into place in any named clan directory anywhere.

Changed: Sort order of directories is now most recent first.
Changed: Some small alignment of things in tables. I can't decide what looks prettier. Reply with suggestions!

TODO: Some form of footer.inc I guess.
TODO: Prettify further?

Example site still at http://www.somethinglounge.org/snapshots/

For your server:
Extract into your clan snapshot directory on your webserver.
Change the value in header.inc from
$clan = "SomethingLounge"; to
$clan = "Clan of Doom";
Point browser at directory.
Cake!
Plese download from this post not the top post!

edit: Changed "The Clan of Doom" to "Clan of Doom": this is a little oversight as there's a The in the HTML presently, so having The The... for clan names would just be silly!
 

Attachments

  • clan-php-1.2.zip
    3.1 KB · Views: 87
Top