│
│192.168.1.1
┏┷┓
┃ ┃
┃ ┃WEB example1
┃ ┃
┗┯┛
│192.168.2.1
│
│192.168.2.2
┏┷┓
┃ ┃
┃ ┃DB example2
┃ ┃
┗┯┛
│
[postgres@example2 postgres]$ createdb -E UTF-8 userdic
CREATE DATABASE
[postgres@example2 postgres]$ psql userdic
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
userdic=# create table user_dic (
userdic=# id integer,
userdic=# midasi text,
userdic=# hatuon text,
userdic=# yaku text,
userdic=# yorei text,
userdic=# useragent text,
userdic=# reg_date timestamp
userdic=# );
userdic=# REVOKE ALL ON TABLE user_dic FROM PUBLIC;
userdic=# ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_pkey PRIMARY KEY (id);
userdic=# ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_midasi_key UNIQUE (midasi);
userdic=# GRANT SELECT, INSERT, DELETE, UPDATE ON user_dic TO nobody;
CREATE TABLE
REVOKE
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "user_dic_pkey" for table "user_dic"
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "user_dic_midasi_key" for table "user_dic"
GRANT
userdic=# \q
テーブルの中身。
create table user_dic (
id integer,
midasi text,
hatuon text,
yaku text,
yorei text,
useragent text,
reg_date timestamp
);
REVOKE ALL ON TABLE user_dic FROM PUBLIC;
ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_pkey PRIMARY KEY (id);
ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_midasi_key UNIQUE (midasi);
GRANT SELECT, INSERT, DELETE, UPDATE ON user_dic TO nobody;
*-- OLEクラスのインストール --* [root@example1 root]# pear install -f OLE WARNING: failed to download pear.php.net/OLE within preferred state "stable", will instead download version 0.5, stability "beta" downloading OLE-0.5.tgz ... Starting to download OLE-0.5.tgz (9,058 bytes) .....done: 9,058 bytes install ok: channel://pear.php.net/OLE-0.5 *-- Spreadsheet_Excel_Writerクラスのインストール --* [root@example1 root]# pear install -f Spreadsheet_Excel_Writer WARNING: failed to download pear.php.net/Spreadsheet_Excel_Writer within preferred state "stable", will instead download version 0.8, stability "beta" Did not download dependencies: pear/OLE, use --alldeps or --onlyreqdeps to download automatically downloading Spreadsheet_Excel_Writer-0.8.tgz ... Starting to download Spreadsheet_Excel_Writer-0.8.tgz (55,402 bytes) .............done: 55,402 bytes install ok: channel://pear.php.net/Spreadsheet_Excel_Writer-0.8[ スクリプトの概要 ]
スクリプトは、
/home/example1/public_htmlに設置。
./public_html
│
├─/inc
│ ├─global.inc
│ └─header.inc
├─index.php
├─editor.php
├─userdic_excel.php
├─userdic.css
└─userdic.js
global.incの中身。データベースに接続。
<?php
$DBconnect = pg_connect('host=192.168.2.2 dbname=userdic port=5432 user=nobody');
?>
※ DBサーバーの環境に合わせて変更。
userdic.jsの中身。
/*=========================================================
グローバル変数の設定
=========================================================*/
var m_strRootUrl = "http://192.168.1.1/~example1/";
※ Webサーバーの環境に合わせて変更。