perl问题请教

luisic 2004-11-27 10:09:15
源码如下!是从一个IE网页提交的数据,执行此*.cgi程序处理,要求把接收到的数据写入一个新的文件,(该文件不在《/html/》、《/cgi-bin/》目录中),请问我该如何处理,下面的源码有问题吗!我试过直接执行可以生成,但是通过ie执行好象加不进去





#!/usr/bin/perl
use CGI;
$q=new CGI;
###################/处理由web通get方式传来的的表单数据/################

###
$string=$ENV{'QUERY_STRING'};
@temp = split(/&/,$string);

@temp1 = split(/=/,@temp[0]);

@temp2 = split(/=/,@temp[1]);

@temp3 = split(/=/,@temp[2]);

@temp4 = split(/=/,@temp[3]);

@temp5 = split(/=/,@temp[4]);

@temp6 = split(/=/,@temp[5]);

@temp7 = split(/=/,@temp[6]);

@temp8 = split(/=/,@temp[7]);

@temp9 = split(/=/,@temp[8]);

@temp10 = split(/=/,@temp[9]);

@temp11 = split(/=/,@temp[10]);

############################


$xiang_temp = @temp1[1];

$text_domain_temp = @temp2[1];

$record_select_temp = @temp3[1];

$text_record_temp = @temp4[1];

$text_server_temp = @temp5[1];

$text_check_temp = @temp6[1];

$text_email_temp = @temp7[1];

$text_reflash_temp = @temp8[1];

$text_outtime_temp = @temp9[1];

$text_trytime_temp = @temp10[1];

$text_defactive_temp = @temp11[1];


#############调用ToChnString函数解码###############
$xiang = ToChnString($xiang_temp);

$domains = ToChnString($text_domain_temp);

$recordsel = ToChnString($record_select_temp);

$records = ToChnString($text_record_temp);

$servers = ToChnString($text_server_temp);

$emails = ToChnString($text_email_temp);

$checkbox = ToChnString($text_check_temp);

$reflash = ToChnString($text_reflash_temp);

$outtime = ToChnString($text_outtime_temp);

$trytime = ToChnString($text_trytime_temp);

defactive = ToChnString($text_defactive_temp);

###################/处理由web通get方式传来的的表单数据/################



########把数据写入文件(如文件不存在则新建)############
$vars="\$TTL86400\n\tSOA\tausu.com.\troot@localhost.\t{\n";
$logfile="\/var\/www\/cgi-bin\/aaa.cgi";

open AAAFILE,">>$logfile";

print AAAFILE $vars;

close AAAFILE;

########################################################

########################################################

print $q->header;

print $q->start_html();

print "操作成功";

print $q->end_html;
######################################################


#############解码函数定义############
sub ToChnString
{
my($i)=0;
my($chnstring)="";
my($code0)=0; my($code1)=0;
my($string)=@_;
for($i=0;$i<length($string);)
{
if(substr($string,$i,1) eq '%')
{
$temp=(substr($string,$i+1,1).substr($string,$i+2,1));
$chnstring.=chr(hex($temp));
$i+=3;
}
else
{
$chnstring.=substr($string,$i,1);
$i++;
}
}
return($chnstring);
}
...全文
100 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
core 2004-11-29
  • 打赏
  • 举报
回复
open AAAFILE,">>$logfile" or die "$!";
luisic 2004-11-27
  • 打赏
  • 举报
回复
郁闷啊!高手快现身啊
luisic 2004-11-27
  • 打赏
  • 举报
回复
怎么没有人回答我啊

23,121

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧