$db = pg_connect("dbname=nhoiku options='--client_encoding=EUC_JP'") or die ('db connect error');
function dnds(&$dat,$key){
if(strlen($dat)==0)
$dat=" ";
else{
$dat=str_replace("\r\n\r\n","
",$dat);
$dat=str_replace("\r","
",$dat);
}
}
function error($key){
ob_Start();
phpinfo();
mail("osamu-y@eqg.org","script errer".$key,ob_get_contents());
ob_end_clean();
header("Location: http://nhoiku.eqg.org/kininaru/TOP.html");
exit();
}
function POST_check_Sql($d){
if(eregi("(insert|delete|update|drop|create|grant|revoke|select)",$d))
return 1;
else
return 0;
}
function html_out($pg_Ex){
require_once "HTML/Template/IT.php";
$name_s=array('とちの木保育園'=>'#1','西鷺宮保育園'=>'#1','白鷺保育園'=>'#1',
'聖ピオ保育園'=>'#2','大和保育園'=>'#2','大和北保育園'=>'#2','大和東保育園'=>'#2','丸山保育園'=>'#2',
'南江古田保育園'=>'#3','江原保育園'=>'#3','松が丘保育園'=>'#3','野方北保育園'=>'#3','沼袋保育園'=>'#3','新井保育園'=>'#3',
'沼袋西保育園'=>'#4','野方保育園'=>'#4','あけぼの保育園'=>'#4','打越保育園'=>'#4',
'あさひ保育園'=>'#5','昭和保育園'=>'#5','東中野保育園'=>'#5','住吉保育園'=>'#5',
'仲町保育園'=>'#6','宮園保育園'=>'#6','もみじやま保育園'=>'#6','桃が丘保育園'=>'#6','橋場保育園'=>'#6',
'鍋横保育園'=>'#7','宮の台保育園'=>'#7','本町保育園'=>'#7','中野保育園'=>'#7','本郷保育園'=>'#7',
'弥生保育園'=>'#8','南台保育園'=>'#8','みなみ保育園'=>'#8',
'コンビプラザ中野保育園'=>'#9','田中ナースリー保育園'=>'#9','ピノッキオ保育園'=>'#9','ひまわり保育園'=>'#9','龍の子保育室'=>'#9');
$tpl = new HTML_Template_IT("./");
$tpl->loadTemplatefile("anq2.tpl");
$k=0;$l=0;
while($data=pg_fetch_array($pg_Ex)){
array_walk($data,'dnds');
$tpl->SetVariable("h_name",$data[name]);
$tpl->SetVariable("koko",$name_s[$data[name]]);
$tpl->SetVariable("Q1",$data[q1]);
$tpl->SetVariable("Q2a",$data[q2a]);
$tpl->SetVariable("Q2b1",$data[q2b1]);
$tpl->SetVariable("Q2b2",$data[q2b2]);
$tpl->SetVariable("Q2b3",$data[q2b3]);
if($data[q2b4_1]=="1")
$tpl->SetVariable("Q2b4_1","常勤");
elseif($data[q2b4_1]=="2")
$tpl->SetVariable("Q2b4_1","非常勤");
else
$tpl->SetVariable("Q2b4_1"," ");
$tpl->SetVariable("Q2b4_2",$data[q2b4_2]);
$tpl->SetVariable("Q2b5",$data[q2b5]);
$tpl->SetVariable("Q2b6",$data[q2b6]);
$tpl->SetVariable("Q2b7",$data[q2b7]);
$tpl->SetVariable("Q3a",$data[q3a]);
$tpl->SetVariable("Q3b",$data[q3b]);
if($data[q4a]=="1")
if($_POST[h_name]=="とちの木保育園")
$tpl->SetVariable("Q4a","レンタル(持参可)");
else
$tpl->SetVariable("Q4a","レンタル");
elseif($data[q4a]=="2")
$tpl->SetVariable("Q4a","持参");
elseif($data[q4a]=="3")
$tpl->SetVariable("Q4a","レンタルでも持参でも可");
else
$tpl->SetVariable("Q4a"," ");
if($data[q4b]=="1")
$tpl->SetVariable("Q4b","指定あり(紙)");
elseif($data[q4b]=="2")
$tpl->SetVariable("Q4b","指定あり(布)");
elseif($data[q4b]=="3")
$tpl->SetVariable("Q4b","指定無し");
else
$tpl->SetVariable("Q4b"," ");
if($data[q4c]=="1")
$tpl->SetVariable("Q4c","レンタル");
elseif($data[q4c]=="2")
$tpl->SetVariable("Q4c","持参");
elseif($data[q4c]=="3")
$tpl->SetVariable("Q4c","レンタルでも持参でも可");
else
$tpl->SetVariable("Q4c"," ");
if($data[q4dd]=="1")
$tpl->SetVariable("Q4dd","保護者負担無し");
elseif($data[q4dd]=="2")
$tpl->SetVariable("Q4dd","保護者負担あり");
else
$tpl->SetVariable("Q4dd"," ");
$tpl->SetVariable("Q4d1",$data[q4d1]);
$tpl->SetVariable("Q4d2",$data[q4d2]);
$tpl->SetVariable("Q4d3",$data[q4d3]);
$tpl->SetVariable("Q5a",$data[q5a]);
$tpl->SetVariable("Q5b",$data[q5b]);
$tpl->SetVariable("Q5c",$data[q5c]);
$tpl->SetVariable("Q6a",$data[q6a]);
$tpl->SetVariable("Q6b",$data[q6b]);
$tpl->SetVariable("Q6c",$data[q6c]);
$tpl->SetVariable("Q7a",$data[q7a]);
$tpl->SetVariable("Q7b",$data[q7b]);
$tpl->SetVariable("Q8",$data[q8]);
$tpl->SetVariable("Q9",$data[q9]);
$tpl->SetVariable("Q10",$data[qa10]);
$tpl->SetVariable("Q11a1",$data[qa11a]);
$tpl->SetVariable("Q11a2",$data[qa11b]);
$tpl->SetVariable("Q11b",$data[qa11c]);
$tpl->SetVariable("Q11c",$data[qa11d]);
$tpl->SetVariable("Q12",$data[qa12]);
$tpl->SetVariable("Q13",$data[qa13]);
$tpl->SetVariable("Q14",$data[qa14]);
$k++;
}
$tpl->show();
}
?>
if(strlen($_GET['id'])>0){
$name_s=array('とちの木保育園','西鷺宮保育園','白鷺保育園','聖ピオ保育園','大和保育園','大和北保育園','大和東保育園','丸山保育園','南江古田保育園','江原保育園','松が丘保育園','野方北保育園','沼袋保育園','沼袋西保育園','野方保育園','新井保育園','あけぼの保育園','あさひ保育園','打越保育園','昭和保育園','東中野保育園','住吉保育園','仲町保育園','宮園保育園','もみじやま保育園','桃が丘保育園','橋場保育園','鍋横保育園','宮の台保育園','本町保育園','中野保育園','本郷保育園','弥生保育園','南台保育園','みなみ保育園','コンビプラザ中野保育園','田中ナースリー保育園','ピノッキオ保育園','ひまわり保育園','龍の子保育室');
while(list($k,$v)=each($_GET)){
if(POST_check_Sql($v)==1){
errro(1);
}
}
if($_GET['id']==1000){
header("Location: http://".$HTTP_SERVER_VARS['HTTP_HOST']
.dirname($HTTP_SERVER_VARS['PHP_SELF'])
."/TOP.html");
} else{
if($_GET['id']>39)
error(2);
$pg_Ex=pg_query($db,"select * from anq2 where name='".$name_s[$_GET['id']]."'");
html_out($pg_Ex);
}
} else{
error(3);
}
?>