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.