Re: Ini files in a webserver
You should use the Get object if you want to make your app communicate with the web server.
A good thing is that you don't have to sign the applet to use this extension. :)
Re: Ini files in a webserver
You cannot directly write files to a webserver. You will have to write some web script (php is often recommended on here) and communicate with that via the "get object".
Re: Ini files in a webserver
It would be a huuuuuuge risk of security if java applets (which run client side) could write to servers!
Re: Ini files in a webserver
Well, my issue is this. I am only allowed 2 mySQL servers on my website for now. I was hoping I could find another method to transfer variables and store them via and to my web server. If a PHP file can still store variables and strings on my webserver (I can save the PHP on my webserver, but could my game edit the contents?)
Assuming I am on track and understanding you correctly, where would I learn how to properly do this WITHOUT mySQL?
Re: Ini files in a webserver
You can use a flat file to store data but I currently I'm not able to upload an example, sorry.
I will do it as soon as possible.
Re: Ini files in a webserver
Re: Ini files in a webserver
I really want to continue with my game, but I am unable until I can find a way to save data to my server where it can be retrieved by more than one person at a time.
Re: Ini files in a webserver
You can do that with a simple PHP file:
PHP Code:
$myFile = "flatFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
if($_GET["name"]!="" && $_GET["value"]!="" && $_GET["key"]=="123456")
$stringData = $_GET["name"]."=".$_GET["value"]."\n";
fwrite($fh, $stringData);
fclose($fh);
And you can use the Get object to execute this PHP file:
Code:
http://www.yourwebsite.com/phpFile.php?name=UserName&value=100&key=123456
This will write a name and a value to the flatFile.txt file.
The "key" is only a security feature, it can be made a bit more complex.
You can now retreive the flatFile.txt with the Get object.
That's for now. Sorry, currently I don't have enough time to write more!
Good luck!
Re: Ini files in a webserver
Will people be able to edit the contents of that file without my program? I would like some way to protect it. For instance, to store passwords and such. Would the php file still work if my text document is in a protected folder that prevents ANYONE but me from writing or getting into it?
Basically, is it safe? I will use it now so I can begin. But I will try my best to learn my PHP so I can properly utilize this system.
By the way,thank you so much for your help. I have had MMF2 for 2 years, but when I first bought it, I had a very small amount of self discipline to create games (I may have had it for more than 2 years. I just know I spelled awesome wrong...).
Re: Ini files in a webserver
Unforunately, the PHP file can be executed from its URL easily, that's why we added the security key. As I know, the String Parser extension can convert a string to an md5 hash, so you can use it to make a complex key. Then, you will need to compare the key to the encoded string in the PHP file. Your PHP code will look like this:
PHP Code:
$myFile = "flatFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
if($_GET["name"]!="" && $_GET["value"]!="" && $_GET["key"]==md5("123456"))
$stringData = $_GET["name"]."=".$_GET["value"]."\n";
fwrite($fh, $stringData);
fclose($fh);
As I know, this will be safe but there are many capable people who know it better.
I hope I could help.
And I'm glad you got into programming with MMF2! :) That's a great thing.
Re: Ini files in a webserver
The only properly secure way is to have the user type in a password to check. Anything stored inside you program (like this "key") can be extracted.
Re: Ini files in a webserver
What if you stored various parts of it in variours places, like one characters in a string object, 2 in an alterable value, another in a global value, ect., then added them together with an expression? Would that be safe enough?
Re: Ini files in a webserver
To be honest, storing the string in the executable is probably reasonably safe, MMF sort-of-encrypts its data.
My point is just that if someone wants to break into the system, they will.
Re: Ini files in a webserver
Quote:
Originally Posted by Dynasoft
My point is just that if someone wants to break into the system, they will.
I agree. And I think this level of security will be enough.
Re: Ini files in a webserver
Quote:
Originally Posted by Czentnar
Unforunately, the PHP file can be executed from its URL easily, that's why we added the security key. As I know, the String Parser extension can convert a string to an md5 hash, so you can use it to make a complex key. Then, you will need to compare the key to the encoded string in the PHP file. Your PHP code will look like this:
PHP Code:
$myFile = "flatFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
if($_GET["name"]!="" && $_GET["value"]!="" && $_GET["key"]==md5("123456"))
$stringData = $_GET["name"]."=".$_GET["value"]."\n";
fwrite($fh, $stringData);
fclose($fh);
As I know, this will be safe but there are many capable people who know it better.
I hope I could help.
And I'm glad you got into programming with MMF2! :) That's a great thing.
Does Clickteam have an object that supports the $_POST function?
-Thanks, Variant
Re: Ini files in a webserver
Re: Ini files in a webserver
The Get object can do it (except in Java, because the Java update hasn't been released yet..)
Re: Ini files in a webserver
Jamie, you just completely killed all my hopes and dreams... that was my original plan. :/
As far as storing passwords in the file, I don't intend to. I was going to have them type in their username and password, and have the PHP file check the Data.txt on my server to see if they match.
As far as Czentnar 's post. Dude, you are awesome. I will have to look into it because that last post was Greek to me. XD
Re: Ini files in a webserver
Sorry - I'll upload the Java version as soon as possible. I'm just a bit snowed under right now..
Re: Ini files in a webserver
Uhm, one thing I don't understand -- can you re-use an old server and give it new tables? That's what I'm doing. I share some SQL servers that have different functions (eg "updaters" holds both updater tables and log-in tables)
Re: Ini files in a webserver
Quote:
Originally Posted by Ausomeman
I was going to have them type in their username and password, and have the PHP file check the Data.txt on my server to see if they match.
You REALLY should use a MySQL database for this.
Text files technically "work," but if you have multiple users accessing the server simultaneously, you could run into file locking issues (someone changes their password at the exact same time someone else logs in, etc), which could corrupt your file, or at the very least, error out.
Also, you don't want anyone to just point a web browser at your data.txt file, then your entire password list is exposed.