Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

How would i make this chat system escape chars?

Did this myself by running the posts through another file that cleaned them. Thanks
Give this stackoverflow answer a read:
https://stackoverflow.com/a/31714103
(Dec 30, 2017 12:35 PM)Charger Wrote:  Give this stackoverflow answer a read:
https://stackoverflow.com/a/31714103

This isnt working, https://pastebin.com/raw/SkMntpXz
(Dec 30, 2017 01:37 PM)JAS Wrote:  This isnt working, https://pastebin.com/raw/SkMntpXz

You didn't call the function anywhere?
And session_start has to be before $data="<b>".$_SESSION['username'].':</b> '.$_POST['chat']."<br>";
and you need to xss_clean the $_POST['chat'] and when you store it.
(Dec 30, 2017 01:48 PM)Charger Wrote:  You didn't call the function anywhere?
And session_start has to be before $data="<b>".$_SESSION['username'].':</b> '.$_POST['chat']."<br>";
and you need to xss_clean the $_POST['chat'] and when you store it.

also you should "xss_clean" the $_SESSION['username']

otherwhys they can have xss in there names (obv)
Basically validate everything that has to do with the user.
Never trust the user.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by Mr. RobotJul 19, 2022 03:16 AM 0 149 Jul 19, 2022 03:16 AM
Last Post: Mr. Robot
[PHP] by chrisnAug 14, 2014 01:04 PM 5 201 Aug 14, 2014 01:04 PM
Last Post: chrisn
[PHP] by z0tpyrkMar 1, 2014 09:54 PM 6 175 Mar 1, 2014 09:54 PM
Last Post: VladHQ