[Tool/Web/Other] SQLChat - Live MySQL server feed & chat box
#1

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
  1. Download SQLChat_Server.rar
  2. Unzip SQLChat_Server.rar to your server directory
  3. Download SQLChat_Website.rar
  4. Unzip SQLChat_Website.rar to your website directory
  5. In your server directory, go to sqlchat.pwn and change the MySQL details (SQL_HOST, SQL_USER, etc...)
  6. In your website directory, go to database.php and change your MySQL details (SQL_HOST, SQL_USER, etc...)
  7. In your server directory, add "sqlchat" to the "filterscripts" line
  8. 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.
Reply
#2

Awesome Bro this is something great!
Reply
#3

Awesome,

+rep
Reply
#4

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.
Reply
#5

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.
Reply
#6

Nice work, +3
Reply
#7

Awesome Work <3 +rep
Reply
#8

Is there a way to kick website chat users?
Reply
#9

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/...).
Reply
#10

Great idea. Looks nice too.
Reply
#11

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?
Reply
#12

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.
Reply
#13

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?
Reply
#14

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.
Reply
#15

nice + rep
Reply
#16

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.
Reply
#17

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;
    }

Reply
#18

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.
Reply
#19

Look what i found in the console: http://rse-ro.com/screen/screen.png
Reply
#20

Quote:
Originally Posted by nGen.SoNNy
Посмотреть сообщение
Look what i found in the console: http://rse-ro.com/screen/screen.png
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 />
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)