How shit (literally) works
From GSHI
This is going to be somewhat random information determined often by horrible methods that may be unreliable and impossible to replicate.
GSC's Useless Excrement
GSC's site, is a PHP based frontend for a MySQL database set up in a rather horrific manner. The layout is driven by the Smarty template engine, and is the sort of thing that obviously had been taken off some junk template site.
temp02.gif @ GSC Note that their version of the layout, uses blue instead of orange for the search box. But, they left this image up as part of the layout anyway.
temp01.jpg @ GSC Another interesting image. Unused, but it's still up. I like how the bald guy doesn't look too happy.
Here, is the contents of their .htaccess file:
Options -Indexes
ErrorDocument 404 /
Redirect 301 /usage/ http://www.gscentral.org/
Redirect 301 /usage http://www.gscentral.org/
Redirect 301 /templates/ http://www.gscentral.org/
Redirect 301 /templates http://www.gscentral.org/
Redirect 301 /logs/ http://www.gscentral.org/
Redirect 301 /logs http://www.gscentral.org/
Redirect 301 /sitelog/ http://www.gscentral.org/
Redirect 301 /sitelog http://www.gscentral.org/
Redirect 301 /configs/ http://www.gscentral.org/
Redirect 301 /configs http://www.gscentral.org/
Redirect 301 /Smarty/ http://www.gscentral.org/
Redirect 301 /Smarty http://www.gscentral.org/
Note, that they didn't bother to add such redirection to certain directories. Specifically: admin, include, and usage. But then the contents of those directories aren't as entertaining as the names would imply. usage contains their Webalizer reports (which they obviously know nothing about). admin contains nothing useful (likely even to the owners). Then finally include (which used to be open to the public, complete with lots of files ending in .inc)... This specific directory, is full of shit.
include/
As of sometime around 2007, this is what it had in it.
.htaccess
patterns.inc
AbuseCheck.php
codeurl.php
config.php
crypt.php
db.php
dbfunc.php
debug.php
display.php
errors.php
import.php
page.php
pagecheck.php
patterns.php
search.php
session.php
.htaccess
Nothing specific here. Just the usual basic auth contents seen in many .htaccess files.
patterns.inc
Seems to be a PHP script, though not well named (which is part of what got them screwed before this collection of files was made). Contains a class for something labeled singleton.
AbuseCheck.php
4.73 KB of scripting to abuse harmless users, while keeping bystanders laughing.
codeurl.php
This, is one segment of the pointless code URL encryption stuff. Not much in here.
config.php
Settings, settings, and more settings. There's some interesting pieces of info about the incomplete database structure, but that's about it.
crypt.php
General abuse of mcrypt. Small file too.
db.php
Not sure what to make of this, but it was at the beginning of the file.
/**
* A generic interface for intefacing with the MySQL database
*
* A modification of the from "Advanced PHP Programming" by George
* Schlossnagle used to interface with the MySQL database in PHP4
*
* @package DB_Mysql
* @author George Schlossnagle
*/
Then there's this.
/*
* A class to store mysql errors
*
* Acts as a pseudo exception for use in PHP4
*
* @package DB_Mysql_error
* @author Rob Woolley, George Scklossnagle
*/
There are more similar comments, but these are the best examples. Amazingly, it even contains functions for managing the code database, but somehow I doubt they've ever been used. Very large file, for what little it actually does. Also: Amazon.com: Advanced PHP Programming: Books: George Schlossnagle
dbfunc.php
Another mostly garbage filled file. Strangely it seems to be a slightly less dense duplicate of what db.php does.
debug.php
Not the most elegant solution for having PHP decide if it should puke errors, but maybe that's not the point.
display.php
Mostly, it includes the code of Smarty. The rest, is likely of no importance.
errors.php
Nothing to say here. Doesn't seem to do much, if anything.
import.php
Now this, is something of interest. It happens to be the ridiculously slow code file importer used to convert the nasty flat file database into SQL. Or so it seems. Now if only some people who know what they're doing, could get their hands on the files this thing processed.
page.php
A whole 1.03 KB file... Dedicated to generating the range of numbers for pagination.
pagecheck.php
By far the smallest file in here. It does nothing useful. It's likely part of the User Abuse stuff.
patterns.php
Exactly the same as patterns.inc, only correctly named.
search.php
All this does, is intentionally destroys user search input. Thanks to an unnamed person, this also filters out the quite useful (for seeing what's there) _ character.
session.php
Makes, plants, and reads cookies. It's also rather a monster, but not a cookie monster.
Database Stuff
Contents
Codes
In 56 tables (yes... 56), there is a grand total of 2,117,877 codes. Note that this includes any duplicates, and there's a lot of those.
Performing this query: select count(distinct code) from bsf_codes
Results in this value: 1819581!
Now, it's entirely possible some of those are legitimate different codes. However... There's no reason to even consider that all or even most of them aren't just crap duplicates.
Misc stuff
Estimated Processing Time
Two samples taken from gsc_code_1_1, the first and last entries in the "created" column: 2006-12-31 11:12:42 and 2006-12-31 13:18:21.
Since the date is the same, only the time is significant.
11:12:42: 40362 seconds
13:18:21: 47901 seconds
47901 - 40362: 7539 Seconds from the beginning of the table, to the end.
Then, there's the total number of rows in that table: 102642
102642 / 7539: 13.61480302427377636291285316355
So that makes about 13.615 codes per second. Must be a gang of illegal immigrants in their basement doing this stuff by hand.
The "total" number of codes in the entire database (assuming the statistics BSFree swiped out of the original DB are
correct, which they aren't) is 2116065.
2116065 (codes total, estimated) / 13.615: 155421.59383033419023136246786632 seconds processing total (estimated)
43.172664952870608397600685518423 hours total (estimated)
With all this, I think it's safe to say that a lot of time was wasted for a very low quality result.
Also, here's what seems to be the earliest and latest timestamps in the code tables.
Start time?: 2006-12-31 11:12:42
End Time?: 2007-01-05 04:47:13
To think that somebody actually spent the better part of a week, with their code grinding away at this, is really rather amusing.
Layout (incomplete)
The bulk of the data, is 56 tables of codes. These are separated by "device" and "system". The naming is similar to this: gsc_code_(systemID)_(deviceID) Presumably, gsc_code_index was intended as a reference for retrieving the table names using just numbers. The whole idea is incredibly stupid, and as far as I can tell offers no benefits at all. If anything, it complicates the situation of retrieving codes.
