Jump to content


Photo

File IO


  • Please log in to reply
18 replies to this topic

#1 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 14 December 2011 - 10:59 PM

Hey guys, I don't write the best tutorials... So i just thought I'd share the source files with you.

These files allow you to read and write to files on your web server via PHP. The idea being that if you don't want to use MySQL you can use these to read/write data to files - then reload the data for use in the future. The applications are endless.

In the example provided - you press 'R' to read a file, and 'W' to write to a file. It can return errors too.

Included are all the files you need - the GM:HTML5 files and the PHP files - Feel free to use them ^_^.

Download Here
  • 3

#2 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 16 December 2011 - 01:38 PM

70 views and no comments, anyone find this useful?
  • 0

#3 Solvius

Solvius

    GMC Member

  • GMC Member
  • 190 posts

Posted 18 December 2011 - 01:18 AM

Well i downloaded it now, and will take a long look before I let you know :)

Edit 1

I opend the page and after pressing w it opens a textbox. After filling in a name it asked me something about data or so?

After that it shows a bunch of code... and then the only option is to close the page.

So, how usefull is that?

No explaining. No tutorial. No nothing...

What can i do with it, what does it do, and more importantly, where does it do something?

Greets

Edited by Solvius, 18 December 2011 - 01:25 AM.

  • 0

#4 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 18 December 2011 - 01:38 AM

When you press 'W'. it asks for the file name, then the data to write to the file.

When you press 'R', it reads the data from the file name you give it.

How hard is that O-o.

Edit: I'll write a proper tutorial at some point. No need to flame - i did explain.

EDIT 2: You may need to set the read-write permissions on your web server.

Edited by iSeiren, 18 December 2011 - 01:40 AM.

  • 0

#5 Solvius

Solvius

    GMC Member

  • GMC Member
  • 190 posts

Posted 18 December 2011 - 04:05 PM

When you press 'W'. it asks for the file name, then the data to write to the file.

When you press 'R', it reads the data from the file name you give it.

How hard is that O-o.

Edit: I'll write a proper tutorial at some point. No need to flame - i did explain.

EDIT 2: You may need to set the read-write permissions on your web server.


When it asks for the file name it would need a file name, or is it creating one?
If it needs a file name, how do i get that on my server when nobody has played yet?
Or do you mean that when somebody logs in to the game, types his name that then a file would be created?
How do i do that? if thats the meaning.

What is that data he is asking for?

Greets
  • 0

#6 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 18 December 2011 - 06:11 PM


When you press 'W'. it asks for the file name, then the data to write to the file.

When you press 'R', it reads the data from the file name you give it.

How hard is that O-o.

Edit: I'll write a proper tutorial at some point. No need to flame - i did explain.

EDIT 2: You may need to set the read-write permissions on your web server.


When it asks for the file name it would need a file name, or is it creating one?
If it needs a file name, how do i get that on my server when nobody has played yet?
Or do you mean that when somebody logs in to the game, types his name that then a file would be created?
How do i do that? if thats the meaning.

What is that data he is asking for?

Greets


If you dont understand how to adapt an extension to your needs, i dont think you should be messing around with it.

The file name can be a file that exists or a file that doesnt. If it doesnt exist then it creates it.

But as i said, if you cant adapt it to your needs then dont bother trying to use it : /.
  • 0

#7 Solvius

Solvius

    GMC Member

  • GMC Member
  • 190 posts

Posted 18 December 2011 - 08:17 PM

ok, thats also a way.

little edit

70 views with no comments.

say's enough, huh...

Edited by Solvius, 18 December 2011 - 08:18 PM.

  • 0

#8 Lavender

Lavender

    GMC Member

  • GMC Member
  • 233 posts
  • Version:GM:Studio

Posted 27 December 2011 - 06:47 PM

ok, thats also a way.

little edit

70 views with no comments.

say's enough, huh...


I actually found this really useful... it's quite obvious what it does if you actually look through the code!

Are there any drawbacks of using this method as opposed to using MySQL when it comes to storing one set of data that does not need MySQL functionality?
  • 0

#9 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 27 December 2011 - 06:55 PM


ok, thats also a way.

little edit

70 views with no comments.

say's enough, huh...


I actually found this really useful... it's quite obvious what it does if you actually look through the code!

Are there any drawbacks of using this method as opposed to using MySQL when it comes to storing one set of data that does not need MySQL functionality?


The advantages of SQL are that it's more organised and more secure. Disadvantage: more complex.

If you dont need security as such, this is just as good.

It literally just replaces the file_text functions in the regular game maker. I've been meaning to add more features - like file_exists etc... would make it much much more useful.

Edited by iSeiren, 27 December 2011 - 06:57 PM.

  • 0

#10 Artaex Media

Artaex Media

    Artaex Media

  • GMC Member
  • 1531 posts
  • Version:Unknown

Posted 02 January 2012 - 09:43 PM

You're making 1 big mistake.
You're passing a large string using GET.

If you do that, make sure you escape (JavaScript) the string and urldecode (PHP)

And you should add stuff like file_exists to your read function.
Echoing "can't open file" means invalid permissions OR file not found.
Also, error_reporting should be 0

Oh btw, anyone can create a massive amount of files on the server.
Post an example and I'll hack it.

Edited by Artaex Media, 02 January 2012 - 09:45 PM.

  • 0

#11 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 03 January 2012 - 12:20 AM

You're making 1 big mistake.
You're passing a large string using GET.

If you do that, make sure you escape (JavaScript) the string and urldecode (PHP)

And you should add stuff like file_exists to your read function.
Echoing "can't open file" means invalid permissions OR file not found.
Also, error_reporting should be 0

Oh btw, anyone can create a massive amount of files on the server.
Post an example and I'll hack it.



It's the basis for someone to develop their own system. This is to just show people how to do it. I found that if you use .HTACCESS to limit users access to the folder with scripts and files in - the game can still access them while others cant. Making it impossible to mass create files.

This has all been tested.

As for file_exists etc... i have a version with more features but i've been too busy to upload.
  • 0

#12 rmedtx

rmedtx

    GMC Member

  • GMC Member
  • 42 posts
  • Version:GM:Studio

Posted 20 February 2012 - 04:52 PM

Hey guys, I don't write the best tutorials... So i just thought I'd share the source files with you.

These files allow you to read and write to files on your web server via PHP. The idea being that if you don't want to use MySQL you can use these to read/write data to files - then reload the data for use in the future. The applications are endless.

In the example provided - you press 'R' to read a file, and 'W' to write to a file. It can return errors too.

Included are all the files you need - the GM:HTML5 files and the PHP files - Feel free to use them ^_^.

Download Here



This expansion sounds very useful. I will definitely give it a try and give you feedback.
  • 0

#13 Liam Jacobs

Liam Jacobs

    GMC Member

  • New Member
  • 16 posts
  • Version:GM:HTML5

Posted 14 March 2012 - 07:31 AM

<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found </h1></center>
<hr><center>nginx/1.0.4</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->


Is spits that out at me when I try to read or write.



EDIT:
I managed to stop the error by copying the fileio.php file, but it doesn't return anything when it reads.

Edited by Liam Jacobs, 14 March 2012 - 07:36 AM.

  • 0

#14 iSeiren

iSeiren

    www.worrall.pw

  • GMC Member
  • 610 posts
  • Version:GM:Studio

Posted 14 March 2012 - 01:46 PM

<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found </h1></center>
<hr><center>nginx/1.0.4</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->


Is spits that out at me when I try to read or write.



EDIT:
I managed to stop the error by copying the fileio.php file, but it doesn't return anything when it reads.


Could be any number of things. Most common are Read/Write permissions or Correct file names :).
  • 0

#15 waxbulletgames

waxbulletgames

    GMC Member

  • New Member
  • 25 posts

Posted 17 June 2012 - 02:20 PM



ok, thats also a way.

little edit

70 views with no comments.

say's enough, huh...


I actually found this really useful... it's quite obvious what it does if you actually look through the code!

Are there any drawbacks of using this method as opposed to using MySQL when it comes to storing one set of data that does not need MySQL functionality?


The advantages of SQL are that it's more organised and more secure. Disadvantage: more complex.

If you dont need security as such, this is just as good.

It literally just replaces the file_text functions in the regular game maker. I've been meaning to add more features - like file_exists etc... would make it much much more useful.


File_exists already works. although it ONLY works with the file is in html5game are a subfolder of that one. (because the primary function (javascript)is in that directory like an exe)
  • 0

#16 ben0

ben0

    GMC Member

  • New Member
  • 24 posts
  • Version:GM:HTML5

Posted 10 August 2012 - 05:08 AM

thx for the extension!
  • 0

#17 ThePC007

ThePC007

    Chickenator

  • GMC Member
  • 612 posts
  • Version:GM:Studio

Posted 29 September 2013 - 05:28 PM

I downloaded it and checked out the example. I pressed W and wrote "chicken" as the file name and "chicken_data" as the data. When I pressed R and typed in "chicken" nothing happened. 


  • 0

#18 ThePC007

ThePC007

    Chickenator

  • GMC Member
  • 612 posts
  • Version:GM:Studio

Posted 29 September 2013 - 05:29 PM

thx for the extension!

 

So you are the founder of MarketJS? I took a look at it a while ago and it appears that there aren't too many active people. Is that right or does it only seem that way? 


  • 0

#19 Kisatom

Kisatom

    GMC Member

  • New Member
  • 2 posts
  • Version:GM6

Posted 26 February 2014 - 08:31 PM

Thank you very much for this extension! It's exactly what I needed!
It works! :woot:


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users