Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-07-2009, 10:20 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
uploadfile()

Should also be allowed to work specifically for the directory uploads/*.
This will allow servers to script their own in-game upload system and make everything more streamlined for players AND staff who have to handle uploads.

Can only allow it to support image/gani/levels and the other important extensions, though staff can script this if needed. Also, an upload log wouldn't be that bad of an idea, but again, the staff can script that as well.
Reply With Quote
  #2  
Old 06-07-2009, 10:34 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
This is already possible for personaluploads folders, do this clientside:
PHP Code:
requesttext("folder""PERSONAL");
this.filename selectFileforUpload(); 
Then you can move the file somewhere more useful on the serverside using movefile() since they will not be server-accessible from the personaluploads folder.
__________________
Skyld
Reply With Quote
  #3  
Old 06-07-2009, 10:51 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Hmm, didn't think of that. Thanks
Reply With Quote
  #4  
Old 06-07-2009, 11:08 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
It's also worth noting the onFileUploaded() function which should be called clientside once the upload has completed. At least, I think that's what it's called.
__________________
Skyld
Reply With Quote
  #5  
Old 06-07-2009, 11:11 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
It's something like that... however the whole thing of uploading is a bit misty for me. I have no idea what I'm doing and I also don't have the rights needed to do something like this on Testbed so it will probably have to wait.
Reply With Quote
  #6  
Old 06-07-2009, 11:15 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Basically when you send the requesttext for the PERSONAL folder, you are effectively doing a "change directory" to the player's personaluploads folder. This is the one directory that can be read and written to without being authorised with Client-RC. They are sorted by account name, for example, personaluploads/Sk/Skyld/. You then call the selectfileforupload() function and a dialog box appears asking the user to select a file. The file is automatically dropped into the player's personaluploads folder and the onFileUploaded() event is called. You can then movefile() the file somewhere.

It's pretty straight-forward.
__________________
Skyld
Reply With Quote
  #7  
Old 06-07-2009, 11:18 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Ah okay
I was going to make a custom gui with candropfiles(whatever it is...) along with uploadfile() and such.
Reply With Quote
  #8  
Old 06-08-2009, 05:04 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I thought about making a system like this, and had a working script upload an image from the scriptfiles folder. But instead I took a different route:

Zodiac's system for uploading lets the player upload it to my webserver:

http://uploads.zodiacdev.com

I then have an DB-NPC check every 5 minutes for new graphics, or an Uploader can force a check. You can then use requesturl to get each file, and put it in the proper upload folder. After confirming it's been successfully uploaded on the server, it then deletes it off the webserver.

The benefits of using a webserver allows you to offload some work on the npcserver, provide a neat webform, as well as the ability to have the webserver set transparencies for you.
__________________
Quote:
Reply With Quote
  #9  
Old 06-08-2009, 01:47 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
The advantages of using uploadfile() is that you don't need to mess about with requesturl() (or an external webserver at all) to check for updates; having a task ran every 5 minutes even when nobody is uploading is more processor-intensive than just handling the uploads when they come. The iPhone games are all using uploadfile() to allow people to upload their in-game display pictures and it works pretty well. I would promote it's use over an external webserver anytime.
__________________
Skyld
Reply With Quote
  #10  
Old 06-08-2009, 09:23 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Skyld View Post
The advantages of using uploadfile() is that you don't need to mess about with requesturl() (or an external webserver at all) to check for updates; having a task ran every 5 minutes even when nobody is uploading is more processor-intensive than just handling the uploads when they come. The iPhone games are all using uploadfile() to allow people to upload their in-game display pictures and it works pretty well. I would promote it's use over an external webserver anytime.
Can you explain how you would limit the files they can upload? I'm not too keen on players uploading .exe files, for example.
__________________
Reply With Quote
  #11  
Old 07-20-2009, 12:25 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by cbk1994 View Post
Can you explain how you would limit the files they can upload? I'm not too keen on players uploading .exe files, for example.
__________________
Reply With Quote
  #12  
Old 07-20-2009, 05:42 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by cbk1994 View Post
Can you explain how you would limit the files they can upload? I'm not too keen on players uploading .exe files, for example.
Well you just process the files once they have been uploaded and discard them using some sort of script if they are not suitable.

PHP doesn't do that any differently. It has to receive the entire file before it can determine it's type and discard it.
__________________
Skyld
Reply With Quote
  #13  
Old 07-20-2009, 04:38 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Don't forget how you would prevent them from uploading ridiculously large files, and other invalid file types.
__________________
Quote:
Reply With Quote
  #14  
Old 07-24-2009, 10:37 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
onFileUploaded() never seems to get called. I've also tried onFilesUploaded(), which is the event listed in this topic.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #15  
Old 07-24-2009, 11:27 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by cbk1994 View Post
Can you explain how you would limit the files they can upload? I'm not too keen on players uploading .exe files, for example.
PHP Code:
temp.allowed = {"graal","nw","gani","png","gif","mng"}; //still don't get mng :\
temp.fileName.tokenize(".");
if (!(
t[fileName.size()-1in allowed)) {
  
//stuff code stuff

Pretty sure that could be used, just replace fileName with whatever you're using to get the file name. Not 100% on that since I don't know if it's possible to check the name.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.

Last edited by Switch; 07-24-2009 at 11:39 PM..
Reply With Quote
  #16  
Old 07-24-2009, 11:47 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Switch View Post
PHP Code:
temp.allowed = {"graal","nw","gani","png","gif","mng"}; //still don't get mng :\
temp.fileName.tokenize(".");
if (!(
t[fileName.size()-1in allowed)) {
  
//stuff code stuff

Pretty sure that could be used, just replace fileName with whatever you're using to get the file name. Not 100% on that since I don't know if it's possible to check the name.
Checking file extensions won't prevent malicious users from uploading executable files. You need to check file headers. Essentially, you would use loadlines() to load the first line of the file, and you would check if the file header is located within that. (For instance, GIF files always start with "GIF8").

In the end, though, there's nothing you can do if somebody really wants to upload malicious files. Even checking headers doesn't do much, since the person can simply edit the file header. Hopefully getting an error, even after they've changed extensions, would just make them give up.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #17  
Old 07-24-2009, 11:50 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by LoneAngelIbesu View Post
Checking file extensions won't prevent malicious users from uploading executable files. You need to check file headers. Essentially, you would use loadlines() to load the first line of the file, and you would check if the file header is located within that. (For instance, GIF files always start with "GIF8").

In the end, though, there's nothing you can do if somebody really wants to upload malicious files. Even checking headers doesn't do much, since the person can simply edit the file header. Hopefully getting an error, even after they've changed extensions, would just make them give up.
Oh, well that I didn't know, thanks I'll rep tomorrow.
But honestly, what normal player is smart enough to know that?
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #18  
Old 07-24-2009, 11:53 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Switch View Post
Oh, well that I didn't know, thanks I'll rep tomorrow.
But honestly, what normal player is smart enough to know that?
True, but what normal player would upload an executable in the first place?

Anyways, has anyone gotten onFilesUploaded() to work? Or am I the exception?
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #19  
Old 07-25-2009, 08:47 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by LoneAngelIbesu View Post
onFileUploaded() never seems to get called. I've also tried onFilesUploaded(), which is the event listed in this topic.
Just bumping this. Skyld tried to give me a work-around using this code --
PHP Code:
function onFolderLog(temp.text)
{
  if (
temp.text.starts("Uploaded file ") ||
      
temp.text.starts("Uploaded big file "))
  {
    ....
  }

-- but that doesn't work, either. I've tried onFilesUploaded() and onFolderLog() both client-side and server-side.

I'm guessing these events are protected.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #20  
Old 07-25-2009, 08:48 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
it's onFilesUploaded() yes (on clientside).
On serverside then use temp.folder.getfolder(player.getPersonalUploadFold er(), 0) to check what files have been uploaded.
May be we could also add a special event on server-side to directly know which file has been uploaded and from which user.
Reply With Quote
  #21  
Old 07-25-2009, 09:09 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Stefan View Post
May be we could also add a special event on server-side to directly know which file has been uploaded and from which user.
That would be incredibly useful.

Another thing I noticed is that deletefile() does not work with the personaluploads folder.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan

Last edited by LoneAngelIbesu; 07-25-2009 at 10:04 PM..
Reply With Quote
  #22  
Old 07-25-2009, 11:53 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by LoneAngelIbesu View Post
That would be incredibly useful.

Another thing I noticed is that deletefile() does not work with the personaluploads folder.
Has the npcserver write rights to the folder?
Reply With Quote
  #23  
Old 07-26-2009, 12:01 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Stefan View Post
Has the npcserver write rights to the folder?
That would be the problem. It works fine, now.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.