Game Maker's Garage Forum

Game Maker's Garage => Suggestions => Topic started by: Gan on July 15, 2011, 06:30:05 PM

Title: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 15, 2011, 06:30:05 PM
I've been studying and learning PHP and MySQL at work from a professional programmer and just realized, we could make something to replace that crappy flash thing at the top of the page.

Using JavaScript and HTML a nice simple and plain chat box could be made. Just a textbox that displays the chat text and an input text box below with a Send button for chatting.
Then using PHP I can have it access the SQL database, keep chats in a table that can be nicely retrieved to fill the chat box and also insert data so the chat stuff can happen.

That's the easy part. The possibly harder part would be trying to figure out how to make it grab your username so anything you say would be under your name.

Whaddya think?

Note: If I request a GMG hosting page, will that give me SQL abilities and a PHP server to make a test chat box?
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Zoo on July 15, 2011, 09:58:59 PM
Go for it. I hate that box. Not only does it post a stupid message every time you reload the page, therefor making it almost impossible to chat, it doesn't work on my other computer or the iPad. It's extremely slow, also. Plus it'd be awesome to have a chatbox made by Gan. As for testing, you might be able to do it at that w3school's "Try it editor"
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 16, 2011, 01:42:02 AM
http://www.youtube.com/watch?v=qe1uhgT5AzM

Made a PHP/SQL chat box.
If I had access to the GMG's inner workings I could get this set up I think reasonably fast. Just replace the monster at the top of the page with my box, hook up the forum username to the chat box, create the chat database, tweak the code a little and bam. All should work.

Then once it's working I could take suggestions to make it better. Smilies, different fonts, a universal time stamp so people in different countries don't have the chat box times screwed up....

Oh yeah, here's the code if you want to look:
http://www.mediafire.com/?37i8b0m9zcj9zwh

Of course it won't work unless you have an sql database set up and a php server running.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Zoo on July 16, 2011, 11:16:06 AM
I say that it would work the way it is, but if you can add smileys a few simple ones would be alright. Looks awesome by the way.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 16, 2011, 12:43:15 PM
I'll look into adding smilies. Right now though I'm trying to get into contact with Silver. I believe he has the power.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Zoo on July 16, 2011, 03:59:02 PM
I'll find his email. If indeed he no longer checks the forums, you can email him via Roguesoft message board
http://z11.invisionfree.com/Roguesoft/index.php?act=Mail&CODE=00&MID=1
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 16, 2011, 04:17:44 PM
I wrote it on his wall. He'll notice it eventually.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Silverwind on July 16, 2011, 05:49:25 PM
I'm up for replacing a block of code with another provided you know what you're doing. I'm not sure how the Flash one is setup though; it may be referenced in multiple files, and the site is a mess to wade through.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 16, 2011, 05:56:12 PM
Yeah I can give you a block of code. Though we'll need to set up another database to hold the chat log in the site's MySQL.
It really would be easier if I could do it myself...
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 16, 2011, 06:18:25 PM
http://database.comli.com/Chat.html

I found free hosting for the database. So Silver, you can literally just plug code in.

I gotta tweak things a bit. I don't think we'll be able to automatically grab the username yet.


Hey Silver, I'll make it really easy for you. I'm going to edit my php code a bit then post some iframe code so you just need to replace the Meebo thing with the iframe code. Then I'll be able to update the chat box freely without any Gmg editing needing to be done.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 16, 2011, 09:07:17 PM
Hey Silver, it's ready to be inserted!

Code: [Select]
<html>
<head></head>
<body>
<iframe src="http://database.comli.com/Chat.html" width="100%" height="100%">
  <p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
You can change the width/height appropriately. I'd suggest using a percentage of some sort. I can always resize the page on my end to fit better.

Here's the chat if you want to try it:
http://database.comli.com/Chat.html
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Silverwind on July 17, 2011, 04:12:41 AM
Absolutely beautiful piece of achievement there Gan! So easy to implement, so easy to edit, so easy to use. A fulfilling accomplishment to be sure! :D
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Zoo on July 17, 2011, 08:07:45 AM
Yeah,  but it doesn't work yet.
Title: Re: Custom PHP/JavaScript Chat Box?
Post by: Gan on July 17, 2011, 09:00:53 AM
Hey Silver, if you wanted to get rid of the border it'd probably look quite a bit better.

Code: [Select]
frameborder="0"

EDIT: Also
Code: [Select]
scrolling="no"
This'll give me a little more room.