<?php require("check.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Administratoriaus prisijungimas</title>
<link href="stilius.css" rel="stylesheet" type="text/css" />
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<?php
require("configas.php");
global $dbhost, $dbuname, $dbpass, $dbname; 
mysql_connect($dbhost, $dbuname, $dbpass); 
@mysql_select_db($dbname) or die ("Unable to select database !"); 
mysql_query("SET NAMES utf8"); 
?>

<script language="JavaScript" type="text/javascript" src="wy/scripts/wysiwyg.js"></script>
<script language="JavaScript" type="text/javascript" src="wy/scripts/wysiwyg-settings.js"></script>	

<script language="javascript1.2">
   // attach the editor to all textareas of your page.
   WYSIWYG.attach('all');

</script>
</head>
<body>
<?php
	$ats = "U&#382;pildykite form&#261; ir nurodykite kokia kalba bus naujiena";
	if (isset($_POST['ikelti'])) {
		$selected = $_POST['kalba'];
		$tema = $_POST['tema'];
		$txt = $_POST['tekstas'];
		
		if ($tema!=NULL and $txt!=NULL && $txt!="<br>") {
		
		$uzklausa = "INSERT INTO news2 (kalba, busena, tema, txt) VALUES ('$selected', '1', '$tema', '$txt')";
		$rezultatas = mysql_query($uzklausa) or die(mysql_error());
		$ats = "Naujiena &#303;kelta";
		echo "<meta http-equiv='refresh' content='5' />";
		}else{
		$ats = "Nepilnai u&#382;pildyta forma";
		}
		
	}
?>
<table id="pagr" align="center">
	<tr valign="top">
		<td class="meniu">
			<table class="meniu2" width="200px">
				<?php require("meniu.php"); ?>
			</table>			
		</td>
		<td class="turinys">
			<table class="turinys2">
				<tr>
					<td class="t1"><?php echo $ats?></td>
				</tr>
				<tr>
					<td class="t2" align="center">
						<form  action="<? echo $php_self ?>" method="post" enctype="multipart/form-data">
						<table>
							<tr>
								<td><input type="text" name="tema" style="width: 432px">
								<input type="radio" name=kalba value="1" checked/><img src="images/LT.png"/>
								<input type="radio" name=kalba value="2"/><img src="images/EN.png"/>
								</td>
							</tr>
							<tr valign="top">
								<td height="270"><textarea cols="70" rows="20" name="tekstas" id="text"></textarea></td>
							</tr>
							<tr>
								<td align="right"><input type="submit" value="Si&#371;sti" name="ikelti"/></td>
							</tr>
						</table>
						</form>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

</body>
</html>