Changeset 42996
- Timestamp:
- Apr 22, 2026, 5:16:15 PM (2 weeks ago)
- Location:
- branches/eam_branches/ipp-pstamp-20260421/pstamp/web
- Files:
-
- 7 added
- 7 edited
-
authenticate.php (modified) (1 diff)
-
dblogin.php (added)
-
dsroot.php (modified) (4 diffs)
-
findskycell.php (added)
-
getinfo.php (added)
-
index.php (added)
-
pshome.php (added)
-
pstamp.php (modified) (2 diffs)
-
pstamp_links.php (added)
-
pstampconfig.php (modified) (1 diff)
-
request.php (modified) (9 diffs)
-
status.php (added)
-
submitted.php (modified) (5 diffs)
-
upload.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/authenticate.php
r42994 r42996 9 9 10 10 // XXX TODO use mysql 11 $auth_user=" SET_ME";12 $auth_passwd=" SET_ME";11 $auth_user="ps1sc"; 12 $auth_passwd="skysurveys"; 13 13 14 14 $alt_user="SET_ME"; -
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/dsroot.php
r42994 r42996 1 1 <?php // upload.php 2 2 3 // get the loca tl configuration variables3 // get the local configuration variables 4 4 require "pstamp.php"; 5 5 require "dblogin.php"; 6 7 6 8 7 $user = $_SERVER['PHP_AUTH_USER']; … … 22 21 s.innerHTML = s.innerHTML - 1; 23 22 if (s.innerHTML == 0) 24 //window.location = 'http://pstamp.ipp.ifa.hawaii.edu/dsroot.php';23 // window.location = 'http://pstamp.ipp.ifa.hawaii.edu/dsroot.php'; 25 24 location.reload(); 26 25 else … … 40 39 echo "<body>\n"; 41 40 echo "The page will NOW refresh in <span id='timer'> 20</span> mins"; 42 $db server = dblogin();41 $dbconnection = dblogin("DATASTORE"); 43 42 44 43 $query = "SELECT prod_name, last_fs, last_update, type, description FROM dsProduct ORDER BY type, prod_id"; 45 $result = mysqli_query($db server, $query);44 $result = mysqli_query($dbconnection, $query); 46 45 if (!$result) { 47 die("Database access failed: " . mysqli_error($db server));46 die("Database access failed: " . mysqli_error($dbconnection)); 48 47 } 49 48 … … 58 57 $prod_name = $row[0]; 59 58 echo "<td>"; 60 // echo "<a href=\"http://datastore.ipp.ifa.hawaii.edu/$prod_name\">$prod_name</a>"; 61 //$prod_link = "http://datastore.ipp.ifa.hawaii.edu/$prod_name"; 62 $prod_link = "http://datastore.ipp.ifa.hawaii.edu/ds/$prod_name"; 63 64 // $prod_link "<a href=\"http://datastore.ipp.ifa.hawaii.edu/$prod_name\">$prod_name</a>"; 59 $prod_link = "$DS_URL/$prod_name"; 65 60 echo "<a href=\"$prod_link\">$prod_name</a>"; 66 67 61 echo "</td>"; 68 62 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/pstamp.php
r25322 r42996 1 1 2 <?php 2 3 … … 4 5 require_once "authenticate.php"; 5 6 7 function request_var($key, $filter = FILTER_DEFAULT, $default = null, $options = null) { 8 $raw = $_POST[$key] ?? $_GET[$key] ?? null; 9 10 // Treat missing or empty as null 11 if ($raw === '' || $raw === null) { 12 return $default; 13 } 14 15 // Apply validation 16 $val = filter_var($raw, $filter, $options ?? []); 17 18 if ($val === false) { 19 http_response_code(400); 20 die("Invalid value for key '$key'"); 21 } 22 return $val; 23 } 24 25 // $val = filter_input(INPUT_GET, $key, $filter, $options); 26 // if ($val === false) { 27 // http_response_code(400); 28 // echo "<b> invalid GET key $key </b><br>"; 29 // die ("invalid GET key $key"); 30 // } 31 // if ($val !== null) { 32 // return $val; 33 // } 34 // 35 // $val = filter_input(INPUT_POST, $key, $filter, $options); 36 // if ($val === false) { 37 // http_response_code(400); 38 // echo "<b> invalid POST key $key </b><br>"; 39 // die ("invalid POST key $key"); 40 // } 41 // if ($val !== null) { 42 // return $val; 43 // } 44 // return $default; 45 // } 46 6 47 ?> -
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/pstampconfig.php
r25322 r42996 2 2 // BEGIN Local configuration 3 3 4 $WORKDIR = "set to the location of pstamp working directory"; 5 $dsroot = "set to the root of the data store"; 6 $dbname = "set to the pstamp database name"; 7 $dbserver = "set to the pstamp database server"; 4 $WORKDIR = "/data/kukui.2/eugene/datastore.20260421/ps-out"; 5 $DS_ROOT = "/data/kukui.2/eugene/datastore.20260421/dsroot"; 6 $DS_URL = "http://dstest.ifa.hawaii.edu"; 7 // $dbname = "set to the pstamp database name"; 8 // $dbserver = "set to the pstamp database server"; 8 9 9 $PSCONFDIR = ""; 10 $PSCONFIG = ""; 10 # database info for the datastore 11 $DS_HOSTNAME = "localhost"; 12 $DS_USERNAME = "ipp"; 13 $DS_PASSWORD = "ipp"; 14 $DS_DATABASE = "datastore"; 15 16 # database info for the pstamp 17 $PS_HOSTNAME = "localhost"; 18 $PS_USERNAME = "ipp"; 19 $PS_PASSWORD = "ipp"; 20 $PS_DATABASE = "pstamp"; 21 22 $PSCONFDIR = "/home/kiawe/eugene/src/psconfig/"; 23 $PSCONFIG = "ipp-pstamp-20260421"; 11 24 $PSBINDIR = "$PSCONFDIR/$PSCONFIG.lin64/bin"; 12 25 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/request.php
r42994 r42996 22 22 # this script sets up the environment to run IPP commands with current directory 23 23 # $WORKDIR 24 $SCRIPT = "$PSBINDIR/pstamp_runcommand.sh $PSCONFDIR $PSCONFIG $WORKDIR";24 // $SCRIPT = "$PSBINDIR/pstamp_runcommand.sh $PSCONFDIR $PSCONFIG $WORKDIR"; 25 25 26 26 // END of moved to pstampconfig.php … … 57 57 $outFileset = ""; 58 58 59 // Initialize the request variables that we depend upon60 $rvar_project="";61 62 59 $gpc1_selected=""; 63 60 $gpc2_selected=""; … … 67 64 $require_component = 0; 68 65 69 $rvar_email = ""; 70 $rvar_select_by = ""; 71 $rvar_img_type = ""; 72 $rvar_id = ""; 73 $rvar_component = ""; 74 $rvar_survey = "bypass"; 75 $rvar_release = ""; 76 $rvar_data_group = ""; 77 $rvar_filter = ""; 78 79 $rvar_center_type = ""; 80 $rvar_range_type = ""; 81 82 $rvar_RA = ""; 83 $rvar_DEC = ""; 84 $rvar_dRA = ""; 85 $rvar_dDEC = ""; 86 $rvar_X = ""; 87 $rvar_Y = ""; 88 $rvar_W = ""; 89 $rvar_H = ""; 90 91 $rvar_make_jpeg = ""; 92 $rvar_getall_roi = ""; 93 94 $rvar_cmd_mode = ""; 95 $rvar_last_cmd_mode = ""; 96 $rvar_request_id = 0; 97 $rvar_last_request_id = 0; 66 // Initialize the request variables that we depend upon 67 68 // EAM: modern PHP has deprecated the function import_request_variables 69 // I have created a wrapper function to filter_input to replace 70 $rvar_project = request_var ('project', FILTER_SANITIZE_STRING); 71 $rvar_email = request_var ('email', FILTER_VALIDATE_EMAIL); 72 $rvar_select_by = request_var ('select_by', FILTER_SANITIZE_STRING); 73 $rvar_img_type = request_var ('img_type', FILTER_SANITIZE_STRING); 74 $rvar_id = request_var ('id', FILTER_SANITIZE_STRING); 75 $rvar_component = request_var ('component', FILTER_SANITIZE_STRING); 76 $rvar_survey = request_var ('survey', FILTER_SANITIZE_STRING, "bypass"); 77 $rvar_release = request_var ('release', FILTER_SANITIZE_STRING); 78 $rvar_data_group = request_var ('data_group', FILTER_SANITIZE_STRING); 79 $rvar_filter = request_var ('filter', FILTER_SANITIZE_STRING); 80 $rvar_center_type = request_var ('center_type', FILTER_SANITIZE_STRING); 81 $rvar_range_type = request_var ('range_type', FILTER_SANITIZE_STRING); 82 $rvar_RA = request_var ('RA', FILTER_VALIDATE_FLOAT); 83 $rvar_DEC = request_var ('DEC', FILTER_VALIDATE_FLOAT); 84 $rvar_dRA = request_var ('dRA', FILTER_VALIDATE_FLOAT); 85 $rvar_dDEC = request_var ('dDEC', FILTER_VALIDATE_FLOAT); 86 $rvar_X = request_var ('X', FILTER_VALIDATE_FLOAT); 87 $rvar_Y = request_var ('Y', FILTER_VALIDATE_FLOAT); 88 $rvar_W = request_var ('W', FILTER_VALIDATE_FLOAT); 89 $rvar_H = request_var ('H', FILTER_VALIDATE_FLOAT); 90 $rvar_make_jpeg = request_var ('make_jpeg', FILTER_SANITIZE_STRING); 91 $rvar_getall_roi = request_var ('getall_roi', FILTER_SANITIZE_STRING); 92 $rvar_cmd_mode = request_var ('cmd_mode', FILTER_SANITIZE_STRING); 93 $rvar_last_cmd_mode = request_var ('last_cmd_mode', FILTER_SANITIZE_STRING); 94 $rvar_request_id = request_var ('request_id', FILTER_VALIDATE_INT, 0); 95 $rvar_last_request_id = request_var ('last_request_id', FILTER_VALIDATE_INT, 0); 98 96 99 97 // now get the values from this post 100 98 101 import_request_variables("gp", "rvar_");99 // import_request_variables("gp", "rvar_"); 102 100 103 101 if ($rvar_project == "gpc1") { … … 284 282 global $rvar_survey, $rvar_release; 285 283 global $command_line; 286 global $dbname;287 global $dbserver;288 284 global $require_component; 289 285 global $PSCONFDIR, $PSCONFIG, $WORKDIR; … … 314 310 315 311 if ($dbname) { 316 $cmd .= " --dbname $ dbname --dbserver $dbserver";312 $cmd .= " --dbname $PS_DATABASE --dbserver $PS_HOSTNAME"; 317 313 } 318 314 … … 455 451 global $command_status; 456 452 457 // echo "<br>running $command_line\n<br>"; 458 459 exec ("$command_line", $output_array, $command_status); 453 // EAM : testing: 454 echo "<br>running $command_line\n<br>"; 455 456 // EAM : testing: 457 // exec ("$command_line", $output_array, $command_status); 458 http_response_code(400); 459 echo "<b> run command $command_line</b><br>"; 460 die ("run command $command_line"); 460 461 461 462 $size = sizeof($output_array); … … 503 504 global $dsroot; 504 505 $dirName = "$dsroot/$product/$req_name"; 505 // XXX: TODO: make this a configuration parameter 506 //$filesetURL = "http://datastore.ipp.ifa.hawaii.edu/$product/$req_name"; 507 $filesetURL = "http://datastore.ipp.ifa.hawaii.edu/ds/$product/$req_name"; 506 $filesetURL = "$DS_URL/$product/$req_name"; 508 507 509 508 $fullpath = "$dirName/$fileName"; 510 // echo "<pre>fullpath: $fullpath filesetURL: $filesetURL\n</pre>";509 // echo "<pre>fullpath: $fullpath filesetURL: $filesetURL\n</pre>"; 511 510 if (file_exists($dirName)) { 512 511 // this job is done, list the url as a link … … 551 550 s.innerHTML = s.innerHTML - 1; 552 551 if (s.innerHTML == 0) 553 // window.location = 'http://pstamp.ipp.ifa.hawaii.edu/request.php';552 // window.location = 'http://pstamp.ipp.ifa.hawaii.edu/request.php'; 554 553 location.reload(); 555 554 else … … 878 877 <?php 879 878 // echo "calling listRequests\n"; 880 //listRequests("http://datastore.ipp.ifa.hawaii.edu", "pstamp_results_fileset"); 881 listRequests("http://datastore.ipp.ifa.hawaii.edu/ds", "pstamp_results_fileset"); 879 listRequests("$DS_URL", "pstamp_results_fileset"); 882 880 ?> 883 881 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/submitted.php
r42994 r42996 72 72 if ($id && ($req->state != "stop")) { 73 73 // Get the current state of this request from the database 74 if (!$db server) {75 $db server = dblogin();74 if (!$dbconnection) { 75 $dbconnection = dblogin("PSTAMP"); 76 76 } 77 77 … … 79 79 // echo "<br />$query<br />"; 80 80 81 $result = mysqli_query($db server, $query);81 $result = mysqli_query($dbconnection, $query); 82 82 if (!$result) { 83 die("Database access failed: " . mysqli_error($db server));83 die("Database access failed: " . mysqli_error($dbconnection)); 84 84 } 85 85 … … 128 128 function listRequests($dataStoreRoot, $targetWindow) 129 129 { 130 $debug_listing = 0; 131 $request_count = count($_SESSION['requests']); 132 // echo "request_count: $request_count<br />"; 130 $debug_listing = 0; 131 $request_count = count($_SESSION['requests']); 132 $dbconnection = 0; 133 134 // echo "request_count: $request_count<br />"; 133 135 134 136 for ($i = $request_count-1; $i >= 0; $i--) { … … 147 149 // Request not done last time that we checked. 148 150 // Get its current state of this request from the database 149 if (!$db server) {150 $db server = dblogin();151 if (!$dbconnection) { 152 $dbconnection = dblogin("PSTAMP"); 151 153 } 152 154 $query = "SELECT pstampRequest.state, COUNT(job_id) as num_jobs, pstampRequest.fault, pstampRequest.outProduct FROM pstampRequest LEFT JOIN pstampJob USING(req_id) WHERE req_id = $id"; … … 154 156 // echo "<br />$query<br />"; 155 157 156 $result = mysqli_query($db server, $query);158 $result = mysqli_query($dbconnection, $query); 157 159 if (!$result) { 158 die("Database access failed: " . mysqli_error($db server));160 die("Database access failed: " . mysqli_error($dbconnection)); 159 161 } 160 162 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/upload.php
r42994 r42996 72 72 if ($size > 0) { 73 73 // echo "Uploaded $size bytes for '$type' file '$name' as '$tmp_name'<br />"; 74 $command = "$SCRIPT pstamp_insert_request.pl --tmp_req_file $tmp_name --dbname $ dbname --dbserver $dbserver--workdir $WORKDIR";74 $command = "$SCRIPT pstamp_insert_request.pl --tmp_req_file $tmp_name --dbname $PS_DATABASE --dbserver $PS_HOSTNAME --workdir $WORKDIR"; 75 75 } else { 76 76 echo "Error: Received 0 bytes for file '$name' <br />\n"; … … 134 134 echo "<br />\n"; 135 135 136 // listRequests("http://datastore.ipp.ifa.hawaii.edu", "pstamp_results_fileset"); 137 listRequests("http://datastore.ipp.ifa.hawaii.edu/ds", "pstamp_results_fileset"); 136 listRequests($DS_URL, "pstamp_results_fileset"); 138 137 139 138 echo "<br />\n";
Note:
See TracChangeset
for help on using the changeset viewer.
