<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: anketos.php
| Mod: Anketos [php-fusion v7]
| Author: Gdrss
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

require_once "maincore.php";
require_once THEMES."templates/header.php";
 include "includes/kl_anketos.php";

add_to_title("".$locale['global_200']."Pateiktos Anketos");

if(!iMEMBER){ redirect(BASEDIR.'login.php');}

	$result = dbquery("SELECT * FROM anketa");
	
	if ($_GET['pateikti'] == "taip") {
	opentable('Anketa nusiusta!');
	echo "<b><center><img src='images/pateikta.png' /><br />
	Anketa sekmingai pateikta!<br /><br /><br /><br />
	<img src='images/loading.gif' /><br><small>Prasome palaukti...</small></center></b>";
	header("refresh: 2; url=anketos.php");
	closetable();
	
	
}	elseif ($_GET['pateikti'] == "ne") {
	opentable('Klaida!');
	echo "<center>
	<img src='images/stop.png' title='Priejimas uzdraustas' border='0'><br />
	<b>Jus jau pateikete Anketa!</b>
	<br /><br /><br />
	Blogai uzpildei anketa? Ar tiesiog nori ja istrynti?<br />
	<a href='".BASEDIR."messages.php?msg_send=1'>Parasyk zinute.</a>";
	closetable();}




	elseif (!anketos.php) {
opentable("$anketa[4]");
echo "<table border='1'><tr>
<th align='center'>$klausimas[1]</th>
<th align='center'>$klausimas[2]</th>
<th align='center'>$klausimas[3]</th>
<th align='center'>$klausimas[4]</th>
<th align='center'>$klausimas[5]</th>
<th align='center'>$klausimas[6]</th>
<th align='center'>$klausimas[7]</th>
<th>Data</th>";
if(iADMIN){
echo "<th>IP</th><th>Trinti</th>";
}
echo "</tr>";

while($row = mysql_fetch_array($result)) {
	
	 if ($_GET['trinti'] == "".$row['id']."") {
	 if(iADMIN){ $delete = dbquery("DELETE FROM anketa WHERE id='".$row['id']."'");
	redirect(FUSION_SELF.$aidlink);	
				}
	else { redirect(BASEDIR.'anketos.php');}
}
	
  echo "<tr>";
	echo "<td align='center'>".$row['klausimas1']."</td>";
	echo "<td align='center'>".$row['klausimas2']."</td>";
	echo "<td align='center'>".$row['klausimas3']."</td>";
	echo "<td align='center'>".$row['klausimas4']."</td>";
	echo "<td align='center'>".$row['klausimas5']."</td>";
	echo "<td align='center'>".$row['klausimas6']."</td>";
	echo "<td align='center'>".$row['klausimas7']."</td>";
	echo "<td align='center'>".$row['data']."</td>";
 if(iADMIN){
	echo "<td align='center'>".$row['ipas']."</td>";
	echo "<td align='center'><a href='".FUSION_SELF.$aidlink."&trinti=".$row['id']."'><img src='../../images/delete.gif' /></a></td>"; }
	echo "</tr>";
  }
  echo "</table>";
		closetable();}

		
		
		require_once THEMES."templates/footer.php";
?>