Index: unk/htdocs/conequery-vo.php
===================================================================
--- /trunk/htdocs/conequery-vo.php	(revision 173)
+++ 	(revision )
@@ -1,170 +1,0 @@
-<?php	session_start(); 
-header("Content-type: text/xml");
-	// conequery-vo.php
-	// Matthew Whiting June 18 2007
-	// 
-	// A test of a VO-compliant conesearch query for the new data.
-	// This should return a VOTable.
-	//
-	// The query parameters are RA, DEC, SR, all in decimal degrees.
-	//
-	// An example to test is conequery-vo.php?RA=0.&DEC=-49.&SR=1.
-	//
-	// Using Albert Teoh's query.php as a template
-?>
-<?php 
-//
-// Need to enclose the following in a <?php structure else having the <?xml will confuse things
-//
-echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-?> 
-<!DOCTYPE VOTABLE SYSTEM "http://us-vo.org/xml/VOTable.dtd">
-<VOTABLE version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ivoa.net/xml/VOTable/VOTable/v1.1">
-<?php
-include_once("database.php");
-include_once("utils.php");
-include_once("xmlFunctions.php");
-
-$raj_degs         = trim(get_param('RA', $HTTP_GET_VARS));
-$decj_degs        = trim(get_param('DEC', $HTTP_GET_VARS));
-$radius           = trim(get_param('SR', $HTTP_GET_VARS));
-
-$errorMsg = "";
-$isError = False;  // Assume the best, that all three parameters are present and appropriate.
-
-// If a parameter is missing, we have a problem.
-if($raj_degs==""){
-  $isError=True;
-  $errorMsg .= "RA value not provided.; ";
-}
-if($decj_degs==""){           //	if(!isset($decj_degs)){
-  $isError=True;
-  $errorMsg .= "DEC value not provided.; ";
-	}
-if($radius==""){		//	if(!isset($radius)){
-  $isError=True;
-  $errorMsg .= "SR value not provided.; ";
-}
-
-// If the parameters are not numbers, this is bad.
-if(($raj_degs!="") && !is_numeric($raj_degs)){
-  $isError=True;
-  $errorMsg .= "RA value (" . $raj_degs . ") is not a number.; ";
-}
-if(($decj_degs!="") && !is_numeric($decj_degs)){
-  $isError=True;
-  $errorMsg .= "DEC value (" . $decj_degs . ") is not a number.; ";
-}
-if(($radius!="") && !is_numeric($radius)){
-  $isError=True;
-  $errorMsg .= "SR value (" . $radius . ") is not a number.; ";
-}
-
-// If DEC is out of range, this is bad.
-if( is_numeric($decj_degs) && (abs($decj_degs) > 90.) ){
-  $isError = True;
-  $errorMsg .= "DEC value (" . $decj_degs . ") is out of range; ";
-    //  $errorMsg .= "DEC value is out of range; ";
-}
-
-// If SR is negative, this is bad.
-if( is_numeric($radius) && ($radius < 0.) ){
-  $isError = True;
-  $errorMsg .= "SR value (" . $radius . ") is negative; ";
-}
-
-// If there has been an error, report it as a PARAM and exit.
-if($isError){
-  echo "<RESOURCE type=\"Error message\">\n";
-  printf("<PARAM ID=\"ERROR\" datatype=\"char\" value=\"%s\"/>\n",$errorMsg);
-  echo "</RESOURCE>\n";
-  echo "</VOTABLE>\n";
-  exit;
-}
-// Else, continue!
-
-echo "<DESCRIPTION>\n";
-echo "ATNF Pulsar Archive: Conesearch Query\n";
-echo "</DESCRIPTION>\n";
-echo "<COOSYS ID=\"J2000\" equinox=\"J2000.\" epoch=\"J2000.\" system=\"eq_FK5\"/>\n";
-echo "<RESOURCE type=\"conesearch results\">\n";
-printf("<PARAM ID=\"RA\" name=\"RA\" datatype=\"float\" unit=\"degrees\" value=\"%10.6f\"></PARAM>\n",$raj_degs);
-printf("<PARAM ID=\"DEC\" name=\"DEC\" datatype=\"float\" unit=\"degrees\" value=\"%+11.6f\"></PARAM>\n",$decj_degs);
-printf("<PARAM ID=\"SR\" name=\"SR\" datatype=\"float\" unit=\"degrees\" value=\"%10.6f\"></PARAM>\n",$radius);
-
-
-///////////////////////////////////////////////////////////////////////////
-//  CONNECT TO THE MYSQL DATABASE AND STORE THE S70 DATA.
-//  THIS IS A TEMPORARY MEASURE -- IDEALLY THE DATA WILL BE IN PLACE 
-//   BEFOREHAND.
-//
-
-//$link = db_connect_admin();
-$link = db_connect();
-
-//loadS70();
-//loadNewTables();
-
-///////////////////////////////////////////////////////////////////////////
-	
-
-
-//////////////////////////////////////////////
-// Get the field names to fill the table column headers (FIELD declarations).
-
-$query = "SHOW COLUMNS FROM s70";
-$result = mysql_query($query) or die ('Query failed: ' . mysql_error());
-
-$fields = array();
-if (mysql_num_rows($result)) {
-  while($row = mysql_fetch_assoc($result)) {
-    array_push($fields, $row);
-  }
-}
-
-echo "<TABLE>\n";
-print_column_headers_VO($result);
-
-$whereString = "";
-
-////////////////////////////
-// Cone search
-
-$angsep_str = "";
-if ($radius) {
-  
-  $angsep_str = "degrees( acos( cos(radians(rajd-$raj_degs))*cos(radians(decjd))*cos(radians($decj_degs))+sin(radians(decjd))*sin(radians($decj_degs))) )";
-  
-  $whereString .= "($angsep_str - 0.25*(bmaj+bmin)) < $radius";
-  
-}
-
-// Remove any leading or trailing AND and OR
-$whereString = trim($whereString, " AND OR");
-
-//$query = "SELECT *,$angsep_str as angsep FROM s70 WHERE $whereString ORDER by angsep";
-
-$query = "(SELECT *,$angsep_str as angsep FROM s70 WHERE $whereString) UNION (SELECT *,$angsep_str as angsep FROM obs WHERE $whereString) ORDER BY angsep";
-
-$result = mysql_query($query) or die('Conesearch Query failed: ' . mysql_error());
-
-$all_results = array();
-
-while ($line = mysql_fetch_assoc($result)) {
-  array_push($all_results, $line );
-}
-
-$_SESSION['results'] = $all_results;
-
-mysql_free_result($result);
-
-mysql_close($link);
-
-///////////////////////////////////////////////////////////////////////////
-
-print_data_VO($all_results);
-
-echo "</TABLE>\n";
-echo"</RESOURCE>\n";
-echo"</VOTABLE>\n";
-?>
Index: /trunk/htdocs/conesearch.php
===================================================================
--- /trunk/htdocs/conesearch.php	(revision 174)
+++ /trunk/htdocs/conesearch.php	(revision 174)
@@ -0,0 +1,170 @@
+<?php	session_start(); 
+header("Content-type: text/xml");
+	// conequery-vo.php
+	// Matthew Whiting June 18 2007
+	// 
+	// A test of a VO-compliant conesearch query for the new data.
+	// This should return a VOTable.
+	//
+	// The query parameters are RA, DEC, SR, all in decimal degrees.
+	//
+	// An example to test is conequery-vo.php?RA=0.&DEC=-49.&SR=1.
+	//
+	// Using Albert Teoh's query.php as a template
+?>
+<?php 
+//
+// Need to enclose the following in a <?php structure else having the <?xml will confuse things
+//
+echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+?> 
+<!DOCTYPE VOTABLE SYSTEM "http://us-vo.org/xml/VOTable.dtd">
+<VOTABLE version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ivoa.net/xml/VOTable/VOTable/v1.1">
+<?php
+include_once("database.php");
+include_once("utils.php");
+include_once("xmlFunctions.php");
+
+$raj_degs         = trim(get_param('RA', $HTTP_GET_VARS));
+$decj_degs        = trim(get_param('DEC', $HTTP_GET_VARS));
+$radius           = trim(get_param('SR', $HTTP_GET_VARS));
+
+$errorMsg = "";
+$isError = False;  // Assume the best, that all three parameters are present and appropriate.
+
+// If a parameter is missing, we have a problem.
+if($raj_degs==""){
+  $isError=True;
+  $errorMsg .= "RA value not provided.; ";
+}
+if($decj_degs==""){           //	if(!isset($decj_degs)){
+  $isError=True;
+  $errorMsg .= "DEC value not provided.; ";
+	}
+if($radius==""){		//	if(!isset($radius)){
+  $isError=True;
+  $errorMsg .= "SR value not provided.; ";
+}
+
+// If the parameters are not numbers, this is bad.
+if(($raj_degs!="") && !is_numeric($raj_degs)){
+  $isError=True;
+  $errorMsg .= "RA value (" . $raj_degs . ") is not a number.; ";
+}
+if(($decj_degs!="") && !is_numeric($decj_degs)){
+  $isError=True;
+  $errorMsg .= "DEC value (" . $decj_degs . ") is not a number.; ";
+}
+if(($radius!="") && !is_numeric($radius)){
+  $isError=True;
+  $errorMsg .= "SR value (" . $radius . ") is not a number.; ";
+}
+
+// If DEC is out of range, this is bad.
+if( is_numeric($decj_degs) && (abs($decj_degs) > 90.) ){
+  $isError = True;
+  $errorMsg .= "DEC value (" . $decj_degs . ") is out of range; ";
+    //  $errorMsg .= "DEC value is out of range; ";
+}
+
+// If SR is negative, this is bad.
+if( is_numeric($radius) && ($radius < 0.) ){
+  $isError = True;
+  $errorMsg .= "SR value (" . $radius . ") is negative; ";
+}
+
+// If there has been an error, report it as a PARAM and exit.
+if($isError){
+  echo "<RESOURCE type=\"Error message\">\n";
+  printf("<PARAM ID=\"ERROR\" datatype=\"char\" value=\"%s\"/>\n",$errorMsg);
+  echo "</RESOURCE>\n";
+  echo "</VOTABLE>\n";
+  exit;
+}
+// Else, continue!
+
+echo "<DESCRIPTION>\n";
+echo "ATNF Pulsar Archive: Conesearch Query\n";
+echo "</DESCRIPTION>\n";
+echo "<COOSYS ID=\"J2000\" equinox=\"J2000.\" epoch=\"J2000.\" system=\"eq_FK5\"/>\n";
+echo "<RESOURCE type=\"conesearch results\">\n";
+printf("<PARAM ID=\"RA\" name=\"RA\" datatype=\"float\" unit=\"degrees\" value=\"%10.6f\"></PARAM>\n",$raj_degs);
+printf("<PARAM ID=\"DEC\" name=\"DEC\" datatype=\"float\" unit=\"degrees\" value=\"%+11.6f\"></PARAM>\n",$decj_degs);
+printf("<PARAM ID=\"SR\" name=\"SR\" datatype=\"float\" unit=\"degrees\" value=\"%10.6f\"></PARAM>\n",$radius);
+
+
+///////////////////////////////////////////////////////////////////////////
+//  CONNECT TO THE MYSQL DATABASE AND STORE THE S70 DATA.
+//  THIS IS A TEMPORARY MEASURE -- IDEALLY THE DATA WILL BE IN PLACE 
+//   BEFOREHAND.
+//
+
+//$link = db_connect_admin();
+$link = db_connect();
+
+//loadS70();
+//loadNewTables();
+
+///////////////////////////////////////////////////////////////////////////
+	
+
+
+//////////////////////////////////////////////
+// Get the field names to fill the table column headers (FIELD declarations).
+
+$query = "SHOW COLUMNS FROM s70";
+$result = mysql_query($query) or die ('Query failed: ' . mysql_error());
+
+$fields = array();
+if (mysql_num_rows($result)) {
+  while($row = mysql_fetch_assoc($result)) {
+    array_push($fields, $row);
+  }
+}
+
+echo "<TABLE>\n";
+print_column_headers_VO($result);
+
+$whereString = "";
+
+////////////////////////////
+// Cone search
+
+$angsep_str = "";
+if ($radius) {
+  
+  $angsep_str = "degrees( acos( cos(radians(rajd-$raj_degs))*cos(radians(decjd))*cos(radians($decj_degs))+sin(radians(decjd))*sin(radians($decj_degs))) )";
+  
+  $whereString .= "($angsep_str - 0.25*(bmaj+bmin)) < $radius";
+  
+}
+
+// Remove any leading or trailing AND and OR
+$whereString = trim($whereString, " AND OR");
+
+//$query = "SELECT *,$angsep_str as angsep FROM s70 WHERE $whereString ORDER by angsep";
+
+$query = "(SELECT *,$angsep_str as angsep FROM s70 WHERE $whereString) UNION (SELECT *,$angsep_str as angsep FROM obs WHERE $whereString) ORDER BY angsep";
+
+$result = mysql_query($query) or die('Conesearch Query failed: ' . mysql_error());
+
+$all_results = array();
+
+while ($line = mysql_fetch_assoc($result)) {
+  array_push($all_results, $line );
+}
+
+$_SESSION['results'] = $all_results;
+
+mysql_free_result($result);
+
+mysql_close($link);
+
+///////////////////////////////////////////////////////////////////////////
+
+print_data_VO($all_results);
+
+echo "</TABLE>\n";
+echo"</RESOURCE>\n";
+echo"</VOTABLE>\n";
+?>
