Barbosik / MultiOgar

An open source Ogar server implementation, written with Node.js.
Other
61 stars 44 forks source link

How to make skins users #445

Open Tyskacz opened 7 years ago

Tyskacz commented 7 years ago

I made a simple login script. I would now like to allow the user to upload his skin and the uploaded image will be to MySQL. The next time you log in will automatically be set skin

Tyskacz commented 7 years ago

refresh

Shair17 commented 7 years ago

give the script? pls

Tyskacz commented 7 years ago

if you can

F0RIS commented 7 years ago

crazy english)

segg21 commented 7 years ago

@Tyskacz You can't upload images to mysql, however you can base64 encode those images and store them in a large data type.

@Jhair2015 trust me, you probably don't even want it...

F0RIS commented 7 years ago

@LegitSoulja "You can't upload images to mysql" what about data type called "BLOB" ?) But this approach is not good, much better just store images in directory and write to mysql path for that file

segg21 commented 7 years ago

@F0RIS why even store data of image links? glob("skin/directory/*.png") returns an array of those images. You could then use ajax, to request that file in which will then list all the skins that exists in the directory.

Yes, write the path of that "image" after uploaded, or selected to the user skin him/her or it self..

segg21 commented 7 years ago

And mybad for saying that you can't store images, you can get the content of the image but why? Why store images in mysql? Kindof pointless in my opinion.

F0RIS commented 7 years ago

@LegitSoulja we don't know what exactly want @Tyskacz implement. But I can agree with you, may be he don't need database at all)

segg21 commented 7 years ago

@F0RIS people never think of efficient ways to do things. That however is not an efficient way of doing so.

F0RIS commented 7 years ago

@LegitSoulja thinking of efficient come with experience)

segg21 commented 7 years ago

"Efficiency" - Yet, why not go look for another way?. Why use php and or MySQL when you barely don't know how to use it.

F0RIS commented 7 years ago

@LegitSoulja If I will try to answer it's gonna be a long conversation))

segg21 commented 7 years ago

@F0RIS The answer is. Go and learn about something before doing so. Anyways, I'm done with this conversation. Have a nice day.

Tyskacz commented 7 years ago

Okay, keep the link to the skin in MySQL but I want the script to someone who logs on is immediately loaded skin.

I use TranslateGoogle, my language is Polish

segg21 commented 7 years ago

@Tyskacz Ok. Set it when they log in, the same way you'll save their username, and make sure you encrypt the user password. Using hash.

Adios.

chuushi commented 7 years ago

FYI, hashing is not encrypting since "encrypt" implies it can be decrypted whereas hashes cannot be converted to the original text. Please don't encrypt the password; hash it.

segg21 commented 7 years ago

@SimonOrJ You, Him. Gets the idea.

Thanks.