File "recv.php"
Full path: /www/ansys/qgis/common/file_receiver/recv.php
File size: 1.8 KiB (1847 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
$constId = isset($_POST["const_id"]) ? htmlspecialchars($_POST["const_id"]) : "";
$appId = isset($_POST["application_id"]) ? htmlspecialchars($_POST["application_id"]) : "";
$fname = isset($_POST["fname"]) ? htmlspecialchars($_POST["fname"]) : "";
$contents = isset($_POST["contents"]) ? htmlspecialchars($_POST["contents"]) : "";
$regist = isset($_POST["regist"]) ? htmlspecialchars($_POST["regist"]) : "";
print "a";
$file = "./log/log.txt";
$fp = fopen($file, "a");
fwrite($fp, ">\n");
fwrite($fp, ">constID : ". $constId. "\n");
fwrite($fp, ">appID : ". $appId. "\n");
fwrite($fp, ">fname : ". $fname. "\n");
fwrite($fp, ">regist : ". $regist. "\n");
fwrite($fp, ">contents : ". $contents. "\n");
if ($regist == "true")
{
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password = ". $PASS. "
");
if (!$conn)
exit(1);
$select = "select * from qgis.area_events_list where events_file='". $fname. "';";
$res = pg_query($conn, $select);
if (pg_num_rows($res) > 0)
exit(1);
$select = "select max(list_id) as list_id_max from qgis.area_events_list;";
$res = pg_query($conn, $select);
$row = pg_fetch_assoc($res, 0);
$reg_list_id = $row["list_id_max"] + 1;
$insert = "INSERT INTO qgis.area_events_list";
$insert .= " (list_id, const_id, app_id, events_name, events_file, upddatetime, regdatetime)";
$insert .= " VALUES";
$insert .= " ('". $reg_list_id. "', '". $constId. "', '". $appId. "', '". $fname. "', '". $fname. "', current_timestamp, current_timestamp);";
$res = pg_query($conn, $insert);
fwrite($fp, $insert);
}
fclose($fp);
$ofp = fopen("../events_files/". $fname, "w");
fwrite($ofp, $contents);
fclose($ofp);
?>