All pastes #362612 Raw Edit

naerey

public php v1 · immutable
·published 2007-02-18 23:00 UTC
rendered paste body
<?php?><?php //Server part$chatpage="chat.xml";if ($_GET['post']=='1')  // If it's actually serverend{	$name= $_GET['name'];	$message= $_GET['message'];	$post=1;	$showchat=1;}else{	$showchat=1;}if (file_exists($chatpage) && is_readable($chatpage)) $xml = simplexml_load_file($chatpage);if ($showchat){	echo "<div id='chat'>";	foreach ($xml->post as $post)	{		echo "<p class='post'>\n";		echo "<b>".$post->name."</b> : ".$post->message."</p>";			}	echo "</div>";}if ($post){	$message = wordwrap($message, 15, " ", 1);	//No too long words	$name = htmlspecialchars($name, ENT_QUOTES);	$message = htmlspecialchars($message, ENT_QUOTES);	//  Cleaned up against HTML	$character = $xml->addChild('post');	$date_=date("d/m/y");	$time_=date("H:i:s");	$character->addChild('date', $date);	$character->addChild('time', $time);	$character->addChild('name', $name);	$character->addChild('message', $message);	echo $xml->asXML();	// XML formatted}$formcode ='<div id="postbox"><form action="./chat.php" method="post"><table border="0"><tr>';$formcode.='<td><h5>Name:</h5><input type="text" size="9" maxlength="10" name="name"></td>';$formcode.='</tr><tr><td><h5>Message:</h5><textarea rows="5" cols="8.5" maxlength="50" name="message">';$formcode.='</textarea></td><tr></table><input type="hidden" name="post" value="1">';$formcode.='<input type="submit" value="Submit"><input type="reset" value="Reset">';$formcode.='</form></div>';echo $formcode;?>