重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

電子書籍の厳選無料作品が豊富!

$psfileを、同じように$tpfileファイルを作りたいと思っています。いろいろ試してみたんですができませんでした。どこがおかしいか教えてください!

※フォルダ指定が$nendo/tempとなるようにしたいです。

$psfile = "../box/$nendo/$target.pas"; # パスワードファイル
$tpfile = "../box/$nendo/temp/$target.pas"; # コピー
$tgfile = "../box/$nendo/$target.dat"; # 提出・成績ファイル
$mbfile = "../master/box/$nendo/common/meibo.dat"; # 受講生名簿ファイル(master)
$m = 'm';

### $passwd伝達あるか-->無ければ終了。 $psfileあるか-->無ければ$passwd登録
if($passwd ne ''){
chmod 0600,$psfile;
if(open INP, "$psfile" ){
$reppas = <INP>;
close INP;
chmod 0000,$psfile;
}else{
open OUTP, ">$psfile";
print OUTP "$passwd";
close OUTP;
chmod 0000,$psfile;
$reppas = $passwd;
}
if($passwd ne ''){
chmod 0600,$tpfile;
if(open INP, "$tpfile" ){
$reppas = <INP>;
close INP;
chmod 0000,$tpfile;
}else{
open OUTP, ">$tpfile";
print OUTP "$passwd";
close OUTP;
chmod 0000,$tpfile;
$reppas = $passwd;
}

}else{
$coment = "パスワードが記入されていません。 (>_<)";
&dispcom; # $passwdがカラだ。
}

unless($gmail =~ m/@/){
$coment = "連絡メールが記入されていません。 (>_<)";
&dispcom; # $gmailがカラだ。
}

### $passwd照合して,名簿の追加・削除
if($reppas ne $passwd){
## $passwd 不一致
$coment = "パスワードが正しくありません。 (>_<)";
&dispcom;
} else {
## $passwd 一致
chmod 0600,$mbfile; # 名簿の読込
@mbdat = ();
if(open INP, "<$mbfile"){
flock(INP,2);
while ( $temp = <INP> ){
chomp $temp;
@tmp2 = split /<>/,$temp;
if( ($tmp2[0] eq $target) || ($tmp2[1] eq $gname) ) {
if($adddel == 2){
$coment = "二重登録はできません。 (>_<)";
&dispcom; # $targetが二重登録だ。
}else{
if( ($tmp2[0] eq $target) && ($tmp2[1] eq $gname) ) {
chmod 0600,$psfile; # パスワードfile削除
unlink $psfile;
chmod 0600,$tgfile; # パスワードfile削除
unlink $tgfile;
chmod 0600,$tgfile; # 提出・成績記録file削除
unlink $tgfile;
$coment = "$target $gname さんの削除";
}else{
$coment = "削除はできません。 (>_<)";
&dispcom; # $targetと$gnameの1個以上が一致してない。
}
}
}else{
push ( @mbdat , $temp );
}
}
flock(INP,8);
close INP;
chmod 0000,$mbfile;
}

A 回答 (1件)

$nendo/temp


ってフォルダはあるんですか?
    • good
    • 0
この回答へのお礼

早速のご返事ありがとうございます!!もちろん$nendo/tempのフォルダは別のCGIより生成される設定となっていて、生成することも確認済みです。お手数ですが、助言のほうよろしくお願いします。

お礼日時:2008/02/03 02:19

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!