File "listi.php"
Full path: /www/nakagusuku/wpos/edit/listi.php
File size: 3.67 KiB (3761 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
print "<html>";
print "<head>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"/ansys/config/css/style.css\">";
print "<link rel=\"shortcut icon\" href=\"/ansys/config/favicon.ico\">";
print "<title>退避監視システム</title>";
print "</head>";
print "<body>";
print "<center>";
print "<font size=\"3\"><b>";
print "退避監視システム<br>-作業者情報一覧-";
print "【五洋建設株式会社】";
print "</b></font>";
print "</center>";
print "<hr />";
try
{
$conn = pg_connect("
host = 192.168.100.153
dbname = cnbs
user = postgres
password= am#71ZJ*
");
if (!$conn)
throw new Exception("データベースへの接続に失敗");
$btnregist = isset($_POST["btnregist"]) ? htmlspecialchars($_POST["btnregist"]) : "";
if (strcmp($btnregist, "") != 0)
{
$txtdispno = isset($_POST["txtdispno"]) ? htmlspecialchars($_POST["txtdispno"]) : "";
if (strcmp($txtdispno, "") == 0)
throw new Exception("【登録エラー】表示番号が指定されていません");
if (!is_numeric($txtdispno))
throw new Exception("【登録エラー】表示番号が正しくありません");
$txtwname = isset($_POST["txtwname"]) ? htmlspecialchars($_POST["txtwname"]) : "";
if (strcmp($txtwname, "") == 0)
throw new Exception("【登録エラー】作業員氏名が指定されていません");
$txttagid = isset($_POST["txttagid"]) ? htmlspecialchars($_POST["txttagid"]) : "";
if (strcmp($txttagid, "") == 0)
throw new Exception("【登録エラー】タグIDが指定されていません");
$insertWname = "INSERT INTO nakagusuku.worker_info (dispno, tagid, wname, update, regdate) VALUES ('". $txtdispno ."','". $txttagid. "','". $txtwname. "',current_timestamp,current_timestamp);";
print "<font color=\"#ff0000\">";
if (pg_query($conn, $insertWname))
print "作業員情報を登録しました<br>";
else
print "新規登録に失敗しました<br>";
print "</font>";
}
$selectWname = "SELECT pid, dispno, tagid, wname, useflg FROM nakagusuku.worker_info ORDER BY dispno;";
$res = pg_query($conn, $selectWname);
if (!$res)
throw new Exception("SQLエラー");
print "<center><table border=\"1\" style=\"width:80%\">";
print "<tr bgcolor=\"#ff6666\"><th>表示番号</th><th>タグID</th><th>氏名</th><th>使用状況</th></tr>";
$rowcnt = pg_num_rows($res);
for($i = 0; $i < $rowcnt; $i++)
{
$row = pg_fetch_assoc($res, $i);
print "<tr align=\"center\">";
print "<td><a href=\"./info.php?dispno=". $row["pid"]. "\">". $row["dispno"]. "</a></td>";
print "<td>". $row["tagid"]. "</td>";
print "<td>". $row["wname"]. "</td>";
$vuseflg = strcmp($row["useflg"], "t") == 0 ? "使用中" : "未使用";
print "<td><a href=\"./usei.php?pid=". $row["pid"]. "\">". $vuseflg. "</a></td>";
print "</tr>";
}
print "<tr align=\"center\">";
print "<form method=\"post\">";
print "<td><input type=\"text\" name=\"txtdispno\" value=\"\" style=\"width:100%;\"></td>";
print "<td><input type=\"text\" name=\"txttagid\" value=\"\" style=\"width:100%;\"></td>";
print "<td><input type=\"text\" name=\"txtwname\" value=\"\" style=\"width:100%;\"></td>";
print "<td><input type=\"submit\" name=\"btnregist\" value=\"新規登録\"></td>";
print "</tr>";
print "</form>";
print "</table></center>";
}
catch(Exception $exc)
{
print "<font color=\"#ff0000\">";
print $exc. "<br>";
print "</font>";
}
pg_close($conn);
print "<p style=\"text-align:right;\">";
print "<a href=\"../index.html\">戻る</a>";
print "</p>";
print "<hr>";
print "<center>";
print "<font size=\"3\" face=\"Arial\"><b><i>";
print "penta-ocean";
print "</i></b></font>";
print "</center>";
?>