All pastes #210661 Raw Edit

Stuff

public php v1 · immutable
#210661 ·published 2006-10-19 22:09 UTC
rendered paste body
<?	$testimonial = $_GET['testimonial'];	$name = $_GET['name'];	$url = $_GET['url'];	$date = time();	$error = false;	$err_msg = "Some errors have occured. please be sure that the form has been filled out completely.<hr>";	if(!$name)				{ $error=true; }	if(!$url)					{ $error=true; }	if(!$testimonial) { $error=true; }	if(!$error)	{		require("mysql.php");		$conn = mysql_connect($hostname,$username,$password) or die("connect: ".mysql_error());		mysql_select_db($database) or die("select db: ".mysql_error());		$query = "insert into testimonials(name,url,testimonial,_date) values('".$name."','".$url."','".mysql_escape_string($testimonial)."','".$date."')";		$result = mysql_query($query) or die("query: ".mysql_error());		//get new data		$query = "select id,name,_date,url,testimonial from testimonials order by id desc limit 1";				$result = mysql_query($query) or die("query: ".mysql_error());			while ($row = mysql_fetch_array($result,MYSQL_ASSOC))			{				$testimonial = $row['testimonial'];				$testimonial = preg_replace("/\r/"," ",$testimonial);				$testimonial = preg_replace("/\n/"," ",$testimonial);				$testimonial = preg_replace("/\r\n/"," ",$testimonial);				$rtrn .= '[{id:"'.$row['id'].'",name:"'.$row['name'].'",url:"'.$row['url'].'",date:"'.date("m/d/Y g:ia",$row['_date']).'",data:"'.$testimonial.'"}]';			}		echo $rtrn;	}?>