Note by Apollia on Nov. 8, 2023: Please join my Patreon if you'd like to support me and my work!

My main personal website is now Apollia.org. I'm still not sure what to do with Astroblahhh.Com, so it's mostly staying as-is for now.





Go to bottom

Astrosorting Music Organization Database
Readme File

The Astrosorting Music Organization Database (AMODB) is software I, Apollia of Astroblahhh.Com, wrote mainly in PHP, with a bit of JavaScript. The AMODB also uses a MySQL database.

In order to run the AMODB, you will need to be running some web server software, like XAMPP, which can run PHP and has a MySQL database; or else upload the files to an actual web server which can run PHP and which has a MySQL database.

(However, I don't recommend the latter option; this software wasn't designed to be on a web server, and might be too slipshod, security-wise, for that, vulnerable to SQL injection attacks, etc., and it isn't designed for multiple users, etc.).

Please only use this software at your own risk and please don't sue me if anything goes horribly wrong. Thanks. :-)

I've done my best to make sure it's safe for use on your own computer, and below I've shared all I know of to enhance the security of your computer's web server software (based on what I've done with my own set-up), at least if you're using Windows - but I know far from everything about this stuff, and there could be some horribly obvious things I'm overlooking.


In the process of designing and using this, I have been using XAMPP, "an easy to install Apache distribution containing MySQL, PHP and Perl" for Windows. (You can even install Python, though it took me hours to figure out how). Apache is a type of web server software. PHP, (which I used in the AMODB), Perl, and Python are three popular programming languages. MySQL is a type of database software, and that's what the AMODB uses to store data. I used JavaScript for a few convenient user-interface frills. (Perl and Python weren't used in the AMODB).

You can get XAMPP for a variety of different platforms, like Windows, MacOS, Linux, and Solaris (whatever that is) at this link:

http://www.apachefriends.org/en/xampp.html

I recommend installing or unzipping the files directly to the location C:\xampp on Windows.

You can start Apache and MySQL by opening the file xampp-control.exe in the directory C:\xampp\ and clicking the Start buttons next to "Apache" and "MySql".


However, be warned that you probably should implement various measures to make sure you have some extra security - because if someone has your IP address, and there are no other safeguards, then, while Apache is running, people on the internet could literally browse some of the files you have on your hard drive. Hopefully only files in the C:\xampp\htdocs folder, but who knows? (Not me - I'm not some kind of internet security expert.)

One of the easier measures is to change some of Apache's configuration settings. Go to the C:\xampp\apache\conf folder. Make a duplicate of the httpd.conf file, so in case you mess anything up, you can go back to the original settings. Then, open httpd.conf with a text editor.

Go to the section that says:

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

You'll want to delete those last two lines, and replace them with:

    Order deny,allow
    Deny from all
    Allow from 127.0.0.1

127.0.0.1 is the "localhost" address, so, that means anyone with an IP address different than that (such as anyone on the internet) should not be able to get files. I assume this probably works, but I would never trust this 100%, because you never know how a computer might be messing things up behind the scenes, either through inadvertant glitches, or by malicious design.

Something to be wary of that I wasn't aware of until March 2009: various other .conf files, and any files named .htaccess in various directories in the XAMPP directory, can change the above rules for at least parts of your server and maybe more than just parts of it (I'm not sure). So, there are also a number of other files you should change too. We'll get to that below.

Before we leave httpd.conf, however, we should make a couple other changes. Go to the line that says:

LoadModule dav_module modules/mod_dav.so

Put a pound sign at the beginning of the line, like so:

#LoadModule dav_module modules/mod_dav.so

This makes it so the WebDAV module is turned off. WebDAV is a module for "Web-based Distributed Authoring and Versioning", which apparently allows "creating, moving, copying, and deleting resources and collections on a remote web server".

Then, go to the line that says Listen 80. Change it to Listen 127.0.0.1:80. I'm not sure what that does exactly but I think it might make it so not just any IP address can be used to attempt to get things from your web server.


Next, go to the C:\xampp\apache\conf\extra folder. Make backup copies of the files httpd-dav.conf and httpd-xampp.conf. Then, open httpd-dav.conf with a text editor.

Go to the section that says:

     Dav On
    Order allow,deny
    Allow from all

Change it to:

    Dav Off
    Order deny,allow
    Deny from all


Then, open httpd-xampp.conf with a text editor. In this file, there are numerous blocks of text that say:

        AllowOverride AuthConfig
        Order allow,deny
        Allow from all

You'll find a couple of those blocks of text under <Directory "/xampp/security/htdocs"> and <Directory "/xampp/phpMyAdmin">. Change them to:

        AllowOverride AuthConfig
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1

You'll also find a couple more of those blocks of text under <Directory "/xampp/webalizer"> and <Directory "/xampp/contrib">. Change them to:

        AllowOverride AuthConfig
        Order deny,allow
        Deny from all


Now, go to C:\xampp\mysql\bin. Make a backup copy of the file titled "My". Then, open the "My" file with a text editor. Find the text server-id = 1, and above it, add this line:

bind-address = 127.0.0.1


Next, go to C:\xampp\php. Make a backup copy of the file "php.ini". Then, open "php.ini" with a text editor. Find this line:

; Magic quotes
;

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = On

Change the last line to:

magic_quotes_gpc = Off

Sorry if anyone out there actually uses the incredibly annoying magic quotes feature for anything, but, my programs are all incompatible with magic quotes, and I'm not sure how I'd make them compatible.


Next, you should probably have a firewall. You might have to fiddle around with your firewall software to be able to use Apache at the same time you have your firewall software on.

I have Norton Internet Security 2003 and Windows XP, so these next instructions (or suggestions) won't apply to everyone. If you have Norton Internet Security, then, the first time you start Apache and MySQL, a Norton Internet Security alert should come up asking you whether to permit or block them, or if you want to manually configure access.

I picked manually configure, then blocked connections to and from any other computer, both TCP and UDP connections on all ports, and, since I'm a bit paranoid, I have it create an event log entry and show me both a Security Monitor and Security Alert message when that firewall rule is triggered. These alerts display every time I start up Apache and MySQL. And, it used to be that if I didn't do this next step, those alerts came up intolerably often, every time I did anything with Apache, like browsed a web page on my computer's server.

If you have that problem, to fix that, open up Norton Internet Security, then click Personal Firewall, and click the Configure button. Then, go to the Home Networking tab. Click add, and select "Individually", then put in the localhost IP address - 127.0.0.1.

Hopefully this won't be a horrible, security-endangering move. If you're really worried, you can delete 127.0.0.1 from your Trusted Zone when you're done using XAMPP - or, you can physically disconnect your computer from the internet when you use XAMPP.

Oddly, for some reason I no longer have to have 127.0.0.1 in the trusted zone at all to avoid all those alerts. I don't know what I changed exactly that made that happen, but, yay. :-)


If you really can't figure out how to configure your firewall, or just don't trust it, a presumably safe alternative is to physically disconnect your computer from the internet and turn off your firewall software while you're running XAMPP. Remember to turn your firewall software back on before you reconnect your computer to the internet.

If you're using Norton Internet Security 2003 and somehow messed up the firewall rules when you first configured them, you can edit the rules you added by opening Norton Internet Security, clicking Personal Firewall, clicking the Configure button, and going to the Program Control tab. Apache will be listed in the programs list as "apache.exe" and MySQL will be listed as "mysqld.exe". Highlight whichever one you want to edit and press Modify, and adjust it as you wish.


One odd side effect of having Apache on while I was browsing the rest of the internet was that sometimes little web browser alert things used to pop up asking me about certificates and stuff related to "localhost". Also, if I deleted 127.0.0.1 from my Norton Internet Security Trusted Zone and still had Apache running, visiting some internet sites triggered multiple Norton Internet Security alerts.

I believe this might have been related to the fact that I use a Hosts file to block Google AdSense, Google Analytics and other nuisances - since what a Hosts file does is redirects attempts to connect to nuisance sites to some other IP address, and frequently, the IP address of choice is 127.0.0.1 - the localhost address.

So, I think, when you have Apache running - because Apache reacts whenever anything on your computer goes to http://localhost/ or http://127.0.0.1/ , Apache takes notice when the Hosts file redirects stuff to 127.0.0.1, hence possibly triggering various Norton Internet Security alerts (if 127.0.0.1 isn't in your Trusted Zone) which don't normally show up when Apache is turned off, as well as somehow causing those web browser alerts about certificates and localhost, etc.


(By the way, though this has nothing to do with installing the Astrosorting Music Organization Database, I just thought I should point out somewhere that, despite the fact that I keep putting in these links to Wikipedia articles, you should never completely trust Wikipedia, since Wikipedia can be edited by literally anyone at any time.

And, while we're on the topic of security, I'd like to also point out the excellent free (but not open source) software Spybot: Search & Destroy. Among many other things, it creates (or edits) a Hosts file for you, though you can also edit it manually.

On my Windows XP computer, the Hosts file is located at C:\WINDOWS\system32\drivers\etc . If you want to edit your Hosts file, I recommend making a backup copy of it before you edit it).


And, another security-related idea - a router might be helpful. A router is a physical device which you might use to share your internet connection (like probably a high-speed cable connection) amongst multiple computers in your house. As I understand it, in my currently feeble, poor, and inadequate way, any connections that try to come in from the internet have to go through the router, and somehow this can help with your security.

However, if you have a router, you should have a password on it, because otherwise, anyone who visits your IP address and puts in your router's default login details will be able to get into your router and reconfigure its settings, unless you changed the default login details.

Consult your router's manual for more details. (And in case you can't find your router's manual, you often can find the manuals of routers on the web on the manufacturer's website).


Finally, once you start running XAMPP, you might as well go to http://localhost/xampp and click the Security link, and follow the instructions to plug the various security holes that are left open by default.


By the way, I would like to caution people against just running any random PHP, Perl, or Python script they find without understanding it. Even I didn't realize this at first, when I first installed XAMPP, but:

To my surprise, these scripts, run by Apache/xampp, are capable of accessing, reading, writing, overwriting, and deleting information not only in the htdocs folder, but anywhere on your hard drive.

That is actually what made some features of the AMODB possible, like the ability to output playlist files, search results files, etc. to anywhere on your hard drive; and the ability to read what files are in a directory, and their file sizes, etc.

But, it also means scripts are potentially very dangerous. So, don't go naively running every random script or scrap of source code you find on the internet, OK?


Another thing more people should be aware of is the fact that JavaScript, as well as Java and ActiveX controls, can sometimes be exploited to do various bad things. Here's a forum thread with more information on that topic.

To avoid such problems, I like to either a) use the Opera web browser with my toolbar customized to have three checkboxes in it: "Enable plug-ins", "Enable Java" and "Enable JavaScript", which I normally leave unchecked, or b) use Firefox either with the NoScript plug-in, or with JavaScript, Java, ActiveX, Flash, etc. turned off completely.


When or if you have the various security issues figured out to your satisfaction - start up Apache and MySQL by opening the file xampp-control.exe in the directory C:\xampp\ and clicking the Start buttons next to "Apache" and "MySql".

Then, then you can access the Astrosorting Music Organization Database by following this link, assuming you have the AMODB folder in C:\xampp\htdocs.

http://localhost/amodb/00main.php

The first time you follow that link, there will be a login page. By default, you don't have to enter any user name or password, and the cookie it creates will last a very, very long time. If you'd like to change this, though, you can edit the source code of login.php.

It's not very good security, especially if the person trying to log in is physically using your computer (meaning the AMODB source code files are probably all accessible to that person if they know to look in the C:\xampp\htdocs\amodb folder ). But it could deter someone not very knowledgeable about computers and/or not very determined to get in.

Once you've logged in - if the navigation links (like "Add Musician - Add Group - Add Source - Add URL - Add Song" etc.) are at the top of the 00main.php page, then, Apache is working.


However, before you can get started using the AMODB, you'll first need to mess about with MySQL.

Open the source code file "vglib.php" and in the ConnectToDb function, change the user name and password to your MySQL user name and password. As for where to get your MySQL user name and password - well, if I recall correctly you can set your MySQL password possibly easily by following the instructions at http://localhost/security/index.php if you haven't already set a password for the MySQL root account.

Alternatively, instead of changing the user name and password used by "vglib.php", you can create a MySQL user named "insertnamehere" with the password "insertpasswordhere" and that will work fine too. :-) (You can manage MySQL user accounts from within phpMyAdmin by clicking the Privileges link).

Next, go to the software phpMyAdmin, which is a handy MySQL database manager program included with XAMPP.

In the text box underneath the text "Create new database:", type in "amodb" and press the Create button.


Then, if you want to load in the example database, which consists of many of the songs on my Astrosorted Music List pages, follow these numbered steps. If not, just skip past them.

  1. Download the example database zip file here, if you haven't already. Unzip the file.

    If you don't know how to deal with zip files, or even what they are, you should definitely learn. Here's a helpful basic article about them: http://www.tech-pro.net/howto_030.html.

    In contrast to that article, however, I prefer the software WinRAR for extracting zip files, though I suppose I'd be better off finding a truly free, open source alternative.

  2. Once you've created a new database named "amodb" in phpMyAdmin, click the Import link. On the Import page, click the "Choose..." button, and select the file "AMODB-Example_Database.txt", which is the file contained in the example database zip you downloaded. Then, click the Go button. (If you don't see the Go button, scroll down a bit).

  3. Almost done! Now, go to this page: Change Local Folder in Database for All Songs

    Even if you haven't yet downloaded all the songs in the example database, no matter. This will simply update the database with the detail of where all those songs are supposed to be found on your hard drive. Create a folder somewhere on your hard drive where you intend to store those songs, then copy and paste its file path into Local Folder text field, and press the Change Local Folder button.

    Local links and playlists created by the AMODB based on the information you just input will only work once you actually put the songs in that folder.

  4. Now, you can go to this page and marvel at your shiny new example database: List Songs And run some searches: Search/Playlist Maker And so on...

If you don't want to bother with the example database, though, simply go straight to this page: Nuke AMODB and/or Make New Database Tables Then press the Make New Database button, and you'll be set.


You might like to customize the location to which playlist files, search result pages, astrosorted music list files, and musician list files are output by opening up searchandplaylistgen.php and astrosortfilegen.php in a text editor and editing some of the variables near the top related to the intended location of the output files. Before you edit them, though, make a duplicate copy of those files first, so in case you mess anything up, you can easily back to the way things were.

I guess if I went to the trouble it would be possible to make something which would make editing the source code unnecessary, but, I don't really feel like it, and besides, the more comfortable with computers and directly editing source code you get, the better off (as in, the more computer literate, and the more un-helpless when it comes to computers) you'll be.


OK, hopefully all that wasn't too horribly confusing. I've tried to make it as simple as possible, and it would be nice if this were the sort of software which you could just download and double-click on it and it would install, but, I actually don't know how to make that sort of thing yet... :-)

But, it probably wouldn't be useable on multiple platforms if I did that. So, actually, I quite like the trade-off of greater complexity in exchange for it (presumably) being able to run on multiple platforms. I don't actually know how well it runs on any computer besides my own set-up, but, hopefully it works.

I suspect it might have to be modified a bit to deal correctly with the formatting of file paths on computer platforms other than Windows - I'm not sure, though.


Lastly, if you'd like to change cosmetic aspects of the AMODB, and have such things as a different color scheme, different fonts, etc., you can edit the AMODB's CSS file, titled "a.css", which resides in the CSS folder. Of course, I recommend making a backup copy of it before you start editing it, in case you want the old settings back.

OK, have fun.

http://localhost/amodb/00main.php



Upgrading to AMODB v2.2

Fortunately for any users of AMODB v1.0, I actually managed to make it surprisingly easy to upgrade to AMODB v2.2. First, rename the original AMODB folder located at C:\xampp\htdocs\amodb (or wherever else you have it) to something else. Then, put the new amodb folder where the old one used to be.

Next, you should probably make a backup copy of your original database, just in case anything goes wrong. You can do that by opening phpMyAdmin, selecting the AMODB database, clicking "Export", clicking the "Save as file" checkbox, choosing a place to put the file, and clicking the "Go" button.

Once you've made a backup copy of your original database, then, go to the AMODB's main page and click the Dangerous Functions link. Then, click the Update AMODB link and the Update AMODB button. It will take a little while, but if it succeeds, your database will now be updated to version 2.1.


If you're upgrading from AMODB 2.0 to AMODB 2.2, the only thing you need to do is rename the v2.0 AMODB to something else, and put the new v2.2 AMODB folder where the old one used to be.

If you're upgrading from AMODB 2.1 from AMODB 2.2, the only things I updated were this readme file and the 00main.php file, so you can just drop those two files in your v2.1 folder to be totally up to date.



Update History

The AMODB was first released on April 4, 2008, after about 2 months of work. It was the first large project written in PHP/MySQL/JavaScript I ever completed.


The AMODB v2.0 was released on Dec. 11, 2008 after an unknown (but large) amount of inconsistent but dreadfully hard work. I worked particularly hard on it in Dec. 2008. I also used parts from other, not yet released projects which I've been working on throughout 2008.

The most major new feature is the addition of search tags (adjectives, lead instruments, other instruments, genres, languages, other tags). I still prefer astrosorting rather than using tags to sort my music according to mood, since astrosorting is faster. But, the tags come in handy for some things, like if you are in the mood for nothing but sad piano-only music or something. :-)

Some nice things about my search tag system are: it allows you to include spaces in tags, and if you put in a multi-word tag like "Electric Guitar", the AMODB automatically makes tags out of each separate word, making it so it's not necessary for you, the user, to redundantly put in separate tags for "Electric" or "Guitar" to be able to find that song with a tag search for "electric" or "guitar".

This is a great improvement on the messy del.icio.us-like tag system I was using originally, which didn't permit spaces between words, and which might tempt you to input redundant tags, like "ElectricGuitar", "Guitar", "Electric".


I also added a few additional checkboxes here and there - "Temphide", "Permhide", "Find Again", "Add Later", "Deleted", "Medley", and "No 'New' Label". That last one makes it so I can edit the database entries of old songs without having a "New" label erroneously show up next to them when I output my Astrosorted Music List pages.

I added a new Stream nametype, which is supposed to be used for the names of internet streaming audio providers, so the URLs for those providers can be stored in the database. Meanwhile, the direct links to streams themselves should be added as a "song" with the URL type "STRM". Sometime I plan to code something to output nicely-formatted pages of streaming audio links, along with the web pages of the providers of those streams.

I finally completed the Export Public DB script, and created the thankfully easy to use Update AMODB script. And, I stumbled across and fixed some glitches with the search commands which made it into v1.0. If I recall correctly, those glitches were: something where not all possible combinations of labels and sublabels were searched, and something where using a negative planet label like "!ve" somehow messed up the SQL query produced).

There were other minor things I did too, but, they're either too boring to mention, or I don't remember them.

The AMODB v2.1 was released 2/28/2009. The most important updates (and the only ones I remember the specifics of) were, I fixed a couple small problems in the tag library. First, there was a problem which I discovered in WordsPlatz (which uses largely the same tag library), in which, if you deleted all the tags of either tag type from a post, the tagmap table didn't have all the tags for that post deleted, only some of them. Second, there was a problem I discovered while working on Astroblahhh Desktop, in which, due to some missing parentheses, sometimes subtags would mistakenly would get deleted from all songs instead of just the one being edited.

The AMODB v2.2 was released 3/23/2009. None of the code was changed - I just updated this readme file to add a bunch of new security tips I recently figured out, and also to provide instructions for turning off PHP's annoying "magic quotes" feature. I also updated the 00main.php file just to change the version number.


Starting with AMODB v2.0, to edit the source code, I usually used the wonderful code editing software Notepad++ v5.0.3. With its color coded text, fully customizeable colors, line numbers, bookmarks, easy indent features, etc., it really helped a lot, especially once I got used to it and stopped getting distracted by all the pretty colors. It is now my favorite code editor.

I also used NoteTab Light a bit, which is still my favorite plain text editor, though no longer my favorite code editor. I usually used it only for quick, minor, or non-code-related changes in v2.0, but I used it for everything in v1.0.


Something that was of enormous help in figuring out how to make a tag system was this page: Tags: Database schemas Thanks, authors of that page. I originally started out with something modeled after the "Toxi" system. At first I was happy enough with something cloning del.icio.us, but I became increasingly nagged by the feeling that I should make some improvements.

So finally, I did. Surprisingly, it only took less than a week in early Dec. 2008, but it was quite a tedious chore. I'm not sure I would have bothered to do it if I didn't have 5 or more other projects I want to use this tag system in. The fact that I can reuse pieces of the AMODB in numerous other projects greatly increased my motivation to complete it.


Go to top
Last modified: Mar. 23, 2009
This page uploaded to web: Apr. 4, 2008





Note by Apollia on Nov. 8, 2023: Please join my Patreon if you'd like to support me and my work!

My main personal website is now Apollia.org. I'm still not sure what to do with Astroblahhh.Com, so it's mostly staying as-is for now.