Server Script

6 views
Skip to first unread message

Youanden

unread,
Aug 1, 2010, 4:18:50 AM8/1/10
to The_Elements
Browsing around, I found a nice and small implementation of a user/
group based file manager. It has all the features we need, viz.

* Usr/Pw
* Filesize Limit
* Filetype whitelist

src: http://www.solitude.dk/filethingie/

It is generously styled, and weighs in at around 130KB on the server
as one php file.

Now, one problem I have with it is its implementation for users.

To add a new user it is necessary to great a group (preferably setting
it up with a separate directory so that no one sees someone else's
files), given all the code here:

$ft['users']['username'] = array(
'password' => 'password',
'group' => 'same_as_username'
);
$ft['groups']['same_as_username'] = array(
'DIR' => '/user_savegames/username',
);

The implementation is pretty simple but its pretty annoying to have
every user cram their details into a single file.

I tried to port the interface to a database, and have set up a working
database and registry page each with the following columns: id uname
pw email ip level isbanned
id is simply an auto-incrementing number, just for reference, email is
optional, but in case we ever want to set up a newsletter system or a
password forget feature. ip corresponds to isbanned, which can be
implemented later, and level can coincide with space available,
namely, if someone buys a pro version of the game can have more space
and other possible goodies.

Here is where it gets annoying, though I am sure we can solve this
somehow:

I went along to create something as follows for cycling through the
user database:


$numrows=mysql_numrows(mysql_query("SELECT * FROM user")); //select
all rows from user table

$i=0;

while ($i < $numrows) {

$ft['users']['mysql_result($user_array,$i)'] = array(
'password' => 'mysql_result($pw_array,$i)',
'group' => 'mysql_result($user_array,$i)'
);

$ft['groups']['mysql_result($user_array,$i)'] = array(
'DIR' => '/user_savegames/mysql_result($user_array,$i)',
);
$i+=1; //i++ same thing :*(
}

Looks like it should work, right? You get the point. If we get this
problem solved I would have no trouble creating a stylish HTML5/CSS3
based mobile design skin for the application, and then our only
remaining proviso would be how to get the txt file to save to the
removable media from the webview in the app (shouldn't be too hard).

Youanden

unread,
Aug 1, 2010, 4:17:42 AM8/1/10
to The_Elements
implemented later, and level can coinside with space available,

IDKJava Developers

unread,
Aug 1, 2010, 8:41:37 AM8/1/10
to thele...@googlegroups.com
That looks pretty nice, but we're actually almost done with programming the server from scratch.  We would prefer to do it by hand for now because it will look better on our college applications ;).  There is a chance that this will crash and burn though, and if that happens we will definitely take a look at this.  What we need more is a client interface to browse the save files that are uploaded.  Do you think you could work on that?

-Ryan

Georgiy Slobodenyuk

unread,
Aug 1, 2010, 11:24:48 AM8/1/10
to thele...@googlegroups.com
Sure, I can do it, and how's your N1?

IDKJava Developers

unread,
Aug 1, 2010, 11:31:13 AM8/1/10
to thele...@googlegroups.com

It's actually working perfectly, I just put it in a bowl of rice for a few days and it came out good as new.  =D.

Georgiy Slobodenyuk

unread,
Aug 1, 2010, 11:40:14 AM8/1/10
to thele...@googlegroups.com
Say What?

Georgiy Slobodenyuk

unread,
Aug 1, 2010, 11:41:48 AM8/1/10
to thele...@googlegroups.com
Oh lol, I forgot I asked you! For the Client interface, would you want it to be webview, or internal class/layout?

IDKJava Developers

unread,
Aug 1, 2010, 1:10:08 PM8/1/10
to thele...@googlegroups.com

A non-webview would be prefered since we are loading things and doing communication natively

Georgiy Slobodenyuk

unread,
Aug 1, 2010, 1:30:41 PM8/1/10
to thele...@googlegroups.com
Alright, so, how's it going to go. The User account is set up in a mySQL db, each user has a group, which corresponds to his directory?


Will the db host a row that specifies each file location on the server, or will you use php to write an XML file to the server that is read and parsed by the application?

The possibilities are great. 

But anyway, to begin I need to know all the features, the ones I am sure to include are as follows: 

  • Registration
  • 'My Files' activity that shows local downloaded demo's and possibly an icon which represents if it is backed up on their server
  • Modification of 'save' button in MenuBar so as to write a unique identifier for files automatically with the hit of okay, or a specific name alloted. 
What else?

IDKJava Developers

unread,
Aug 2, 2010, 8:05:18 PM8/2/10
to thele...@googlegroups.com

Ok, this is Gurtej. I'm almost done implementing the actual client networking part in the JNI code. Basically the interface to it is to call specific functions for each command, which then parse the data and make a call to the native sendcommand() function with the number of the command. The commands planned so far are 0=save, 1=load, 2=authenticate user with pass, 3=register, 4=save custom elements. Before sending, you also have to call setUserName() with a null terminated character array and setPassword() with a null terminated character array, because each command either needs to either authenticate with the user and pass (to prevent malicious packets) or sends a user and pass to register. I'll get back to you with the syntax of the specific commands once I have them down, for now put in some placeholders. As for the actual interface, we basically need some way to browse saves, download a specific save, and upload and view your own saves. This should probably be accessible from the main menu in the beginning of the app. Let me know if you need me to tell you anything else.

On Aug 1, 2010 1:30 PM, "Georgiy Slobodenyuk" <youa...@gmail.com> wrote:
> Alright, so, how's it going to go. The User account is set up in a mySQL db,
> each user has a group, which corresponds to his directory?
>
>
> Will the db host a row that specifies each file location on the server, or
> will you use php to write an XML file to the server that is read and parsed
> by the application?
>
> The possibilities are great.
>
> But anyway, to begin I need to know all the features, the ones I am sure to
> include are as follows:
>
>

> - Registration
> - 'My Files' activity that shows local downloaded demo's and possibly an


> icon which represents if it is backed up on their server

> - Modification of 'save' button in MenuBar so as to write a unique

Georgiy Slobodenyuk

unread,
Aug 3, 2010, 5:23:06 AM8/3/10
to thele...@googlegroups.com
Hey, I'm thinking about how the GUI would be more intuitive while also consuming less space. I came up with a filter control setup.

Button one toggles between uploaded, downloaded/local, and possibly both.

Second element filters between saves and custom elements... (probably will be implemented later)

Third logs out or exits back to home. 

I was thinking that eventually, it may be a nice idea to style icons (not logo) with the 2.0-type icons, like so: http://www.launcherpro.com/wp-content/uploads/2010/07/dock_counters-300x61.jpg

I think they look nice. Anyways, I sent a quick mock up cause more minds is better than one. 
SERVER_ENGAGED_V1_CTRL.png

IDKJava Developers

unread,
Aug 3, 2010, 5:33:54 PM8/3/10
to thele...@googlegroups.com
This is Ryan, 

For reference on what we are attempting to accomplish, look here http://dan-ball.jp/en/javagame/dust/.  I'm letting gurtej handle most of the server stuff though. 

-Ryan

IDKJava Developers

unread,
Aug 4, 2010, 8:54:06 AM8/4/10
to thele...@googlegroups.com
I think the filter control setup is perfect! Just let me know what other server interface functions you need me to set up, ex. fetch_uploaded() or something.

-Gurtej

IDKJava Developers

unread,
Aug 5, 2010, 5:41:19 PM8/5/10
to thele...@googlegroups.com
Ok, here's some more details: the functions will return -1 on errors, with the error message accessible through the function "char* viewerr(void)". On anything else, it will return 0, with specific functions for getting the data returned (yet to be implemented).

IDKJava Developers

unread,
Aug 5, 2010, 6:00:29 PM8/5/10
to thele...@googlegroups.com
I'm going to add more interface functions to transfer data to JNI in a bit btw.
Reply all
Reply to author
Forward
0 new messages