Raised This Month: $12 Target: $400
 3% 

Web Live Chat v1.4


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-06-2014 , 12:25   Web Live Chat v1.4
Reply With Quote #1

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 :.



Attached Files
File Type: zip WebLiveChat.zip (2.2 KB, 808 views)
File Type: sma Get Plugin or Get Source (WebLiveChat.sma - 1594 views - 2.7 KB)
__________________

Last edited by Neeeeeeeeeel.-; 04-07-2014 at 15:43.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Baws
Veteran Member
Join Date: Oct 2012
Old 03-06-2014 , 12:26   Re: Web Live Chat
Reply With Quote #2

You did it! ahahahahha Nice one.
__________________
Like my clean plugins and work?
Baws is offline
jonnzus
Epic Member
Join Date: Oct 2010
Location: Finland
Old 03-06-2014 , 12:57   Re: Web Live Chat
Reply With Quote #3

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..

Last edited by jonnzus; 03-06-2014 at 13:05.
jonnzus is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-06-2014 , 13:05   Re: Web Live Chat
Reply With Quote #4

Quote:
Originally Posted by jonnzus View Post
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..
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.
__________________

Last edited by Neeeeeeeeeel.-; 03-06-2014 at 13:08.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
claans
Senior Member
Join Date: Jul 2012
Location: Argentina
Old 03-06-2014 , 13:11   Re: Web Live Chat
Reply With Quote #5

Good plugin D:

Saludos,
cLAANS.-
__________________
http://amxmodx-es.com/ Allied Modders en espaņol
http://amxmodx-es.com/ Allied Modders in spanish
claans is offline
Send a message via MSN to claans Send a message via Skype™ to claans
jonnzus
Epic Member
Join Date: Oct 2010
Location: Finland
Old 03-06-2014 , 13:13   Re: Web Live Chat
Reply With Quote #6

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
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
jonnzus is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-06-2014 , 13:27   Re: Web Live Chat
Reply With Quote #7

Quote:
Originally Posted by jonnzus View Post
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
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
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
jonnzus
Epic Member
Join Date: Oct 2010
Location: Finland
Old 03-06-2014 , 13:32   Re: Web Live Chat
Reply With Quote #8

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
Yeah but how to automatically send the random string generated to the php file?
Add it to database with plugin?
jonnzus is offline
ArabicMan
Veteran Member
Join Date: Feb 2014
Location: مصر
Old 03-06-2014 , 13:39   Re: Web Live Chat
Reply With Quote #9

Good but it's existing
ArabicMan is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-06-2014 , 13:42   Re: Web Live Chat
Reply With Quote #10

Quote:
Originally Posted by jonnzus View Post
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 View Post
Good but it's existing
Could you link me?
__________________

Last edited by Neeeeeeeeeel.-; 03-06-2014 at 13:42.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:40.


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