AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Web Live Chat v1.4 (https://forums.alliedmods.net/showthread.php?t=236507)

Neeeeeeeeeel.- 03-06-2014 12:25

Web Live Chat v1.4
 
13 Attachment(s)
Web Live Chat
Version: 1.4


.: Description :.

  • The plugin sends everything a player says to a website using HTTP Post Request format.
  • The web handler is a PHP file that get what the player said. Then, it stores the message in a database.
  • Another PHP file shows the CS Chat on live. It automatically checks if there are new messages every second using ajax (without refreshing the page).


.: Cvars :.

  • amx_chat_host "your website" (default: 127.0.0.1) ONLY WEB SERVER HOST, you can't add subdirs here.
  • amx_chat_phpfile "file.php" (default: handler.php)
  • cvar values are cached in memory at plugin startup, so if you change a cvar it won't take effect until you reload the map/restart the server.
  • DO NOT ADD "http://", "https://", etc to amx_chat_host otherwise it won't work. Examples: "forums.alliedmods.net", "amxmodx.org"


.: Changelog :.

Code:

Version 1.0:
    -First realease.

Version 1.1:
    -Added cvars

Version 1.2:
    -Added IP check in handler.php to verify that the POST Request came from your server (to prevent flood or false data).
    -Added posibbility to use the same chat handler (handler.php) to all your servers.

Version 1.3:
    -Added new allowed characters like ":", ")", "(" to the regular expression that cleans the strings for security reasons.
    -Fixed plugin_putinserver -> client_putinserver
    -Fixed some little bugs in handler.php

Version 1.4:
    -Added utf8 character support.
    -Added if player is alive or not.
    -Added cvar to know which servers are running the plugin.
    -Fixed a bug with char "&" in name.
    -Fixed bug sending html code to the handler.
    -Fixed bug showing unescaped characters.
    -Php filenames change to prevent missunderstanding



.: Updating from 1.3 to 1.4:

After you replace the plugin and php files, you have to run this query on your MySQL Server.
Code:

ALTER TABLE `cs_chat` ADD `alive` INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `pj`


.: Comments :.


  • You MUST edit line 6 of handler.php. You have to write your game server/s IP/s. This is to verify that the data came from your server. The example ips are 127.0.0.1 and 192.168.0.101
  • Why did I not update the database with the plugin itself? Most of game hosters dosn't allow you to use local databases, most of free webhostings doesn't allow remote connections to database, some non-free webhostings doesn't allow remote connetions to database. My plugin works on all this cases, so you don't have to worry about it.
  • I know the javascript code (chat.php) is not the most efficient code & the best choice would be only refresh it when new data is available, but I would like to keep it simple as it is.
  • If you use only one handler.php for all your server you have to call chat.php with chat.php?ip=SERVER_IP:PORT_HERE so you will only see the chat from that server (If you don't you will see the chat from all your servers as one).
  • The plugin doesn't support secure http connections (HTTPS).
  • utf8 supported
  • handler.php => the Post request handler & database seeker.
  • chat.php => the live chat itself (look at the screenshot to see chat style).
  • cs_chat.sql => mysql table query.


.: ScreenShots :.

http://puu.sh/7Dls2.png

http://i.imgur.com/Bg3NRWa.png

Baws 03-06-2014 12:26

Re: Web Live Chat
 
You did it! ahahahahha Nice one.

jonnzus 03-06-2014 12:57

Re: Web Live Chat
 
I think you should add some check sum or password to http post. I think it's pretty easy to flood database with small script..:D

Neeeeeeeeeel.- 03-06-2014 13:05

Re: Web Live Chat
 
Quote:

Originally Posted by jonnzus (Post 2108338)
I think you should add some check sum or password to http post. I think it's pretty easy to flood database with small script..:D

A checksum or password will be pointless since it's an open source plugin. Anyone could copy it, except I use a constant random value that must be changed manually by every user.

I could check the IP from where the request came so I would only accept when it came from the gameserver IP. I will add it.

Btw if you look at chat.php there is a small script to prevent hyper-floding.

claans 03-06-2014 13:11

Re: Web Live Chat
 
Good plugin D:

Saludos,
cLAANS.-

jonnzus 03-06-2014 13:13

Re: Web Live Chat
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 2108343)
A checksum or password will be pointless since it's an open source plugin so anyone could copy it, except I use a constant random value that must be changed manually by every user if they want to be secure.

Well, in first run plugin could make random string and add it to database and use it as "password".
But well, somehow I didn't notice $_SESSION["flood"] check :shock:

Neeeeeeeeeel.- 03-06-2014 13:27

Re: Web Live Chat
 
Quote:

Originally Posted by jonnzus (Post 2108345)
Well, in first run plugin could make random string and add it to database and use it as "password".
But well, somehow I didn't notice $_SESSION["flood"] check :shock:

Yeah but how to automatically send the random string generated to the php file? If I send it by http I will have the same "bug".

Btw, I added the IP check in v1.2

jonnzus 03-06-2014 13:32

Re: Web Live Chat
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 2108355)
Yeah but how to automatically send the random string generated to the php file?

Add it to database with plugin?

ArabicMan 03-06-2014 13:39

Re: Web Live Chat
 
Good but it's existing

Neeeeeeeeeel.- 03-06-2014 13:42

Re: Web Live Chat
 
Quote:

Originally Posted by jonnzus (Post 2108356)
Add it to database with plugin?

Read the "comments" section of the thread.

Btw as I said I implemented a better (99% secure) way to check the data is from your server.

Quote:

Originally Posted by ArabicMan (Post 2108360)
Good but it's existing

Could you link me?


All times are GMT -4. The time now is 16:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.