SQLChat - Live MySQL server feed & chat box [Updated] -
Sinner - 10.09.2013
Mirror & preview has been updated.
SQLChat
Live server feed & chatbox
Introduction
This website-filterscript will allow you to chat with people/see what people say in your server, and people in your server will be able to chat with you. SQLChat consists of a filterscript that sends and receives chat messages from the website & server, and a few PHP files (website) that do the same. SQLChat uses Asynchronous Javascript (AJAX) to reload the page so there is no lag. The server uses threaded queries so there should be no in-game lag either.
It is a very simple prove-of-concept and should not be used in a production environment due to it's insecurity.
If you want to use this for your server, look at the code and implement the necessarily checks and validations.
Installation
- Download SQLChat_Server.rar
- Unzip SQLChat_Server.rar to your server directory
- Download SQLChat_Website.rar
- Unzip SQLChat_Website.rar to your website directory
- In your server directory, go to sqlchat.pwn and change the MySQL details (SQL_HOST, SQL_USER, etc...)
- In your website directory, go to database.php and change your MySQL details (SQL_HOST, SQL_USER, etc...)
- In your server directory, add "sqlchat" to the "filterscripts" line
- Start the server, the database will create automatically
Screenshots
- Type in the name you would like to use to chat with
- Type in a message you want to send to the server, and click "Send"
- People on the server will be able to see your message
- Type something on the server, people on the website will be able to see what you said
Download & Preview
You may download the website + server from this mirror:
dl.sdec.eu/?file=sqlchat.rar
You may preview the chatbox here:
dev.sdec.eu/sqlchat
Credits
Sinner - Website + filterscript
You are free to modify anything but please do not remove the credits from the files.
Re: SQLChat - Live MySQL server feed & chat box -
Black Wolf - 10.09.2013
Awesome Bro this is something great!
Re: SQLChat - Live MySQL server feed & chat box -
[HK]Ryder[AN] - 10.09.2013
Awesome,
+rep
Re: SQLChat - Live MySQL server feed & chat box -
iZN - 10.09.2013
Nice, I've seen this in some servers.
EDIT: I was wondering if there could be some spam control, because anyone could flood the chat easily.
Re: SQLChat - Live MySQL server feed & chat box -
Sinner - 10.09.2013
Quote:
Originally Posted by iZN
Nice, I've seen this in some servers.
EDIT: I was wondering if there could be some spam control, because anyone could flood the chat easily.
|
Ofcourse. As I stated this is a very simple implementation but if you want you can make an anti-spam measure both on the server and website-side. (Maybe only allow someone to send a message every X seconds). I may develop this tool some more in the future.
Re: SQLChat - Live MySQL server feed & chat box -
XtremeR - 11.09.2013
Nice work, +3
Re: SQLChat - Live MySQL server feed & chat box -
JeaSon - 12.09.2013
Awesome Work <3 +rep
Re: SQLChat - Live MySQL server feed & chat box -
QuaTTrO - 12.09.2013
Is there a way to kick website chat users?
Re: SQLChat - Live MySQL server feed & chat box -
Sinner - 15.09.2013
Update mirror & added a preview.
Quote:
Originally Posted by QuaTTrO
Is there a way to kick website chat users?
|
No, this does not have an account system built-in. If you make your own account/user system around it, you may disable access to sqlchat for users or possibly other stuff (ban/kick/mute/...).
Re: SQLChat - Live MySQL server feed & chat box -
DanishHaq - 15.09.2013
Great idea. Looks nice too.
Re: SQLChat - Live MySQL server feed & chat box -
mineralo - 17.09.2013
its good, but you've some mistakes, first of all you should resave all PHP files in UTF-8 (WITHOUT BOM)
second, do you tested it on crashing mysql by spamming?
Re: SQLChat - Live MySQL server feed & chat box -
nGen.SoNNy - 18.09.2013
Can't make it run. I can send a message but on the website i can't see it in the chat table. I run MySQL 5.6.12 with EasyPHP.
Re: SQLChat - Live MySQL server feed & chat box -
Sinner - 18.09.2013
Quote:
Originally Posted by nGen.SoNNy
Can't make it run. I can send a message but on the website i can't see it in the chat table. I run MySQL 5.6.12 with EasyPHP.
|
Are the tables created?
Does the record show up the in table?
Does your browser support/allow Javascript?
Re: SQLChat - Live MySQL server feed & chat box -
nGen.SoNNy - 18.09.2013
I tried on Firefox and Chrome and nothing
When i type the message on website i can see it on the server but it doesn't create on the website.
EDIT: If you can tell me what program should i use ... i tried just on EasyPHP.
Respuesta: SQLChat - Live MySQL server feed & chat box -
adrianxd - 18.09.2013
nice + rep
Re: SQLChat - Live MySQL server feed & chat box -
Sinner - 18.09.2013
Quote:
Originally Posted by nGen.SoNNy
I tried on Firefox and Chrome and nothing When i type the message on website i can see it on the server but it doesn't create on the website.
EDIT: If you can tell me what program should i use ... i tried just on EasyPHP.
|
EasyPHP should work fine I recon. Try opening the Debugging console (CTRL + Shift + J in Chrome) and tell me if it gets any errors.
Re: SQLChat - Live MySQL server feed & chat box -
SchurmanCQC - 18.09.2013
Using SQL and checking constantly (constantly querying!) is very inefficient and a bad idea overall.
I suggest using sockets.
http://php.net/manual/en/book.sockets.php
EDIT: Also, the preview has header warnings. It makes your code really look bad...
Another thing, I know the size of the code is small, but if you can organize things that are used in a lot of places into classes, things would be a lot more organised.
PHP код:
/*
bool SQLClass ( string conIP, string conUser, string conPass, string conDatabase )
This function initialises the SQL connection.
*/
class SQLClass {
function SQLClass($conIP, $conUser, $conPass, $conDatabase) {
...
return true;
}
}
Re: SQLChat - Live MySQL server feed & chat box -
Sinner - 18.09.2013
Quote:
Originally Posted by SchurmanCQC
Using SQL and checking constantly (constantly querying!) is very inefficient and a bad idea overall.
I suggest using sockets.
http://php.net/manual/en/book.sockets.php
EDIT: Also, the preview has header warnings. It makes your code really look bad...
Another thing, I know the size of the code is small, but if you can organize things that are used in a lot of places into classes, things would be a lot more organised.
PHP код:
/*
bool SQLClass ( string conIP, string conUser, string conPass, string conDatabase )
This function initialises the SQL connection.
*/
class SQLClass {
function SQLClass($conIP, $conUser, $conPass, $conDatabase) {
...
return true;
}
}
|
I'm aware that querying a database isn't the optimal solution but this is just a prove of concept -- though this isn't that much slower than sockets especially if someone where to use MySQLi or ODBC with a persistent connection + with push (rather than poll which it uses at the moment) you would not experience any redundant queries. This is especially a good solution if your webserver has sockets disabled (which I understand many providers enforce) or if you don't want to use sockets. You're right it could have been done more efficient -- maybe I'll do that in an update (fixing the header stuff too).
As for the SQLClass -- it's not necessarily. There is no code duplication anywhere. Why would I add the complexity of OO when I just need a few lines of code.
Re: SQLChat - Live MySQL server feed & chat box -
nGen.SoNNy - 19.09.2013
Look what i found in the console:
http://rse-ro.com/screen/screen.png
Re: SQLChat - Live MySQL server feed & chat box -
Sinner - 19.09.2013
Quote:
Originally Posted by nGen.SoNNy
|
Thanks. I found the issue and I'm working on fixing it now:
Код HTML:
<b>Warning</b>: mysql_connect(): No connection could be made because the target machine actively refused it.
in <b>C:\xampp\htdocs\sandecnet\dev\sqlchat\database.php</b> on line <b>24</b><br />
<br />