Why does this kind of talk totally turn me on?.
I just love databases interactions between different programs making stuff more efficieint!.
Oh, let me turn you on, baby. So I started working on that Mod Download Center in my free time. Just a start, but it'll get there. Anyway, the site is run with the standard jumble of markup and programming languages. HTML, CSS, JS, PHP, and MySQL. Honestly, you'd figure someone would find a way to unify web development by now. Anyway, The site functions via a series of get variables passed into the main PHP script, which references a MySQL table for the Glest mods. Each mod has its own row, and stores the name, type (tech, tileset, map, etc), description, author, version, download link (stored relatively based on a unique ID assigned to the mod and a timestamp), download count, rating (stored as the sum of all ratings and the number of times it's been rated, which gives us the average rating), and the engines the mod is compatible with. Anyway, so the main page is a nifty little table with the most useful data displayed: mod name, author name, rating, downloading link, download size, download count, license, engines (pictures below). This one page can display different tables depending on the type of mods we're looking for. And then there's also support for sorting the table in different ways and filtering by engine. And all of these values of independent of each other, so you can look for techs sorted by rating which are MegaGlest compatible.
But anyway, what about the rest of the data stored about mods? Well, when you click a mod from the table, we're presented with a new page, which, from the supplied mod ID, displays data about that one mod (again, pics below). In addition to the standard name, author, description, etc, we also have up to three images (which conveniently open in lightboxes to see fullsized images). These images are the only thing that's done slightly differently than the rest of the mod's data. Instead of storing their location in the database, they're given a folder based on the mod's unique ID. The images are optional, and the page scales appropriately when none or less than three images are supplied. Anyway, over to the rating, which is a feature I'm rather proud of. The rating system uses AJAX (first time trying that out) to dynamically update the rating without forcing the user to reload the page. When hovering over the stars on the mod page, you can choose your rating. Clicking the star sends an AJAX request to a new PHP page with the star's ID (mapped via an image map, as we're using two superimposed images for the stars; one being the faded background and the other being the dynamically resized golden stars). This AJAX script modifies the rating total and rating count before sending a success message. Upon receiving that, the original page makes a note that you've already rated the mod and "locks" the rating (yes, the fact rating isn't locked until receiving this success message means you could rate and refresh before the success message is received, yet not be locked out, but nobody really cares that much).
So as that stands, the ability to display mods and offer them for download is more or less fully complete. Technically, if I wanted to manually create the database of mods and upload the files, the site would be fully functional. The filters are also pretty easy to use, so one could link
<site URL>?type=tech&filter=engineMegaGlest to link to the list of mods of type "tech" (defined as both factions and techtrees) that are compatible with MegaGlest. Input has some basic, but sufficient, sanitation of input.
However, I still want to finish a proper "add mod" section first. The add mod page would allow a new mod to be added without having to directly add a row to the mod list table. Simply fill in the required fields, optionally choose up to three images (which the server would resize; creating a moderate sized and a thumbnail image), choose the file (in the future, I'd like to add the ability to bundle extra downloads on the page, so that, for example, the source files that a modder used could be bundled on the mod's page as a separate download. In the meantime, there's an "other" type for catching things like this).
There'll also be an "edit mod" page, which would allow an existing mod to be edited: a new download can be uploaded, details can be edited, and the images can be changed.
At one point of time, I'd like to add a user account system, so that modders can be linked to their mods, allowing them to edit the mod's entry themselves (admins would be able to edit any mod's entry). This would likely be done in an overly cautious way: An admin-only section would allow for creating a new account, which could then be passed to the modder so they can create their mod. The reason for this being that spam would be unacceptable.
Anyway, I promised pictures (click to view full images):




All which should have been posted on the other topic, but hey, what ever turns you on!
Edit: You wanna know what I did prior to learning how to use databases? I saved everything in text files. The last time I had a rating system, it saved the actual rated values in a text file, separated by spaces. So we'd end up with a file something like
5 3 4. Then I'd use PHP's explode() function to split the contents of that file into an array. I'd then add up all the elements of that array and divide it by the size of the array.
Yeah, I like databases better.