2015-06-29 09:11:17 (edited by x0 2015-06-29 09:12:50)

Okay. So lucas gave me the idea of creating a chat client, though I used a different approach.
He used the network object and IP addresses, but I don't have no damn server. So can you guess what I used?
PHP!
Okay, so The client side works fine, but I'm getting into the php code and I want a server event to be transmitted. I believe I know how to receive it, i'm storing them in a text file, like event, \r\n, event, \r\n, etc. You can thank mason for the text file procedure. Lol!
So i have a file on my host called srv.php.
And yeah, I go into it, and I tell it to assign a variable called $dat to the data value of the $_POST request, effectively trapping sent data. The script sends data, colton has connected. I log out, colton has disconnected. I look at the text file, this is the really weird part. Yes it writes, I used fopen and fwrite and such. Wanna know what the file says?
00
Every event I send, it puts a 0! What the hell is up with that, and can somebody help me with that? i can do it in bgt, i just need a way of transferring data between the client and the php servers, my get methods work fine once the files are full.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-06-30 02:20:57

Hi. Ok, if you could show me the hole php script i'd be glad to help, but it's probably with php.ini being wierd, it happened to me. Heres what mine would look like

<?php
$filename="events.txt";
$mf=fopen($filename, a) or die();
fwrite($mf, $_POST["data"]);
fclose($mf);
?>

Sending an event in bgt would look like this
url_post("server.domaintype/bla/bla/(ok you get it)/svr.php", "data=welcome to a test event!");
Keep the following 2 things in mind
1. never use get for sending events. though post is still liable to hacking, a spammer could easily write a script that could spam the heck out of all your clients.
2. Your web host could get really mad if you keep requesting the same event file too fast 2 many times, that's why php and bgt isn't always amazing, plus you will start running into complications with lag while it retrieves the new file. Hope this helps.

I am a web designer, and a game developer. If you wish see me at http://www.samtupy.com

2015-06-30 05:52:19

oh well crap, I just now realized that my web host has a connection IP limit, my ftp client threw that in my face.
but yes my code looks like that, but I get either 0 or blank. How do I configure php.ini?
I'm using an x10 server.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-07-01 09:40:09

Well with free hosting like x10, i'm not sure you actually get to mod that, or if it is necessary. I mean this in the kindest way, but hosting a chat client on free hosting while atempting to get data from a txt file loads of times, your host is gonna freak out and it probs won't work. If you want I can host the php for you and you might have better results. I bet it's just your web host. Something that could work though, use file_put contents. like this

<?php
$nd=$_POST["data"];
$cd=file_get_contents("events.txt");
file_put_contents("events.txt", $cd."\r\n".$nd);
?>

warning! This code isn't tested and could error, but it should generally show the get and put contents methods. If it doesn't work just find a tutorial online, but it should.

I am a web designer, and a game developer. If you wish see me at http://www.samtupy.com

2015-07-01 16:44:51

yeah. maybe you could host it, because x10 is a complete bitch. I found out no, you can not mod php.ini, and you can not use $_POST.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-07-01 16:47:38

I mean you should be able to use $_POST, but for some reason it won't let me access the data

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-07-01 19:38:28

Not being able to use $_POST sounds weird to me. Not being able to mod php.ini makes perfect sense though. On free hosting (or even paid shared hosting) the host cramps as many people as is physically possible on the same server in order to keep costs down. They couldn't allow any one user to make server wide configuration changes, and you probably don't have a full fledged hosting account.
To be honest, text files really aren't the way to go anyway. If you're serious about this you should really invest the time to learn SQL and put together a server side solution which uses a database and PDO.
I wouldn't use the MySQL_* functions that the many old php and sql tutorials online suggest as those make it really easy to write code with huge gaping security holes.
I too would be willing to nagociate something with you as far as some hosting goes. As long as you don't plan on using a ridiculous amount of resources I don't see it being a problem.

Official server host for vgstorm.com and developer of the Manamon 2 netplay server.
PSA: sending unsolicited PMs or emails to people you don't know asking them to buy you stuff is disrespectful. You'll just be ignored, so don't waste your time.

2015-07-02 08:09:17

Turns out it wasn't an error with not being able to access $_POST, it was a hilarious mistake I made where i used a + instead of a dot. Which made the thing throw a fit, lols. And yeah if i wanted to make a serious chat client I would use my sql, though I've never used sql before. I could just as easily convert this thing to a network oriented program like lucas's, probably using some of his code, insert credit here, and mod it and see if you had a vps. A windows one. Because the server is coded in bgt.
And I do know that if i converted this thing to network and vps, I would use wayayayayayay less resources then anything to do with php. I mean, do you know how often I'd have to ping that URL? X10 would hate me. Graah! I should either buy a vps or use somebody else's, i'd get myself a premium account and a vps but my parents are too fucking lasy to pay 15 bucks a month for a web host.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-07-02 16:37:09

Oh yeah, I forgot all about that crazy string concatenation in PHP.
What I have is a dedicated server running Linux. I think you'd have more problems with your Windows VPS approach than it'd be worth anyway. First thing's first, you'll be facing a meriad of accessibility challenges. It's not like you can just fire up Remote Desktop and use Jaws. You need a special kind of Jaws license to be able to use it in a remote desktop session and that license is pretty expensive. I don't know about the other screen readers, maybe there's one that works well with Remote Desktop. I know what I'm away and have to fix something on my grandmother's machine I have to use team viewer and fumble around with memorized keypresses in order to get a Jaws Tandum session up and running. Alas, good luck getting your host to set all that up for you. Furthermore, many servers don't have audio output anyway. Even if you did manage to get it all working I don't see how it'd be worth it. BGT just isn't the tool for a server. It would take relatively few clients to really slow it down especially on a small VM.
I'd be willing to provide you with some space, if you'd like (email or private message me).
If your folks would be able to pay something like $30 for a year I'd be perfectly happy with that. If not we can work something else out (maybe I can have you beta test for me or something).

Official server host for vgstorm.com and developer of the Manamon 2 netplay server.
PSA: sending unsolicited PMs or emails to people you don't know asking them to buy you stuff is disrespectful. You'll just be ignored, so don't waste your time.

2015-07-03 18:54:13

I'd probably beta test, 30 bucks a year don't sound that bad, but yeah. Unless it has way more than just that chat client on it, they wouldn't see a point. If I ever made a multiplayer game I'd do it.
Problem is, lucas's server was coded in bgt, and luckilly doesn't need audio output, just launch it and close it, doesn't have a single bit of audio. But, the keypresses thing is yeah, way out of the question. And they use unix servers or linux servers I think, according to what their websites host on.
I might be able to get my router set up with a ddns server, and use my comp as a host for the chat client, though then I'd have to forward ports, and the uptime would be way more than iffy. I know one guy who's got a windows server I believe, and he's also got a linux dedicated. The windows is hosted on a ddns, but at least he's got a machine for the server that's always running. It wouldn't handle teamtalk, but it should be able to handle chats, I'm not hosting ultrapower on it or something. Lol.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.