Index: /trunk/new-htdocs/conequery-vo.php
===================================================================
--- /trunk/new-htdocs/conequery-vo.php	(revision 80)
+++ /trunk/new-htdocs/conequery-vo.php	(revision 81)
@@ -16,9 +16,4 @@
 <!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">
-<DESCRIPTION>
-ATNF Pulsar Archive: Conesearch Query
-</DESCRIPTION>
-<COOSYS ID="J2000" equinox="J2000." epoch="J2000." system="eq_FK5"/>
-<RESOURCE type="conesearch results">
 <?php
 	include_once("../../database.php");
@@ -30,4 +25,62 @@
 	$radius           = trim(get_param('SR', $HTTP_GET_VARS));
 
+	$errorMsg = "";
+	$isError = False;  // Assume the best, that all three parameters are present and appropriate.
+	
+	// If all 3 parameters are present, all is good.
+	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 numeric, this is bad.
+	if(($raj_degs!="") && !is_numeric($raj_degs)){
+	 $isError=True;
+	 $errorMsg .= "RA value not a number.; ";
+	}
+	if(($decj_degs!="") && !is_numeric($decj_degs)){
+	 $isError=True;
+	 $errorMsg .= "DEC value not a number.; ";
+	}
+	if(($radius!="") && !is_numeric($radius)){
+	 $isError=True;
+	 $errorMsg .= "SR value 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 out of range; ";
+	}
+
+	// If SR is negative, this is bad.
+	if( is_numeric($radius) && ($radius < 0.) ){
+	 $isError = True;
+	 $errorMsg .= "SR value 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);
@@ -40,4 +93,5 @@
 //   BEFOREHAND.
 //
+
 $link = db_connect_admin();
 
@@ -122,16 +176,17 @@
 
 	echo "<FIELD name=\"Filename\" ID=\"col1\" ucd=\"meta.id;meta.main\" datatype=\"char\" arraysize=\"30\"/>\n";
-	echo "<FIELD name=\"Field Name\" ID=\"col2\" ucd=\"meta.id\" datatype=\"char\" arraysize=\"20\"/>\n";
-	echo "<FIELD name=\"RA\" ID=\"col3\" ucd=\"pos.eq.ra;meta.main\" ref=\"J2000\" datatype=\"float\" width=\"10\" precision=\"6\" unit=\"deg\"/>\n";
-	echo "<FIELD name=\"DEC\" ID=\"col4\" ucd=\"pos.eq.dec;meta.main\" ref=\"J2000\" datatype=\"float\" width=\"11\" precision=\"6\" unit=\"deg\"/>\n";
-	echo "<FIELD name=\"BMAJ\" ID=\"col5\" ucd=\"pos.angResolution;phys.angSize.smajAxis\" datatype=\"float\" width=\"6\" precision=\"4\" unit=\"deg\"/>\n";
-	echo "<FIELD name=\"BMIN\" ID=\"col6\" ucd=\"pos.angResolution;phys.angSize.sminAxis\" datatype=\"float\" width=\"6\" precision=\"4\" unit=\"deg\"/>\n";
-	echo "<FIELD name=\"BPA\" ID=\"col7\" ucd=\"pos.angResolution;pos.posAng\" datatype=\"float\" width=\"6\" precision=\"4\" unit=\"deg\"/>\n";
-	echo "<FIELD name=\"UT Date/Time of Observations\" ID=\"col8\" ucd=\"time.start\" datatype=\"char\" arraysize=\"30\"/>\n";
-	echo "<FIELD name=\"ObsFreq\" ID=\"col9\" ucd=\"em.freq.central\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"MHz\"/>\n";
-	echo "<FIELD name=\"Channel Bandwidth\" ID=\"col10\" ucd=\"spect.binSize;em.freq\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"MHz\"/>\n";
-	echo "<FIELD name=\"Number of Channels\" ID=\"col11\" ucd=\"em.bin;meta.number\" datatype=\"int\" width=\"6\"/>\n";
-	echo "<FIELD name=\"Scan length\" ID=\"col12\" ucd=\"obs.exposure;time.duration\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"s\"/>\n";
-	echo "<FIELD name=\"Sample time\" ID=\"col13\" ucd=\"time.resolution\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"ms\"/>\n";
+	echo "<FIELD name=\"Field Name\" ID=\"col2\" ucd=\"obs.field;meta.id\" datatype=\"char\" arraysize=\"20\"/>\n";
+        echo "<FIELD name=\"Survey\" ID=\"col3\" ucd=\"obs;meta.dataset;meta.id\" datatype=\"char\" arraysize=\"10\"/>\n";
+	echo "<FIELD name=\"RA\" ID=\"col4\" ucd=\"pos.eq.ra;meta.main\" ref=\"J2000\" datatype=\"float\" width=\"10\" precision=\"6\" unit=\"deg\"/>\n";
+	echo "<FIELD name=\"DEC\" ID=\"col5\" ucd=\"pos.eq.dec;meta.main\" ref=\"J2000\" datatype=\"float\" width=\"11\" precision=\"6\" unit=\"deg\"/>\n";
+	echo "<FIELD name=\"BMAJ\" ID=\"col6\" ucd=\"pos.angResolution;phys.angSize.smajAxis\" datatype=\"float\" width=\"6\" precision=\"4\" unit=\"deg\"/>\n";
+	echo "<FIELD name=\"BMIN\" ID=\"col7\" ucd=\"pos.angResolution;phys.angSize.sminAxis\" datatype=\"float\" width=\"6\" precision=\"4\" unit=\"deg\"/>\n";
+	echo "<FIELD name=\"BPA\" ID=\"col8\" ucd=\"pos.angResolution;pos.posAng\" datatype=\"float\" width=\"6\" precision=\"4\" unit=\"deg\"/>\n";
+	echo "<FIELD name=\"UT Date/Time of Observations\" ID=\"col9\" ucd=\"time.start\" datatype=\"char\" arraysize=\"30\"/>\n";
+	echo "<FIELD name=\"ObsFreq\" ID=\"col10\" ucd=\"em.freq.central\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"MHz\"/>\n";
+	echo "<FIELD name=\"Channel Bandwidth\" ID=\"col11\" ucd=\"spect.binSize;em.freq\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"MHz\"/>\n";
+	echo "<FIELD name=\"Number of Channels\" ID=\"col12\" ucd=\"em.bin;meta.number\" datatype=\"int\" width=\"6\"/>\n";
+	echo "<FIELD name=\"Scan length\" ID=\"col13\" ucd=\"obs.exposure;time.duration\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"s\"/>\n";
+	echo "<FIELD name=\"Sample time\" ID=\"col14\" ucd=\"time.resolution\" datatype=\"float\" width=\"9\" precision=\"4\" unit=\"ms\"/>\n";
 
 }
@@ -153,4 +208,5 @@
 	printf("<TD>%s</TD>",$line['filename']);
 	printf("<TD>%s</TD>",$line['src_name']);
+	printf("<TD>%s</TD>",$line['survey']);
 	printf("<TD>%10.6f</TD>",$line['rajd']);
 	printf("<TD>%+11.6f</TD>",$line['decjd']);
Index: /trunk/new-htdocs/loadS70.php
===================================================================
--- /trunk/new-htdocs/loadS70.php	(revision 80)
+++ /trunk/new-htdocs/loadS70.php	(revision 81)
@@ -8,9 +8,9 @@
 // ADMIN PRIVILEGES.
 
-	$createTable = "CREATE TEMPORARY TABLE s70 (file_id SMALLINT UNSIGNED AUTO_INCREMENT,filename VARCHAR(30),fileloc VARCHAR(100),hdrver VARCHAR(10),src_name VARCHAR(20),raj VARCHAR(15),decj VARCHAR(15),rajd FLOAT,decjd FLOAT,bmaj FLOAT,bmin FLOAT,bpa FLOAT,date_obs VARCHAR(30),obsfreq FLOAT,chanbw FLOAT,nchan FLOAT,scanlen FLOAT,tbin FLOAT,PRIMARY KEY (file_id))";
+	$createTable = "CREATE TEMPORARY TABLE s70 (file_id SMALLINT UNSIGNED AUTO_INCREMENT,filename VARCHAR(30),fileloc VARCHAR(100),hdrver VARCHAR(10),survey VARCHAR(10),src_name VARCHAR(20),raj VARCHAR(15),decj VARCHAR(15),rajd FLOAT,decjd FLOAT,bmaj FLOAT,bmin FLOAT,bpa FLOAT,date_obs VARCHAR(30),obsfreq FLOAT,chanbw FLOAT,nchan FLOAT,scanlen FLOAT,tbin FLOAT,PRIMARY KEY (file_id))";
 
 	$result = mysql_query($createTable) or die('Query failed: ' . mysql_error());
 
-	$loadTable = "LOAD DATA LOCAL INFILE \"/DATA/SITAR_1/whi550/VO/PulsarVO/s70v_summary.csv\" INTO TABLE s70 FIELDS TERMINATED BY \",\" OPTIONALLY ENCLOSED BY \"\\\"\" IGNORE 1 LINES (filename,fileloc,hdrver,src_name,raj,decj,rajd,decjd,bmaj,bmin,bpa,date_obs,obsfreq,chanbw,nchan,scanlen,tbin)";
+	$loadTable = "LOAD DATA LOCAL INFILE \"/DATA/SITAR_1/whi550/VO/PulsarVO/s70v_summary.csv\" INTO TABLE s70 FIELDS TERMINATED BY \",\" OPTIONALLY ENCLOSED BY \"\\\"\" IGNORE 1 LINES (filename,fileloc,hdrver,survey,src_name,raj,decj,rajd,decjd,bmaj,bmin,bpa,date_obs,obsfreq,chanbw,nchan,scanlen,tbin)";
 
 	$result = mysql_query($loadTable) or die('Query failed: ' . mysql_error());
Index: /trunk/src/pvo-metadata.cc
===================================================================
--- /trunk/src/pvo-metadata.cc	(revision 80)
+++ /trunk/src/pvo-metadata.cc	(revision 81)
@@ -19,4 +19,11 @@
       this->filename = fitsfile.getFITSname();
 
+      int pos = this->filename.find("_");
+      std::string surveyStr = this->filename.substr(0,pos);
+      if(surveyStr == "S70") this->survey = "S70";
+      else if(surveyStr == "PM") this->survey = "PM";
+      else if(surveyStr == "PH") this->survey = "PH";
+      else this->survey = nullString;
+
       std::string file_loc = "";
       if(this->filename[0]!='/'){
@@ -32,17 +39,22 @@
       this->headerversion = deblank(this->headerversion);
 
-      if(fitsfile.getKeyword<std::string>("SRC_NAME",this->srcname)!=0) this->srcname = nullString;
+      if(fitsfile.getKeyword<std::string>("SRC_NAME",this->srcname)!=0) 
+	this->srcname = nullString;
       else this->srcname = deblank(this->srcname);
       if(this->srcname=="") this->srcname = nullString;
 
-      if(fitsfile.getKeyword<std::string>("RA",this->raj)!=0) this->raj = nullString;
+      if(fitsfile.getKeyword<std::string>("RA",this->raj)!=0) 
+	this->raj = nullString;
       else this->rajd = dmsToDec(this->raj) * 15.;
 
-      if(fitsfile.getKeyword<std::string>("DEC",this->decj)!=0) this->decj = nullString;
+      if(fitsfile.getKeyword<std::string>("DEC",this->decj)!=0) 
+	this->decj = nullString;
       else this->decjd = dmsToDec(this->decj);
 
-      if(fitsfile.getKeyword<std::string>("DATE-OBS",this->date)!=0) this->date = nullString;
-
-      if(fitsfile.getKeyword<float>("OBSFREQ",this->obsfreq)!=0) this->obsfreq = nullFloat;
+      if(fitsfile.getKeyword<std::string>("DATE-OBS",this->date)!=0) 
+	this->date = nullString;
+
+      if(fitsfile.getKeyword<float>("OBSFREQ",this->obsfreq)!=0) 
+	this->obsfreq = nullFloat;
   
       if(fitsfile.getKeyword<float>("BMAJ",this->bmaj)==0){
@@ -53,8 +65,10 @@
       else this->bmaj = this->bmin = this->bpa = this->beamsize = nullFloat;
 
-      if(fitsfile.getKeyword<float>("SCANLEN",this->scanlen)!=0) this->scanlen = nullFloat;
+      if(fitsfile.getKeyword<float>("SCANLEN",this->scanlen)!=0) 
+	this->scanlen = nullFloat;
 
       float imjd,smjd;
-      if(fitsfile.getKeyword<float>("STT_IMJD",imjd)!=0) this->mjd = nullFloat;
+      if(fitsfile.getKeyword<float>("STT_IMJD",imjd)!=0) 
+	this->mjd = nullFloat;
       else{
 	fitsfile.getKeyword<float>("STT_SMJD",smjd);
@@ -65,12 +79,15 @@
       // From here, we get information from the HISTORY table.
       fitsfile.gotoHistory();
-      if(fitsfile.readColumnValue("TBIN",1,&this->tbin)!=0) this->tbin = nullFloat;
+      if(fitsfile.readColumnValue("TBIN",1,&this->tbin)!=0) 
+	this->tbin = nullFloat;
       else this->tbin *= 1000.;
       if(!(this->tbin>0.)) this->tbin = nullFloat;
 
-      if(fitsfile.readColumnValue("NCHAN",1,&this->nchan)!=0) this->nchan = nullInt;
+      if(fitsfile.readColumnValue("NCHAN",1,&this->nchan)!=0) 
+	this->nchan = nullInt;
       if(this->nchan == 0) this->nchan = nullInt;
 
-      if(fitsfile.readColumnValue("CHAN_BW",1,&this->chanbw)!=0) this->chanbw = nullFloat;
+      if(fitsfile.readColumnValue("CHAN_BW",1,&this->chanbw)!=0) 
+	this->chanbw = nullFloat;
       if(!(this->chanbw>0.)) this->chanbw = nullFloat;
 
@@ -206,4 +223,5 @@
 	      << "\"File Location\","
 	      << "\"Header version\","
+	      << "Survey,"
 	      << "\"Source Name\","
 	      << "RAJ,"
@@ -233,4 +251,9 @@
 	else
 	  fileout << "\""<< datalist[i].getHeaderVersion() << "\",";
+
+	if(datalist[i].getSurvey()==nullString)
+	  fileout << datalist[i].getSurvey()             << ",";
+	else
+	  fileout << "\"" << datalist[i].getSurvey()     << "\",";
 	
 	if(datalist[i].getSrcname()==nullString)
Index: /trunk/src/pvo-metadata.hh
===================================================================
--- /trunk/src/pvo-metadata.hh	(revision 80)
+++ /trunk/src/pvo-metadata.hh	(revision 81)
@@ -35,4 +35,6 @@
  File Location  The full path of the FITS file.\n\
  Header Version The version of the PSRFITS definition used.\n\
+ Survey         Which survey the data comes from:\n\
+                  left blank if not known or not a survey file.\n\
  Source Name    The SRC_NAME keyword.\n\
  RAJd           Right Ascension, in decimal degrees.\n\
@@ -72,4 +74,6 @@
       std::string getFileloc(){return fileloc;};
       void        setFileloc(std::string s){fileloc=s;};
+      std::string getSurvey(){return survey;};
+      void        setSurvey(std::string s){survey=s;};
       std::string getHeaderVersion(){return headerversion;};
       void        setHeaderVersion(std::string s){headerversion=s;};
@@ -119,4 +123,5 @@
       std::string fileloc;
       std::string headerversion;
+      std::string survey;
       std::string srcname;
       std::string raj;
