VLE - How to store content?

Hey guys,

I need to store content files on the server somehow as on my website teachers add content through: a blog style layout and can add files for students to view etc. Students can only view the the content of the teachers whose subject they’ve registered to.

I cant get my head around how to go about achieving this… can someone please assist me?

you can store it in a database

store the content files in the db? but how? like i have a users table, subject table, school and teachers table… if the user clicks maths for eg they need to maths page where content is displayed and can be edited from front end…

sorry i took so long i work crazy hours

yes you can store files in a database but
what i meant was store the files on the server in a folder and use the database to tell the webserver where the files are as the are needed

using the blob field in MySQL you can store files in the database as well however this could/does make queries slower.

how about your script saves the page to your server and then the link that the student clicks to be a script that is run to check if they have privileges to read the file and if so include the file.

that way if you store the location of the page rather then the actual content it speeds up the query.

or maybe get the server to create an upload file per teacher. then specify permissions when they sign up as to which folder they can access (not actual permission, i mean in the form of x teacher, a teacher)

cabalsdemon’s approach gets my vote. Andrew is absolutely right that you could store the entire file in a blob, but as he said, it will hurt performance.

If you choose to implement cabalsdemon’s approach, make sure to store the files outside of the web path (you don’t want people to be able to access them by just typing their location into the url bar. In most cases, this means that they need to be located before (or at the same hierarchy) as your public_html directory (not inside it!).

You would then create a page that verifies that the user should have access to the file and gets the location from the appropriate table. Depending on the type of file, it would then proceed to get the file and display it.

If you aren’t talking about a huge number of files or massive filesizes, using the blob field that Andrew referenced may be a feasible alternative. I would create a separate table just for the files and create a basic id column that has a primary key and is auto-incremented. You would then need to build an additional table that manages your permissions for each file by id. Depending on your implementation, this option may be more secure.

Sponsor our Newsletter | Privacy Policy | Terms of Service