iedit.cgi

iedit.cgi

You are currently viewing a revision titled "iedit.cgi", saved on 2025年10月30日 8:32 PM by Nawoda
タイトル
iedit.cgi
コンテンツ
#!/usr/bin/perl BEGIN{ $| = 1; print "Content-type: text/html\n\n"; open(STDERR, ">&STDOUT"); } use CGI; $query = new CGI; open(IN, "< save.txt"); @data=<IN>; close (IN); ###################### $name = $query->param('name'); $category = $query->param('category'); $gazou = $query->param('mphoto'); $edit = $query->param('edit'); $filename = $query->param('upload_file'); #if 文################################################### if($filename eq ''){ #画像なし #時間を取得########## local($nsec,$nmin,$nhour,$nmday,$nmon,$nyear)=localtime(time); $nmon++; $nyear+=1900; $day="$nyear/$nmon/$nmday"; ####################### $arenge = "$day\t$name\t$category\t$gazou"; ####################### print <<END; <html> <head> <title>フォトデータベース edit</title> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div align="center"> <h1><b>フォトデータベース edit</b></h1> </div> <hr> END for($i=0;$i<@data;$i++){ if($i=~m/$edit/){ @data[$i] =$arenge; } } ########################### open(FILE,">save.txt")||&error("save.txt 外部ファイルが開きませんでしたエラー"); print FILE @data; close(FILE); ########################### print"edit complete\n"; print"</html></body>\n"; exit; #else 文####################################################画像あり }else{ if($filename !~m/\.jpg$/){die"画像ファイルが適応しておりません。jpg ファイルでお願いしま す。";} ########################## # 画像 MIME タイプの取得 $type = $query->uploadInfo($filename)->{'Content-Type'}; while($bytesread = read($filename, $buffer, 2048)) { $file .= $buffer; } #画像の名前をアクセスタイムから取得# local($nsec,$nmin,$nhour,$nmday,$nmon,$nyear)=localtime(time); $nmon++; $nyear+=1900; $gazouname="$nyear$nmon$nmday$nhour$nmin$nsec"; $day = "$nyear/$nmon/$nmday"; $gazou = "$gazouname.jpg"; #外部ファイルに書き込む## open(OUT, "> images/$gazou") or die("ファイルの保存に失敗しました。"); binmode(OUT); print(OUT $file); close(OUT); #時間を取得################ local($nsec,$nmin,$nhour,$nmday,$nmon,$nyear)=localtime(time); $nmon++; $nyear+=1900; $day="$nyear/$nmon/$nmday"; ########################### $arenge = "$day\t$name\t$category\t$gazou\n"; ########################### print <<END; <html> <head> <title>フォトデータベース edit</title> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div align="center"> <h1><b>フォトデータベース edit</b></h1> </div> <hr> END for($i=0;$i<@data;$i++){ if($i=~m/$edit/){ @data[$i] = $arenge; } } @dat=@data; open(FILE,">save.txt")||&error("save.txt 外部ファイルが開きませんでしたエラー"); print FILE @dat; close(FILE); print"edit complete"; print"</html></body>\n"; } exit;
抜粋
脚注


Old New Date Created Author Actions
2025年10月30日 11:32 AM Nawoda

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です