Hello,

I'm developing a small, web-based music sharing application. I used to create static HTML contents. But now, I need a dynamic site that retrieve information from databases (also write data to database). As a beginner in PHP and MySQL, I hope someone from here can help me out..

Here is the scenario:

Four kind of users; Guest, Contributor, Registered User, Administrator

GUEST - browse, search file and download certain song/movies (limited functionality)
CONTRIBUTOR - upload files (song, video clips, image) and having full access to contents
REGISTERED USER - full access to contents and features
ADMINISTRATOR - Super User (maintain the website and database)

The last three users' details are stored in database...


MEDIA FILES
each video(music clips), audio(song) and photos details are stored in a separate table. Instead of saving media files as BLOB type, I used file path to point to the exact file location in the server directories (for performance reason according to my reading & net research). What is the best way to upload a file to a predefined server directory??? I know PHP can handle this.. but is there any 3rd party software that can perform the same action (i mean something more GUI)??

CONTRIBUTOR
This user have their own page within the domain (for displaying their profile- also stored in a table). We want to provide them choices of template so that can choose and customize their page. I guess this is the big challenge. Any idea??


RATING
I also want to have 'rate-this-song' feature. I have created a table to store the rating value submitted by user and total count (plus the associated field such as filename/ID). These two values will be dynamically updated when anyone rate the song (to avoid abuse, Im making use of session variable so that a particular user can only rate a file once). What is the best way to store all these rating statistics?? should I create one table 'rating' or 3 since I have Audio, video and image?? What's the best way to implement this function??


FORUM
Another table to store all the submitted forums. This can only be accessed by registered user and admin. So far Im planning to use PHP to retrieve and write data to the database... any suggestion??

FEEDBACK
As the admin need to monitor the site based on feedback form submitted by visitors, so I have table to store the information. Is this common???

GENERAL
For easier administration...Im planning to create interface for administrator to maintain the database (add/update/delete contents).. This of course can be achieved thru PHP/HTML.. is there any other "GUI" way to do it?? perhaps cPanel??


I guess thats all for know.. Im still brushin up my PHP & mySQL.. So far I know HTML, JavaScript, VB and some other programming languages..


Thanks for helping me out... truely appreciate it!

Dani AI

Generated

Good direction so far, and sensible advice from others — is right: break the problem into small, testable steps. A practical sequence is: 1) design core tables and user/role logic, 2) implement a secure upload pipeline and file serving, 3) build browsing/search and a simple contributor page, 4) add rating and anti-abuse, 5) add forums/feedback and an admin UI.

For the database, a single normalized media table with a type column keeps things simple and avoids duplicated schema. Keep ratings in their own table so you can query and enforce one-rating-per-user cleanly; maintain aggregated columns (count, average) in the media row and update them transactionally or with a short background job to avoid contention. Example (simplified):

CREATE TABLE ratings (
  id INT AUTO_INCREMENT PRIMARY KEY,
  media_id INT NOT NULL,
  user_id INT NULL,
  value TINYINT NOT NULL,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  UNIQUE KEY media_user_unique (media_id, user_id),
  INDEX (media_id)
);

For uploads and serving: use PHP’s built-in upload handling (see move_uploaded_file) and harden every step. Validate file type and size, check real MIME/type signatures, rename files to non-guessable names, store outside the web root or protect directories, and generate/precompute thumbnails or transcodes for media. Follow OWASP guidance on file uploads to avoid arbitrary code execution.

Tools and admin tips: raw DB tools like phpMyAdmin or Adminer are useful for quick maintenance, but they are not a replacement for a controlled admin interface that enforces business rules. For a nicer upload UX, use a JavaScript uploader (chunking + progress). If time or experience is limited, consider a CMS or framework with existing admin modules to save effort.

Cautions: enforce role checks server-side, sanitize all user content, and prefer authenticated rating where possible (cookies/sessions for guests are weak). Learning PHP/MySQL incrementally, as noted, will pay off — build one feature at a time and test security and concurrency as you go.

References: PHP upload docs (https://www.php.net/manual/en/function.move-uploaded-file.php), OWASP upload risks (https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload), phpMyAdmin (https://www.phpmyadmin.net/), Dropzone uploader (https://www.dropzonejs.com/).

Recommended Answers

All 5 Replies

Are you looking for someone to write this code for you? If so, you should post this in the Job Offers forum as you won't find anyone to do this kind of work for free.

Thanks for ur reply,

Definitely, im not asking someone to write me the code.. I just want ideas and suggestion from the Experience.. Unless I have tried w/o success than I will post it on the Job offer section. Cheers~~

Sorry everyone,

What I need actually, based on my very 1st posting is sorta idea or suggestion particularly from the experienced web developer (as im quite new to PHP & MySQL). I still wanna give it a try before giving up.. by its just that i need direction!

Thanks...

I would suggest starting off small. Perhaps just implementing the browsing user that can view contents of a single table and then add to it as you gain experience and confidence.

It's always easier to break the problem up into smaller parts.

The job at hand is not what you can just get into and find slution to it my advice is that you seat down study the php and mysql very well and if you have programming knowledge you shouldnt have any problem on this issue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.