Question on user database/uploading shit
#1733
So i got a website i gotta build, and i absolutely do not want to use wordpress. (but will if im forced to)
I want to be able to make a login/registration and create a user base where users can send a song of their own to be mixed and configured by a music dj guy and once he's done, he will send a sample to people with a free account, and people with paid accounts get a fully optimized and mixed song.

I have limited skills in PHP, js, but i know SQL. I have a large database in access ive implemented stuff like this, but the access program i made years ago is from access 97...
Im thinking this will require an entirely new DB system and programming.

Any ideas or where i should start?
killer
#1743
Assuming you're already familiar with the logic for registration and logging on of users, what you're trying to do is simple. I will assume in this post that you already have a table in your new database that will store users. Because their account type is relevant to how the pages are served, you will need to store this in the user table as well.

Much like other actions in PHP, the submission of files by the user is done using an input element in a form. Particularly, it is the 'file' input type. You can read about this here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

Keep in mind that, in addition to this, you must also set an additional attribute on the form tag so that the browser is flagged to handle sending large amounts of binary data over HTTP. This attribute, enctype, must be set to multipart/form-data. You can read about this here:
https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2

When the user submits this form, the file is transmitted via an HTTP request to your web server along with all the other form data. PHP does you the favor of storing this file in a temporary location so you may process it in your PHP script. More information about this process can be found here:
https://php.net/manual/en/features.file-upload.php

Additionally, before moving the file to its permanent location on your server, you will want to check its mime type to assure that you are only receiving audio files.
https://php.net/manual/en/function.finfo-open.php
https://php.net/manual/en/function.finfo-file.php
You need to be extremely careful and assure that you're checking everything uploaded as thoroughly as possible. When you give users the ability to upload content to your website, you're giving them the potential ability to get inside of the box you're hosting your website in if they're able to execute a PHP script due to your negligence. Read into this step more than any of the other ones, as doing this wrong could really fuck your day up. One of the biggest tips is making sure you prohibit the uploading of any file extensions that can be taken up by your web server as PHP scripts, which can be done by doing mime type checks as well as an extension check.

Once you are certain it's an audio file, or at the very least, nothing that can fuck your shit up, move it to its permanent location using move_uploaded_file() as outlined in a prior link. Store all uploads in another database table containing the name/path to the file on your server along with the user that uploaded it. You may also want to store info about whether or not it's been processed or being processed by the dj dude.

Once you get this system working, the rest is very typical to what I'm sure you've already done in PHP. You'll be fetching lists from the database, writing its contents to the users depending on their account types, and linking in audio files according to their paths in the submissions table.

Hopefully this should be enough to get you started. If you have further questions, just post them in this thread.
//i.fii.moe/EEtDbYEICrUbLOFjkwKVQ7OUJWJR-ejl
#1783
thank you so much malloc, i havent ever done a userbase, so this will be pretty interesting.
killer
#1792
just like my username suggests, i am a noob. I am not the best in doing PHP and do not have my own server. Am using hosting from namecheap. What would be a good way to just get started? What kind of forms and how would i implement these into my site? sorry im such a noob at this, its a whole different level but id love to learn
killer
#1793
If you ever need a better server, I use the cheapest tier vps on ovh and I super recommend it. Its like $3.50 a month and you get 2gb of ram
https://vertesine.com/0x3F/sig.png
Disable ipv6 and become one with the ipv4 singularity
#1802
Yeah, I might need to set up my own server? I have a desktop server from ages ago i set up once, but havent used it in a while.

I also need to know, is this something i can even do on a website like namecheap with cpanel? Honestly, ive done very limited in this area of websites, Im quick to learn though, and i have a few months to do this.
killer
#1803
yeah, an ovh vps is relatively easy to set up for nginx+php+some sql db. You ssh into it and control it like a normal linux machine/whatever OS you choose to throw on it in the management page. You get full control over it so you can host anything that accepts connections on any port you want
https://vertesine.com/0x3F/sig.png
Disable ipv6 and become one with the ipv4 singularity
#1809
I like the Idea of the OVH, just not sure where to start as far as the website and forms go... sorry if i need my hand held through this, my first one and wanna make it go well
killer
#2191
Scratch all that, figured it all out and knocked it out! was easier than i thought! Still need to get down php though.

For the first time ever, i really felt like i knew exactly what i was doing LOL
killer
#2194
feels good don't it
//i.fii.moe/EEtDbYEICrUbLOFjkwKVQ7OUJWJR-ejl