3-line PHP chat

Posted by Looie, 01-15-2008, 03:28 PM
Just an idea I had http://www.ehwtf.com/stuffz/chat

Posted by Dolbz, 01-15-2008, 03:54 PM
incredibly insecure but pretty cool

Posted by liam_tmt7, 01-15-2008, 06:39 PM
yeah insecure put still pretty nice if you were just using it for messing around. I like it....lol Liam

Posted by csparks, 01-15-2008, 08:39 PM
it could be used as a base, but anything else, like said insecure. Are you new to php? If so, make sure you check out all information regarding securing scripts.

Posted by Fizzadar, 01-15-2008, 08:44 PM
it's not working any more

Posted by ThatScriptGuy, 01-15-2008, 11:46 PM
Until you get the file opened at the same time on two, three, fifteen machines, and lose data...

Posted by Czaries, 01-15-2008, 11:54 PM
Anytime you have frequent updates from multiple users, you are going to run into concurrency issues. You need to add file locking at the very least to prevent this.

Posted by luki, 01-16-2008, 02:00 AM
Pretty "nasty" IMO, but as far as concurrency, this is actually safe on a local file system. It turns out, when a file is opened with the "append" flag, the file cursor is moved to the end of the file prior to each write, so as long as you write the entire chat line in one call, you are guaranteed that it will not be interrupted.

Posted by Looie, 01-16-2008, 12:25 PM
I don't intend to use it, I just wondered if it would work, and it does... kinda

Posted by schoeps, 01-16-2008, 12:56 PM
It works, but I prolly wouldnt use it

Posted by Harzem, 01-16-2008, 01:17 PM
And the idea of using an iframe makes it a little more secure Nice idea. Otherwise, would ruin it.

Posted by Xeentech, 01-16-2008, 04:08 PM
Well since the mime type is text/plain, and php is in it's horrible default of escaping the crap out of anything and everything it is actually securer than I expected, and sadly securer than some things I've seen in production.. If it's a 1 cpu machine it's unlikely that two end users would write to the file at the same time..

Posted by Looie, 01-17-2008, 01:24 PM
Can someone please explain to me why it's so insecure? All it's doing is writing data to a txt file...

Posted by ThatScriptGuy, 01-17-2008, 01:40 PM
But the chances of it happening increase dramatically as more users use it at once.

هل استفدت من هذا الجواب؟

 أطبع هذا المقال

اقرأ أيضا

ereg allow space? Simple for those who understand it

Posted by lexington, 09-21-2008, 10:46 PMI do not think I will ever fully understand ereg, eregi,...

SPAM died me

Posted by Tiva, 03-19-2007, 05:43 AMhi, my support and sales mailbox almost get full of spam and...

antivirus.exim

Posted by its_joy, 03-29-2008, 07:20 AMhi, i have installed antivirus.exim on server but if...

Bluehost (Matt Heaton) gives back to the community

Posted by mrzippy, 03-28-2008, 11:14 AMhttp://mattheaton.com/?p=126 Thanks Matt. Posted...

Warning: shell_exec() has been disabled for security reasons

Posted by ashish1987, 09-15-2007, 12:39 AMHey I installed status2k on my server and i am...