All pastes #187374 Raw Edit

comments.php

public php v1 · immutable
·published 2006-10-01 01:00 UTC
rendered paste body
<?php	$time = microtime();	$time = explode(" ", $time);	$time = $time[1] + $time[0];	$start = $time;?><html><head><style type="text/css"><!--body,td,th{	color: #FF0000;	font-family: Courier New, Courier, monospace;	font-size: 12px;}body {background-color: #000000;}a:link {color: #FF0000;}a:visited {color: #FFFFFF;}a:hover {color: #FF0000;}a:active {color: #FF0000;}--></style><Title>Comment Page</Title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><?	if($HTTP_POST_VARS['submit'])	{		if(!$HTTP_POST_VARS['name'])		{			echo "You must enter a name";			exit;		}		if(!$HTTP_POST_VARS['comment'])		{			echo "You must enter a comment";			exit;		}		if(strstr($HTTP_POST_VARS['name'],"`"))		{			echo "Name cannot contain the ` symbol";			exit;		}		if(strstr($HTTP_POST_VARS['comment'],"`"))		{			echo "comment cannot contain the ` symbol";			exit;		}				$fp = fopen('comments.txt','a');				if(!$fp)		{			echo "Error opening file!";			exit;		}				$line = date("[d/m/y h:i:s A] ") . $HTTP_POST_VARS['name'];		$line .= "` [break] " . $HTTP_POST_VARS['comment'];		$line = str_replace ("(A)", "[img src=../images/Comments/Angel.gif]", $line);		$line = str_replace (":@", "[img src=../images/Comments/Angry.gif]", $line);		$line = str_replace ("(U)", "[img src=../images/Comments/BrokenHeart.gif]", $line);		$line = str_replace ("(^)", "[img src=../images/Comments/Cake.gif]", $line);		$line = str_replace (":S", "[img src=../images/Comments/Confused.gif]", $line);		$line = str_replace ("(6)", "[img src=../images/Comments/Devil.gif]", $line);		$line = str_replace (":$", "[img src=../images/Comments/Embarassed.gif]", $line);		$line = str_replace ("(G)", "[img src=../images/Comments/Gift.gif]", $line);		$line = str_replace (":D", "[img src=../images/Comments/Happy.gif]", $line);		$line = str_replace ("(L)", "[img src=../images/Comments/Heart.gif]", $line);		$line = str_replace ("(K)", "[img src=../images/Comments/Kiss.gif]", $line);		$line = str_replace ("({)", "[img src=../images/Comments/Man.gif]", $line);		$line = str_replace ("<:o)", "[img src=../images/Comments/Party.gif]", $line);		$line = str_replace ("(F)", "[img src=../images/Comments/Rose.gif]", $line);		$line = str_replace (":(", "[img src=../images/Comments/Sad.gif]", $line);		$line = str_replace ("^o)", "[img src=../images/Comments/Sarcastic.gif]", $line);		$line = str_replace (":|", "[img src=../images/Comments/Shocked.gif]", $line);		$line = str_replace (":)", "[img src=../images/Comments/Smile.gif]", $line);		$line = str_replace (":o", "[img src=../images/Comments/Surprised.gif]", $line);		$line = str_replace ("(N)", "[img src=../images/Comments/ThumbsDown.gif]", $line);		$line = str_replace ("(Y)", "[img src=../images/Comments/ThumbsUp.gif]", $line);		$line = str_replace (":P", "[img src=../images/Comments/Tongue.gif]", $line);		$line = str_replace ("(W)", "[img src=../images/Comments/WiltedRose.gif]", $line);		$line = str_replace (";)", "[img src=../images/Comments/Wink.gif]", $line);		$line = str_replace ("(})", "[img src=../images/Comments/Woman.gif]", $line);		$line = str_replace ("\r\n","[break]", $line);		$line = str_replace ("<","[", $line);		$line = str_replace (">", "]", $line);		$line = str_replace ("[3", "<3", $line);		$line = str_replace ("[img", "<img", $line);		$line = str_replace ("gif]", "gif>", $line);		$line = str_replace ("  ", " &nbsp;", $line);		$line .= "[break]\r\n";		$line = str_replace ("[break]", "<br>", $line);				fwrite($fp, $line);		if(!fclose($fp))		{			echo "Error closing file!";			exit;		}	}		$data = file('comments.txt');	$data = array_reverse($data);	foreach($data as $element)	{		$element = trim($element);		$pieces = explode("`", $element);		echo "<b>" . $pieces[0] . ":</b>&nbsp;" . $pieces[1] . "<br>";	}?><p align="Center"><?php	$time = microtime();	$time = explode(" ", $time);	$time = $time[1] + $time[0];	$finish = $time;	$totaltime = ($finish - $start);	printf ("Page took %f seconds to load.", $totaltime);?></p></body>