<?php /*

 Originally written by Stefano Fabri <bluefuture@nospam@email.it>
 Copyright 2004, Stefano Fabri

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
if (array_key_exists("id",$_GET) and is_numeric($_GET[id])) {
    require("config_www.inc");
	header("Content-Type: text/plain");
	$sql="SELECT wwiz,watch, up_changes FROM pkgs where id=" . $_GET[id];
	$rsql=pg_exec($db, $sql);
	$res_array=pg_fetch_array($rsql);
	if (pg_numrows($rsql)==0) {
		print "Packages Id -> $_GET[id] - not found" ;
		pg_close($db);
		exit;
	}
	if (array_key_exists("type",$_GET)) {
		if ($_GET[type]=="up_changes") print $res_array['up_changes'];
		if ($_GET[type]=="watch") {
			if ($res_array[watch]) print $res_array[watch];
   			else print $res_array['wwiz'];
		}
	}
	pg_close($db);
}
else print "Error in submitted id field";
?>