<?php
error_reporting(E_ERROR);
//////////////////////////////////////////////////////////////////////////////////
// Kreative News
// Designed and Built by: Ben Kuskopf
// Copyright Kreative Studios 2002-2003
// You can modify the script files as much as you like
// How ever the copyright and powered by notice must appear on pages using knews.
// Last Modified: May 27th 2003
// To Do: Nothing at the moment
/////////////////////////////////////////////////////////////////////////////////
/* ------------------------------------- */
function printerror($error){
	$perror = "<html>
		<head>
		<title>.:: Kreative News ::.</title>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
		<link href=\"template.css\" rel=\"stylesheet\" type=\"text/css\">
		<SCRIPT LANGUAGE=\"JavaScript\">
		<!-- Begin
		function popuphelp(url,size) {
		ElementWindow = window.open(url,'knews',size)
	}
	// End -->
	</SCRIPT>
		
		
		</head>
		
		<body bgcolor=\"e4eaed\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">
		<div align=\"center\">
		<table width=\"770\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
		<tr>
		<td width=\"764\">
		<img src=\"kreative.gif\" border=\"0\" width=\"296\" height=\"64\">
		</td>
		</tr>
		
		<tr>
		<td width=\"100%\" valign=\"top\">
		
		<!-- Start Nav Bar-->
		
		<!-- General Section -->
		
		<!-- End General Section -->
		
		<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"006699\" height=\"100%\">
		<tr >
		<td valign=\"top\" >
		<table width=\"100%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\" bgcolor=\"FFFFFF\" height=\"100%\" style=\"border-collapse: collapse\" bordercolor=\"#111111\">
		<tr >
		<td valign=\"top\">
		<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\">
		
		<tr>
		<td width=\"100%\">
		";
		
		if ($error == "connection"){
			
			$perror .="<b><font color=red><img src=images/error.gif>&nbsp;&nbsp;Error, couldn't connect to the server or database.</b></font><br>
				There was an error communicating with the database or mysql server.";
				
		}
		
		$perror .="
			</td>
			
			</tr>
			</table><bR>
			</td>
			</tr>
			</table>
			</td>
			</tr>
			</table>
			
			</td>
			
			</tr>
			
			</table>
			</div>
			</body>
			</html>";
			
			return $perror;
}
$error = printerror('connection');
$dbl = @mysql_pconnect($hn,$un,$pw)    
or die ($error."\n");

mysql_select_db($db);

$sqlnv = mysql_query("SELECT * FROM " . $tprefix . "settings WHERE setname='abpath'");
		if ($sqlnv)
		{
  			while($row = mysql_fetch_array($sqlnv))
  			{
			$abpath = $row['setvalue'];	
			}
		}
require $abpath . "/functions.php";
if (isset($_GET['Display'])) $distype = $_GET['Display']; else $distype = 'Headlines';
if (isset($_GET['Limit'])) $limit = $_GET['Limit']; else $limit = 'None';
if (isset($_GET['Template'])) $temp = $_GET['Template']; else $temp = 'Normal';
if (isset($_GET['Keyword'])) $category = $_GET['Keyword']; else $category = 'None';

if (isset($_GET['Action'])) $Step = $_GET['Action']; else $Step = 'None';
if (isset($_GET['Mesg'])) $Mesg = $_GET['Mesg']; else $Mesg = 'None';
	

		$sqlnv = mysql_query_e("SELECT * FROM " . $tprefix . "settings WHERE setname='powertext'");
		if ($sqlnv)
		{
  			while($row = mysql_fetch_array($sqlnv))
  			{
			$powertext = $row['setvalue'];	
			}
		}
		
		if ($limit == "None"){
		$sqlnv = mysql_query_e("SELECT * FROM " . $tprefix . "settings WHERE setname='limit'");
		if ($sqlnv)
		{
  			while($row = mysql_fetch_array($sqlnv))
  			{
			$limit = $row['setvalue'];	
			}
		}
		}
		
		


if ($Step == "None"){

$finaltemp = getthenews($distype,$temp,$category,$limit,$tprefix,'','','','');

ob_start(); eval('?>' . $finaltemp); $finaltemp = ob_get_contents(); ob_end_clean();
echo $finaltemp;
// End list all headlines
			
}

mysql_close();
?>