Project Design

General Design/Development

The site's visual design is based on a theme I found here. Development of the project incorporated XHTML, CSS, PHP, JavaScript/Ajax, XML, and MysSQL/SQL technologies.

Database Design

The database has a 'user' table to hold all user information and a 'username' table that contains fields corresponding to the iTunes Music Library.xml file data is created for each user in the registration process. Since some user's have large data files I thought it would be best for each user to have their own library table. No two user's can have the same username and if the user tries to register with a username already in the database they will be notified an account may already exist. Once a user registers for a new account, their username, password, email and a unique id are inserted into the users table. Then a $username variable is used to dynamically create the table name to hold the user's library.

Structure and Functionality

Password protected pages and form processing are handled by PHP. All user input on login and registration forms and the iTunes Music Library Uploader is validated for safety. A PHP function called notify outputs a template page for error notifications when validation is performed. The database connections are all defined in constants.php within the 'includes' folder. Also in this folder are other important included files: 'helpers' contains PHP notify, logout and redirect functions, 'common' contains warning and error handling, as well as session, authentication, redirect and database connection handling. Other common parts of pages like header, navigation menu, sidebars (general and post authentication) and footer PHP files are also in the includes folder and used for best page maintenance efficiency.

Uploader

The uploader is the main feature - once the user uploads their iTunes Music Library.xml file from their computer the file type is checked to ensure file format is XML. If the user attempts to upload any other format they will get an error message. The form submits to itself so the user can receive message on same page they are uploading from. An animated loading gif is used with some JavaScript so when a user has a large file they have a visual cue that it is processing. If the file is XML format and able to be uploaded, it is then placed into 'temp' folder on the server. From there it is inserted into the database with much help from source code I found here which parses the XML file. I tried to make this script into a function placed in helpers.php but could not get working that way so for now it is in the login-sidebar.php file but I think it should be factored out of the code on that page to make things cleaner. There are also some bugs to look at with this script and/or perhaps the database fields because a few user records throw SQL warnings if the selected data is missing. The 'username' table is designed to accept specific data from the iTunes Music Library.xml file. If all is inserted ok the user will receive a successful upload message and the file is then deleted from the 'temp' folder using PHP unlink function as the file is no longer needed and there is no point storing - and no space to store - all user uploaded files on the server.

Search Results

Once the file is uploaded and inserted into the database successfully the user is able to see a select menu populated with all the genres currently contained in their library. A SQL query handles the querying of data in the database. The file getselected.php processes the query for search and in the 'js' folder the select.js file facilitates the Ajax to display search results without refreshing the page. My intention was to use JavaScript/CSS to create a collapsible div to hold the album names and years for each selected artist within the genre search results, however the script I have to implement this is not working quite properly yet - there is a nested PHP while statement handling the SQL query and for some reason it is only displaying the albums of the first listed artist when any artist name is clicked on, so I have commented out that code until I get working. Collapsible divs are a good solution especially when the list of artists displayed is long to prevent the user from having to scroll the page as much. In further development I would also like to incorporate the YUI Library for displaying the results on the page in a more visually appealing way.

Helpful Resources

Inspiration and Ideas for Future Development