session_start ();
//connection
// Рисуем весь каталог с + дельта, массив координат в радианах.
$name_catalog = $_GET['name_catalog'];
$name_catalogN = preg_replace("/\"|'/s","",$name_catalog);
$RA_column_name = $_GET['RA_column_name'];
$RA_column_nameN = preg_replace("/\"|'/s","",$RA_column_name);
$Dec_column_name = $_GET['Dec_column_name'];
$Dec_column_nameN = preg_replace("/\"|'/s","",$Dec_column_name);
$Flux_column_name = $_GET['Flux_column_name'];
$Flux_column_nameN = preg_replace("/\"|'/s","",$Flux_column_name);
$Flux_min = $_GET['Flux_min'];
$flux_min = preg_replace("/\"|'/s","",$Flux_min);
$Flux_max = $_GET['Flux_max'];
$flux_max = preg_replace("/\"|'/s","",$Flux_max);
//print " name_catalogN = $name_catalogN, RA_column_nameN = $RA_column_nameN, Dec_column_nameN = $Dec_column_nameN, Flux_column_nameN = $Flux_column_nameN, flux_min = $flux_min, flux_max = $flux_max
";
$table = $name_catalogN;
$conn_string = "host=postgres-prao port=5432 dbname=astro_catalogs user=astro password=lvgfsywundhgsug";
$db = pg_connect($conn_string);
if($db) {
$query = "SELECT $RA_column_nameN, $Dec_column_nameN, $Flux_column_nameN FROM $table WHERE ($Dec_column_nameN>0) and ($Flux_column_nameN>=$flux_min)";
$result = pg_exec($db, $query);
$numb = pg_numrows($result);
$rowFromTable = pg_fetch_array($result);
//print " numb = $numb
";
$query2 = "SELECT $RA_column_nameN, $Dec_column_nameN, $Flux_column_nameN FROM $table WHERE ($Dec_column_nameN<0) and ($Flux_column_nameN>=$flux_min)";
$result2 = pg_exec($db, $query2);
$numb2 = pg_numrows($result2);
$rowFromTable2 = pg_fetch_array($result2);
//print " numb2 = $numb2
";
} else {
print "Can't create connection
";
exit;
}
?>
Catalogs - map |
echo " Каталог $table Количество объектов: $numb "; $i=1; $str_x = ''; $str_y = ''; $str_flux = ''; while (is_array($rowFromTable)) { $RA = $rowFromTable["$RA_column_nameN"]; // альфа в радианах $Dec = $rowFromTable["$Dec_column_nameN"]; // дельта в радианах $flux = $rowFromTable["$Flux_column_nameN"]; $RAn = number_format($RA, 3, '.', ''); $Decn = number_format($Dec, 3, '.', ''); $str_x = $str_x."&".$RAn; // координаты в радианах, альфа $str_y = $str_y."&".$Decn; // координаты в радианах, дельта $str_flux = $str_flux."&".intval($flux); // массив с целыми значениями потоков $f=intval($flux); //print "$RAn - $Decn ( $f ) "; $i++; $rowFromTable=pg_fetch_array($result); } $fl1 = $flux_max/$flux_min; $fl2 = sqrt($fl1); $fl3 = sqrt($fl2); $fl4 = sqrt($fl3); // коэффициент для плотностей потока $fl5 = number_format($fl4+0.5, 3, '.', ''); $flux1=$flux_min*$fl5; $flux2=$flux1*$fl5; $flux3=$flux2*$fl5; $flux4=$flux3*$fl5; $flux5=$flux4*$fl5; $flux6=$flux5*$fl5; //print "flux_min = $flux_min, flux_max = $flux_max; fl5 = $fl5; $flux1, $flux2, $flux3, $flux4, $flux5, $flux6 "; $_SESSION['num_arr'] = $numb; // при register_globals = OFF $_SESSION['flux_min'] = $flux_min; $_SESSION['flux_max'] = $flux_max; $_SESSION['flux_k'] = $fl5; $x_arr = serialize($str_x); //$arrX = unserialize($x_arr); //print_r($arrX); //echo " "; $y_arr = serialize($str_y); //$arrY = unserialize($y_arr); //print_r($arrY); //echo " "; $flux_arr = serialize($str_flux); //$arrF = unserialize($flux_arr); //print_r($arrF); //echo " "; $_SESSION['xx_arr'] = $x_arr; $_SESSION['yy_arr'] = $y_arr; $_SESSION['fluxx_arr'] = $flux_arr; $i=1; $str_x2 = ''; $str_y2 = ''; while (is_array($rowFromTable2)) { $RA2 = $rowFromTable2["$RA_column_nameN"]; // альфа в радианах $Dec2 = $rowFromTable2["$Dec_column_nameN"]; // дельта в радианах $RAn2 = abs(number_format($RA2, 3, '.', '')); $Decn2 = abs(number_format($Dec2, 3, '.', '')); $str_x2 = $str_x2."&".$RAn2; // координаты в радианах, альфа $str_y2 = $str_y2."&".$Decn2; // координаты в радианах, дельта //print "$RA2 - $Dec2 "; $i++; $rowFromTable2=pg_fetch_array($result2); } pg_close($db); $_SESSION['num_arr2'] = $numb2; // при register_globals = OFF $x_arr2 = serialize($str_x2); //$arrX = unserialize($x_arr); //print_r($arrX); //echo " "; $y_arr2 = serialize($str_y2); //$arrY = unserialize($y_arr); //print_r($arrY); //echo " "; $_SESSION['xx_arr2'] = $x_arr2; $_SESSION['yy_arr2'] = $y_arr2; //echo " test_array3.php"; echo " "; // для значений координат в радианах (+ дельта) echo " Каталог $table Количество объектов: $numb2 "; echo " "; // для значений координат в радианах (- дельта) ?> |