Skip to content

Instantly share code, notes, and snippets.

@CrBoy
Created June 15, 2010 03:10
Show Gist options
  • Save CrBoy/438648 to your computer and use it in GitHub Desktop.
Save CrBoy/438648 to your computer and use it in GitHub Desktop.
This is a very coarse chatroom written by php. I made it in a speech just for chatting with 2 friends.
WARNING: This one is very dangerous, which would be attacked by command injecttion, please BE CAREFUL using it.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TinyChat 簡易的網路聊天室</title>
</head>
<body onload="document.tinychat.say.focus()">
<?
$_GET['nick'] = escapeshellcmd($_GET['nick']);
$_GET['say'] = escapeshellcmd($_GET['say']);
if($_GET['say']!=""){
system('echo ['.$_GET['nick'].'] >> chat.log');
system('echo '.$_GET['say'].' >> chat.log');
system('echo \<br\> >> chat.log');
}
readfile("chat.log");
?>
<hr>
<form action="" method=GET name="tinychat">
暱稱:<input type=text name=nick value=<?echo $_GET['nick']?>><br/>
<input type=text name=say>
<input type=submit value='送出'>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment