$pagetitle = "Forsíða";
include ("includes/head.php");
?>
/****** VEFSVÆÐI ***************************/
/*******************************************/
/******	ORÐ Í BELG ***************************/
function New_Comment($blog_id, $comment_dags, $comment_time, $comment_nafn, $comment_netfang, $comment_veffang, $comment_efni, $comment_texti)
{
	$comment_dags = date("Y-m-d", time());
	$comment_time = date("H:i:s", time());
	$comment_nafn = strip_tags($comment_nafn);
	$comment_efni = strip_tags($comment_efni);
	$query = "INSERT INTO comments_t (blog_id, comment_dags, comment_time, comment_nafn, comment_netfang, comment_veffang, comment_efni, comment_texti) VALUES ($blog_id, '$comment_dags', '$comment_time', '$comment_nafn', '$comment_netfang', '$comment_veffang', '$comment_efni', '$comment_texti')";
	if (strlen($comment_nafn) > 0 && !strpos($comment_texti, "[") && !strpos($comment_efni, "<") && !strpos($comment_nafn, "[") && !strpos($comment_nafn, "<")  && !strpos($comment_nafn, "http") && !strpos($comment_netfang, "http") && !strpos($comment_texti, "<") && !strpos($comment_texti, "||") && $comment_efni != "Unknown")
	{
		$query = "INSERT INTO comments_t (blog_id, comment_dags, comment_time, comment_nafn, comment_netfang, comment_veffang, comment_efni, comment_texti) VALUES ($blog_id, '$comment_dags', '$comment_time', '$comment_nafn', '$comment_netfang', '$comment_veffang', '$comment_efni', '$comment_texti')";
		$result = mysql_query($query);
		if(!$result){
		return mysql_error();
		echo mysql_error();
		} else {
		$query2 = "SELECT page_id, page_title, page_date FROM pages WHERE page_id=$blog_id";
		$result2 = mysql_query($query2);
		$thetitle = mysql_result($result2,0,"page_title");
		$thedate = mysql_result($result2,0,"page_date");
		if ($thetitle == "") 
		{ 
			$thetitle = "enginn titill";
		}
		list($a, $b, $c) = explode("-", $thedate);
		$thepath = "http://rakel.betra.is/sida.php?id=$blog_id#comments";
		mail("rakel@betra.is","Rakel - Orð í belg","$comment_nafn lagði orð í belg:\n\n$comment_efni\n$comment_texti\n\nNetfang:$comment_netfang\nVeffang:$comment_veffang\n\nÞetta var við færsluna \"$thetitle\"\n$thepath","From: vefur@betra.is");
		return 1;
		}
	}
}
/*******************************************/
function get_comments ($blog_id, $explode)
{
	$query = "SELECT * FROM comments_t where blog_id='$blog_id' ORDER BY comment_dags ASC, comment_time ASC";
	$result = mysql_query($query);
	echo "";
		}
		else
		{
			echo " lagt orð í belg
";
		}
		if ($explode == "yes")
		{
			do {
				echo "";
				
			  } while($row = mysql_fetch_array($result));
			}
		}
		else
		{
			echo "Enginn hefur lagt orð í belg!";
			echo "";
		}
  mysql_free_result($result);
}
/*#################*/
function add_comment ($id)
{
/*
	echo "
		Leggðu orð í belg
		
	";
*/
}
/*#################*/
?>
"; if ($row = mysql_fetch_array($result)) { $fjoldi = mysql_num_rows($result); if ($fjoldi == 1) { echo "$fjoldi hefur"; } else { echo "$fjoldi hafa"; } if ($explode != "yes") { echo " lagt orð í belg"; echo "