I have had a php astronomy database online since 2001 which is used by amateur
astronomers to build observing lists before they go out stargazing. I know only very basic
php programming and put this together by finding sample code and editing it to get it
working. It uses a flat table that is queried by the users who choose various parameters
such as galaxy, brightness, etc on an html page and then results are printed on a php
page. Often when a major php upgrade occurs, the code breaks and, so far, I have been
able to fix it, but I am now at an impass.
I’m using php 5.3 but the system will eventually be upgraded to php 5.5 and my code does
not work under 5.5.
The message from my support said the following:
"Please note that the script relies on the “register_globals” feature. This feature is
completely removed in PHP 5.5."
I have spent several hours reading php documentation and various forum posts and I can’t
figure out what part of the code uses the register_globals feature.
The starting html page is at http://virtualcolony.com/sac/galaxies.html
On my HTML form page, this is the code I use to gather the variables.
[code]
|
<img
src=“images/spacer1x1.gif” width=“1” height=“1” border=“0” alt="">
|
Enter
your search criteria below. The default magnitude of 99.9 will show all objects (unknown
magnitude and surface brightness values are shown as 99.9 in this database). Sort order is
by ra (right ascension), mag (magnitude), subr (surface brightness), urano (Uranometria
2000 chart number) or object (object catalog name).
|
<img
src=“images/spacer1x1.gif” width=“1” height=“1” border=“0” alt="">
|
AND
ANT
APS
AQL
AQR
ARA
ARI
AUR
BOO
CAE
CAM
CAP
CAR
CAS
CEN
CEP
CET
CHA
CIR
CMA
CMI
CNC
COL
COM
CRA
CRB
CRT
CRU
CRV
CVN
CYG
DEL
DOR
DRA
EQU
ERI
FOR
GEM
GRU
HER
HOR
HYA
HYI
IND
LAC
LEO
LEP
LIB
LMI
LUP
LYN
LYR
MEN
MIC
MON
MUS
NOR
OCT
OPH
ORI
PAV
PEG
PER
PHE
PIC
PSA
PSC
PUP
PYX
RET
SCL
SCO
SCT
SER
SEX
SGE
SGR
TAU
TEL
TRA
TRI
TUC
UMA
UMI
VEL
VIR
VOL
VUL
|
GALXY
GALCL
|
|
Sort
by:
|
ra_hr
mag
subr
urano
object
[/code]
On my php page, this is the code I use to query the database and print out the result (the
page has a .php3 extension - I don’t know if that should be changed or makes any
difference)
<?php
mysql_connect ('localhost:/tmp/mysql5.sock', 'my_user_name', 'my_password') or
die("Could not connect: " . mysql_error());
mysql_select_db (virtualc_sac);
$result = mysql_query ("select * from saguaro
where con = '$con' and type = '$type' and mag > '$mag1' and subr <
'$mag2' order by $order");
print ("<tr><td colspan='13' align='center'><font face='arial, helvetica' size='2'><b>Search
Results for Galaxies<br> Constellation=$con, Type=$type, Magnitude > $mag1 and
Surface Brightness < $mag2 and Sorted by $order</b><br><br></td></tr>");
if ($row = mysql_fetch_array($result)) {
{print "<tr>
<td width='70' align='left' valign='bottom'><font face='arial, helvetica' size='1'>Object</td>
<td width='60' align='left' valign='bottom'><font face='arial, helvetica'
size='1'>Other<br>Name</td>
<td width='30' align='left' valign='bottom'><font face='arial, helvetica' size='1'>Mag</td>
<td width='30' align='left' valign='bottom'><font face='arial, helvetica' size='1'>Subr</td>
<td width='35' align='left' valign='bottom'><font face='arial, helvetica'
size='1'>Major<br>Axis</td>
<td width='30' align='left' valign='bottom'><font face='arial, helvetica'
size='1'>Minor<br>Axis</td>
<td width='20' align='left' valign='bottom'><font face='arial, helvetica' size='1'>PA</td>
<td width='30' align='left' valign='bottom'><font face='arial, helvetica' size='1'>Urano</td>
<td width='25' align='left' valign='bottom'><font face='arial, helvetica' size='1'>RA hour</td>
<td width='25' align='left' valign='bottom'><font face='arial, helvetica' size='1'>RA min</td>
<td width='25' align='left' valign='bottom'><font face='arial, helvetica' size='1'>Dec deg</td>
<td width='25' align='left' valign='bottom'><font face='arial, helvetica' size='1'>Dec min</td>
<td width='240' align='left' valign='bottom'><font face='arial, helvetica'
size='1'>Notes</td></tr>";}
print ("<br> ");
do {
print "<tr><td width='70' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["object"];
print "</td>";
print "<td width='60' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["other"];
print "</td>";
print "<td width='30' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["mag"];
print "</td>";
print "<td width='30' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["subr"];
print "</td>";
print "<td width='35' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["size_max"];
print "</td>";
print "<td width='30' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["size_min"];
print "</td>";
print "<td width='20' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["pa"];
print "</td>";
print "<td width='30' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["urano"];
print "</td>";
print "<td width='25' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["ra_hr"];
print "<td width='25' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["ra_min"];
print "</td>";
print "<td width='25' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["dec_deg"];
print "</td>";
print "<td width='25' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["dec_min"];
print "</td>";
print "<td width='240' align='left' valign='top'><font face='arial, helvetica' size='1'>";
print $row["notes"];
print "</td></tr>";
} while($row = mysql_fetch_array($result));
} else {print "<tr><td width='100'></td>
<td width='470' colspan='13' align='center'><font face='arial, helvetica' size='2'>Sorry, no
records were found. Try altering your selection criteria. Hitting the BACK button on your
browser will show you your previous selection criteria.</td>";}
?>
Any help would be greatly appreciated. Thanks in advance.
|